-
Notifications
You must be signed in to change notification settings - Fork 934
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
Use exec() to delegate to the real cargo/rustc on Unix #31
Comments
Sounds reasonable. When I fix #30 you should be able to do |
Needs more priority. People are getting bitten by this when trying to get backtraces for ICEs. |
This may be problematic: #972 (comment) |
What kind of telemetry would that be? Is anything like that actually being done? It seems like currently, there are unsolved issues affecting users caused by using fork-exec, for the benefit of some potential future feature. Or have I entirely missed some rustup functionality? (Wouldn't be the first time.^^) Maybe another option would be to spawn some "watcher" process, exec in the main process (so signals etc. work properly), and have the "watcher" perform whatever has to be done when the subprocess terminates? Not sure however if that would actually be simpler. EDIT: I just saw |
That seems like the right model, and as an example, We don't want to ptrace the child process (otherwise So that suggests a reasonably straightforward strategy: if rustup is running Is it reasonable to add this form of rustup awareness to rustc and cargo? You could also just pass the fd and not tell the child process about it, but leaking file descriptors is vaguely poor form, and if you're using Also, exempting |
The writing end would close itself automatically as the cargo or rustc exit
without them having any knowledge about the FD anyway.
…On Jul 12, 2017 9:27 PM, "Geoffrey Thomas" ***@***.***> wrote:
Maybe another option would be to spawn some "watcher" process, exec in the
main process (so signals etc. work properly), and have the "watcher"
perform whatever has to be done when the subprocess terminates? Not sure
however if that would actually be simpler.
That seems like the right model, and as an example, strace -D does
exactly this: "Run tracer process as a detached grandchild, not as parent
of the tracee. This reduces the visible effect of strace by keeping the
tracee a direct child of the calling process." Compare what happens if you
send a Ctrl-C to, say, strace python vs. strace -D python.
We don't want to ptrace the child process (otherwise gdb cargo wouldn't
work), so there's not a great cross-platform way to be notified when it
exits. But I'm guessing the motivation for telemetry is to track commands
known to rustup (rustc and cargo, in particular), and not arbitrary
processes run by either rustc run or cargo run.
So that suggests a reasonably straightforward strategy: if rustup is
running rustc or cargo, open a libc::pipe(), pass the reader end to the
watcher process, and add a --rustup-fd option to rustc and cargo and let
the writer end be inherited when you exec those commands. They should learn
to close this fd when they exit, or in the case of cargo run, just before
they exec the target command. (In the future you could pass info over this
fd.) Then the watcher process can just block on reading the pipe. Don't
bother setting up a watcher or a pipe for rustup run commands other than
rustc or cargo, just exec the command like normal.
Is it reasonable to add this form of rustup awareness to rustc and cargo?
You could also just pass the fd and not tell the child process about it,
but leaking file descriptors is vaguely poor form, and if you're using rustup
run or cargo run to launch a long-running process, it's nice not to leave
the watcher process around.
Also, exempting cargo run from telemetry might be simpler and worth doing
as a stopgap - #806
<#806> and #845
<#845> (marked as
dupes of this issue) are specifically about cargo run, and it's
unfortunate that cargo itself execs (rust-lang/cargo#2343
<rust-lang/cargo#2343>) but rustup prevents
this from doing what you want.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#31 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AApc0n5_Wkqjt9YI1IWngUA-kwdNUnigks5sNRATgaJpZM4GZiGs>
.
|
This is only possible when telemetry is disabled, but almost all of the time it is! This should help fix lots of common rustup-related issues related to signals and such. Closes rust-lang#31 Closes rust-lang#806
This is only possible when telemetry is disabled, but almost all of the time it is! This should help fix lots of common rustup-related issues related to signals and such. Closes rust-lang#31 Closes rust-lang#806
This is only possible when telemetry is disabled, but almost all of the time it is! This should help fix lots of common rustup-related issues related to signals and such. Closes rust-lang#31 Closes rust-lang#806
# This is the 1st commit message: Port cli_inst_interactive to CliTestContext # The commit message #2 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #3 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #4 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #5 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #6 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #7 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #8 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #9 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #10 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #11 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #12 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #13 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #14 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #15 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #16 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #17 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #18 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #19 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #20 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #21 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #22 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #23 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #24 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #25 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #26 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #27 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #28 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #29 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #30 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #31 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #32 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #33 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #34 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #35 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #36 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #37 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #38 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #39 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext # The commit message #40 will be skipped: # fixup! Port cli_inst_interactive to CliTestContext
Right now the
Command
API is presumably used which is cross platform (yay!) but doesn't provide the best experience on Unix. For example if Igdb cargo
it doesn't actually gdb the Cargo executable itself but rather the shim. If, however,exec
were used to spawn the new process then gdb I believe should naturally "just work".Plus there's the added benefit of fewer processes sticking around!
The text was updated successfully, but these errors were encountered: