Why does Ctrl+C terminate tests with STATUS_STACK_BUFFER_OVERRUN? #1414
Replies: 1 comment 2 replies
-
Thanks for bringing this up, it's an interesting issue for sure! I wonder if this truly only happens when particular Signal handlers aren't setup by any test either. I would find it interesting to see if a reduced test-run still shows this issue. I.e. if there was a worktree of Ideally, that would make it possible to find a minimal reproduction, and maybe even the reason this happens. |
Beta Was this translation helpful? Give feedback.
-
As Raymond Chen has explained in
STATUS_STACK_BUFFER_OVERRUN
doesn’t mean that there was a stack buffer overrun, this condition is misleading and often not nearly as serious as it may seem, because this way of terminating a process on Windows often does not designate any stack overflow, buffer overrun, or any kind of memory-related bug or error. Instead, it is widely used to terminate a program in any kind of critical immediate failure.Nonetheless, I find it odd that I see this when I cancel gitoxide's test suite with Ctrl+C on Windows, since it does not happen when I cancel other Rust projects' tests when running them in the same way.
As noted in this Stack Overflow answer and that Microsoft documentation,
0xc0000409
designates a (user mode)STATUS_STACK_BUFFER_OVERRUN
.When this is produced by a call to the
__fastfail
intrinsic, there is a separate code that provides additional information. I don't know if that's relevant here or how to extract the information. The other error information shown in that test output isos error 1282
which seems to just mean "invalid operation."For contrast, I have tried running
cargo nextest --all --no-fail-fast
and pressing Ctrl+C on that same Windows system for three other projects, all of which showed a more intuitive termination condition and none of which showed0xc0000409
.ripgrep
:rust-bio
:(With various other interrupted tests, with the same message.)
crossbeam
:(With many other interrupted tests, with the same message.)
"Application Exit by CTRL+C" is an intuitive effect of pressing Ctrl+C to cancel tests, while a request for immediate termination--even if not related to any actual memory errors--is less intuitive.
Full output from all four projects tested can be seen in this gist.
I do not assume this is a bug. But I don't want to assume it isn't, unless this can be explained.
The
nextest
documentation notes that it uses Windows job objects to terminate process trees "immediately," which I would be taken to think might explain this behavior if it always or usually happened, but does not explain it given that it seems only to happen with gitoxide.The effect does not appear specific to when tests from any particular crate of gitoxide are running.
Although I believe no signal--in the usual POSIX-related sense--is being used here to terminate the processes. Nonetheless, maybe this has something to do with how gitoxide deals with signals?
I cannot produce this with
cargo test
commands but I don't know if that means it's related tonextest
or instead if justcargo test
does not show enough information about termination to reveal it. Likewise, I do not know if this can happen under any non-test circumstances when running applications that use gitoxide crates.Beta Was this translation helpful? Give feedback.
All reactions