-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Windows: native test wrapper waits for all grandchild processes #8005
Comments
Refactor the Windows JNI library: - create process.cc and process.h - create a WaitableProcess class - move the process creation, waiting, and termination logic to WaitableProcess Next step: use WaitableProcess in the Windows-native test wrapper, to let it kill the subprocess tree and fix bazelbuild#8005
The Windows-native test wrapper now uses the JNI library's WaitableProcess to create, wait for, and terminate the subprocess. This allows killing the whole subprocess tree and not waiting for sub-subprocesses. Fixes bazelbuild#8005
Mostly out of curiosity because I was filing #10245 and this bug turned out as suggested. How was this fixed? If I'm reading things correctly, Bazel now kills the process group on Windows, right? But do you wait for the subprocesses at all? If not, you'd be subject to the same issues I reported. |
If a test times out, Bazel terminates the process tree. We don't wait for subprocesses in this case, so they could leave stale state behind. |
As best as I know, processes can't signal each other on Windows as they can on Linux, so there's no generic graceful termination mechanism like SIGINT or SIGTERM, just the blunt TerminateProcess (like SIGKILL). PostQuitMessage comes to mind for windowed applications (which the majority of Bazel-ran tools aren't), but that requires cooperation from the process (running a message processing loop). |
Note that the |
Description of the problem / feature request:
The Windows-native test wrapper waits for all subprocesses of the test to terminate, even after the test itself terminated.
I believe the test wrapper should use job objects:
bazel/src/main/native/windows/processes-jni.cc
Line 370 in c6c3030
Bugs: what's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
BUILD
:Sleepy.java
:Without test wrapper:
With test wrapper:
What operating system are you running Bazel on?
Windows 10
If
bazel info release
returns "development version" or "(@non-git)", tell us how you built Bazel.Built from source at c6c3030
The text was updated successfully, but these errors were encountered: