Skip to content

Commit 4d41a2d

Browse files
authored
Clarify compute-sanitizer warnings (#244)
1 parent d470881 commit 4d41a2d

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

book/src/puzzle_10/memcheck.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,14 @@ MODULAR_DEVICE_CONTEXT_MEMORY_MANAGER_SIZE_PERCENT=0 pixi run compute-sanitizer
168168

169169
```txt
170170
========= COMPUTE-SANITIZER
171+
[...]:WARNING close_multiple.cc:66] close: Bad file descriptor (9)
172+
[...]:WARNING close_multiple.cc:66] close: Bad file descriptor (9)
173+
Please submit a bug report to https://github.com/modular/modular/issues and include the crash backtrace along with all the relevant source codes.
174+
Stack dump:
175+
0. Program arguments: .../.pixi/envs/default/bin/mojo problems/p10/p10.mojo --memory-bug
176+
#0 0x... (/.../.pixi/envs/default/bin/mojo+0x...)
177+
...
178+
[...] intermediate process terminated by signal 11 (Segmentation fault) (core dumped)
171179
out shape: 2 x 2
172180
Running memory bug example (bounds checking issue)...
173181
out: HostBuffer([10.0, 11.0, 12.0, 13.0])
@@ -178,6 +186,8 @@ expected: HostBuffer([10.0, 11.0, 12.0, 13.0])
178186

179187
**✅ SUCCESS:** No memory violations detected!
180188

189+
> **Note on the segfault**: The crash lines above ("intermediate process terminated by signal 11") are a known compatibility issue between Mojo's process initialization and compute-sanitizer's injection libraries. They appear *before* the GPU kernel runs and do not affect the sanitizer's analysis. See the note at the end of this page for details.
190+
181191
## Key learning points
182192

183193
### Why manual bounds checking matters
@@ -200,4 +210,4 @@ expected: HostBuffer([10.0, 11.0, 12.0, 13.0])
200210
MODULAR_DEVICE_CONTEXT_MEMORY_MANAGER_SIZE_PERCENT=0 pixi run compute-sanitizer --tool memcheck mojo your_code.mojo
201211
```
202212

203-
**Note**: You may see Mojo runtime warnings in the sanitizer output. Focus on the `========= Invalid` and `========= ERROR SUMMARY` lines for actual memory violations.
213+
**Note on Mojo + compute-sanitizer compatibility**: You may see a crash at the start of the sanitizer output — lines like `close: Bad file descriptor`, a stack dump, and `intermediate process terminated by signal 11 (Segmentation fault)`. This is a known issue where compute-sanitizer's injection libraries conflict with Mojo's process initialization. Despite the crash, the sanitizer completes its GPU kernel analysis correctly. Always use the `========= ERROR SUMMARY` line at the end as the authoritative result, and look for `========= Invalid` lines for specific memory violations.

0 commit comments

Comments
 (0)