Skip to content
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

cwd target doesn't work with ibazel #67

Open
alexeagle opened this issue Dec 13, 2024 · 6 comments
Open

cwd target doesn't work with ibazel #67

alexeagle opened this issue Dec 13, 2024 · 6 comments

Comments

@alexeagle
Copy link
Contributor

alexeagle commented Dec 13, 2024

A customer pointed out that the pattern documented on the README
https://github.com/theoremlp/rules_multitool?tab=readme-ov-file#running-tools-in-the-current-working-directory
doesn't work correctly with some programs like ibazel (bazel-watcher) because zombie processes get left behind.
We think this post from @lberki is related https://groups.google.com/g/bazel-discuss/c/I6TWUv8AI5o
I think this can be reproduced by running some server target under ./tools/ibazel //my/server:target, then when you ctrl-c (SIGINT) you'll still see the server is running.

So we changed our aspect init aspect-build/aspect-workflows-template#87
to still stamp out a script that DOES function correctly:

#!/bin/sh
target="@multitool//tools/$(basename "$0")"
bazel 2>/dev/null build "$target" && exec $(bazel info execution_root)/$(bazel 2>/dev/null cquery --output=files "$target") "$@"

Personally I think bazel run is still just busted in a way rules_multitool shouldn't try to fix.

@mark-thm
Copy link
Contributor

Ah, that's a bummer. I wasn't able to find a current issue on Bazel's GitHub issues tracker, I'll file one.

@mark-thm
Copy link
Contributor

I tried to build a minimal reproduction of bazel run propagating SIGINT but was able to successfully trap SIGINT using the example from the linked mailing list. It seems like bazel run (at least in Bazel 7.0.0+) is propagating SIGINT.

I do see that ibazel is leaving dangling processes when run through multitool's cwd target, but it's less clear to me that bazel run is broken?

@mark-thm
Copy link
Contributor

When running your provided script I see the same dangling bazel processes -- so it seems like this is really an ibazel bug.

@alexeagle
Copy link
Contributor Author

Interesting, @walkerburgin confirmed they saw a problem but I don't know what Bazel version. Do you have time to make a repro?

@mark-thm
Copy link
Contributor

Running latest ibazel directly (no bazel, shell, or multitool involved) also leaves dangling processes on a ctrl+c.

@alexeagle
Copy link
Contributor Author

Yeah it's an ibazel bug, it so happens that calling it through bazel run exposes it while invoking the ibazel binary directly does not. So I think the only change here should be a warning in that README not to use that pattern with ibazel.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants