-
Notifications
You must be signed in to change notification settings - Fork 30.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
debugger: fix stuck debugger when debuggee exits #6332
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,6 +128,11 @@ void Agent::Enable() { | |
parent_env()->AssignToContext(debug_context); | ||
} | ||
|
||
static void close_handle(uv_handle_t* handle, void* data) { | ||
if (!uv_is_closing(handle)) { | ||
uv_close(handle, nullptr); | ||
} | ||
} | ||
|
||
void Agent::Stop() { | ||
int err; | ||
|
@@ -149,6 +154,9 @@ void Agent::Stop() { | |
CHECK_EQ(err, 0); | ||
|
||
uv_close(reinterpret_cast<uv_handle_t*>(&child_signal_), nullptr); | ||
// Close all remaining handles: | ||
// uv_loop_close will return UV_EBUSY for handles which are not closed. | ||
uv_walk(&child_loop_, close_handle, nullptr); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a workaround. I can't explain why there are always two pipe handles left referenced.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They are the stdout and stderr pipes. Closing them like that is not very optimal, it leaves their PipeWrap instances in an invalid state. Proper cleanup is one of the things I have to tackle for the multi-isolate work. I'll try to get around to it later this week. |
||
uv_run(&child_loop_, UV_RUN_NOWAIT); | ||
|
||
err = uv_loop_close(&child_loop_); | ||
|
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 ends up calling
this.socket.destroy
I didn't dig too much further, but is this operation synchronous? If not there might be some unexpected behavior here
/cc @bnoordhuis
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 will dig into this. I used destroy, because it was already used in the close event.
Maybe
this.socket.end()
would be sufficient here.Edit: It seems that
this.socket.end()
also works. But it eventually will also call destroy.