-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
GH-142591: Tachyon does not handle non-existent file/module #142592
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
GH-142591: Tachyon does not handle non-existent file/module #142592
Conversation
|
Hmm, there's a better fix here. Please hold :D |
Lib/profiling/sampling/cli.py
Outdated
| """Handle live mode for an existing process.""" | ||
| # Check if process exists | ||
| try: | ||
| os.kill(pid, 0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure this works on windows. On Windows, os.kill() only supports signals SIGTERM, CTRL_C_EVENT, and CTRL_BREAK_EVENT. Signal 0 (which is the Unix idiom for checking if a process exists without sending a signal) is not supported on Windows.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This also has a TOCTOU problem: the process may die after you check and before we attach
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fix probably needs to be done more on the line of https://github.com/python/cpython/pull/142655/changes (we should handle this there)
|
I've made some improvements to the implementation.
|
fe664f9 to
980b035
Compare
980b035 to
24086c8
Compare
pablogsal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Thanks a lot for the PR @savannahostrowski ❤️
This validates script/module/PID exists before starting the profiler. If the target doesn't exist, we now fail fast with a clear error instead of launching an empty TUI.