-
-
Notifications
You must be signed in to change notification settings - Fork 122
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
set socket as inheritable #190
base: main
Are you sure you want to change the base?
set socket as inheritable #190
Conversation
Humm, something else seems off... by default when a new process is spawned, a new connection from the debugger to the client should be done instead of reusing a socket (so, I'm surprised making it inheritable actually works at all). Do you know why that makes it work? Do you think it'd be possible to have a test-case which reproduces the issue (without Bazel in the middle?) Note: the (few) failing tests are due to one unrelated issue (GitHub is having some issues on providing |
ok I will try to reproduce it without Bazel in the middle and with the latest versions. If I manage to do so, I will look into writing a test case. I've been using an older version of the debugger (as the latest version from
so I wonder if it's possible the new connection behavior you described was added after I am not sure also if the debugger that is bundled with intellij is the exact same one on this repo, this was the procudure I used, let me know if that's complete non-sense:
|
Humm, that seems a bit dangerous... I think Intellij has a fork which they update from time to time with this one. I don't know if they made any change on their own repo which they haven't upstreamed (which could potentially break their client implementation). |
@fabioz I am indeed able to reproduce this. Here is a minimal file to reproduce it with:
I will get this output with the patch:
However without the patch I get always a keyboard interrupt:
The second process always receives a KeyboardInterrupt when the socket isn't set as inheritable. I'm testing on OSX, the following showed the same results:
However when I switch to python 3.3.7, it works as intended, printing 2 lines and confirming the regression from python 3.4. |
I now tried to create a test case for it, but I am now stuck. The test fail as it is not breaking a second time on the same line during the second execution of the program. I'm not sure what I am missing, any pointers? Should the writer be reconnected somehow? |
Setting the client socket as inheritable would fix issues with the debugger when the application creates a child process with
os.execv
. This behavior used to work prior to python 3.4, since python 3.4, sockets are by default not inheritable.Link to the relevant python doc: https://docs.python.org/3/library/os.html#fd-inheritance
More specifically, this fix will allow us to debug bazel programs with the bazel intellij plugin. Thread here: bazelbuild/intellij#402
Edit: tests are failing but I'm not sure why, I'd be grateful if anyone could help with fixing those and merging the PR.