-
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
bazel run/test ignore segmentation violations #21470
Comments
Bazel isn't technically ignoring anything. All If the |
Thanks for the quick response and the shared link. Does bazel change the return code then? I don't understand why I get |
Or maybe bazel catches the SIGSEGV signal and/or doesn't forward it? Or a hardcoded exit(-1) in case of an abnormal exit of the application? |
Actually, ignore what I said above. I wrongly assumed In addition, I can't reproduce this issue when running Bazel 7.0.2 directly; I can only reproduce it when running it through Bazelisk. Are you also running Bazelisk? |
For Bazelisk, it makes total sense that the abnormal termination wouldn't be detected by the shell: Bazelisk does in fact run Bazel as a child process and waits for it to terminate, then forwards its error code to the shell invoking Bazelisk. But the shell looks at the full process termination status (see wait(2) manpage), not just the exit code, so from its point of view Bazelisk terminated normally. I suspect the 139->255 exit code transformation has to do with how So the solution here would be to either have Bazelisk exec Bazel (which is going to be awkward, since exec doesn't exist on Windows), or have Bazelisk detect the abnormal termination and print the message itself. |
wow thanks for the in-depth analysis. Indeed I am using bazelisk to ease version updates. It's been quite some time since I switched to bazelisk so I already forgot that I am not using bazel natively :) thank you |
@andrej-eisfeld It would make sense to file an issue on the Bazelisk repo. Bazelisk is supposed to be an "install once and forget" wrapper around Bazel, so discrepancies like this could very well be considered a bug. |
Description of the bug:
bazel run
hides segmentation violations, e.g. it doesn't print them on the commandline. It likely just filters them out for some reason. This way bugs in the codebase might go unnoticed for some time and end up on the main development branch. It makes it also harder to figure out the root cause of crashesWhich category does this issue belong to?
Core
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
main.cc
BUILD
When we "bazel run" the cc_binary here's what we get:
Running the binary from bazel-bin instead we clearly see the application segfaults (return code 139)
Which operating system are you running Bazel on?
Ubuntu 22.04
What is the output of
bazel info release
?release 7.0.2
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
Is this a regression? If yes, please try to identify the Bazel commit where the bug was introduced.
No regression. Apparently this bug exists for years already and hasn't been fixed yet. See #1304
Have you found anything relevant by searching the web?
#1304
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: