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

Stop inspect the main thread Blocked. #12559

Closed
823639792 opened this issue Apr 21, 2017 · 8 comments · Fixed by #12777
Closed

Stop inspect the main thread Blocked. #12559

823639792 opened this issue Apr 21, 2017 · 8 comments · Fixed by #12777
Assignees
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. inspector Issues and PRs related to the V8 inspector protocol question Issues that look for answers.

Comments

@823639792
Copy link

823639792 commented Apr 21, 2017

node version: 7.5.0
platform: win7

I start node with "node --inspect c:\node.js"
And I wand to stop inspect, but the main thread Blocked.

	global_env->inspector_agent()->Stop();  // this line blocked.
        global_env->debugger_agent()->Stop();

and block in

int uv_thread_join(uv_thread_t *tid) {
  if (WaitForSingleObject(*tid, INFINITE))    //this line  block forever
    return uv_translate_sys_error(GetLastError());
  else {
    CloseHandle(*tid);
    *tid = 0;
    return 0;
  }
}

call process._debugEnd(); have same question.

@mscdex mscdex added c++ Issues and PRs that require attention from people who are familiar with C++. inspector Issues and PRs related to the V8 inspector protocol question Issues that look for answers. labels Apr 21, 2017
@eugeneo
Copy link
Contributor

eugeneo commented Apr 21, 2017

Is it "Waiting for frontend to disconnect"?

@823639792
Copy link
Author

I don't thing so,because my chrome inspector not connected.

@bnoordhuis
Copy link
Member

@823639792 Can you post exact steps to reproduce and check whether it still happens with the latest v7.x release?

@823639792
Copy link
Author

823639792 commented Apr 25, 2017

@bnoordhuis

node version: 7.8.0
platform: win7
1、node --inspect c:\node.js
2、call method process._debugEnd() in c:\node.js

In fact, I embeded node in my win32 application, And want to reload nodejs: release and alloc new。

And I force edit source code:

void AgentImpl::Stop() {
#if 0 
//remove by hzy 
	int err = uv_thread_join(&thread_);
	CHECK_EQ(err, 0);
#else
	server_->Stop(nullptr);
#endif
  delete inspector_;
}

Now node can reload when inspector not connect, but if inspector connect it still crash。
How terrible my code。-_-|||

@eugeneo
Copy link
Contributor

eugeneo commented Apr 25, 2017

Thank you for reporting it. I see the issue, debugging now.

@823639792
Copy link
Author

823639792 commented May 8, 2017

@eugeneo
Hello, I add you code to my project, if no inspector attached, it works well.
But if chrome inspector attached, and call _debugEnd, it still blocked.
blocked in:

InspectorIo::WorkerRunIO ->
uv_run(&loop, UV_RUN_DEFAULT); ->
(*poll)(loop, timeout); ->
uv_poll_ex() ->
pGetQueuedCompletionStatusEx 

@eugeneo
Copy link
Contributor

eugeneo commented May 9, 2017

Are you using Chrome DevTools? Try the same with a different frontend (e.g. VS Code). Chrome DevTools have a bug - https://bugs.chromium.org/p/chromium/issues/detail?id=718619 - I hope I will have time this week to look into it.

@823639792
Copy link
Author

Both “chrome://inspect” and connecting through “chrome-devtools://...” blocked。
Maybe some wrong in my code. or my version is 7.8 and you is 8.0。I will try to find root cause。

jasnell pushed a commit that referenced this issue May 23, 2017
This change ensures that the WebSocket server can be stopped
(and restarted if needed) buy calling process._debugEnd.

PR-URL: #12777
Fixes: #12559
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
jasnell pushed a commit that referenced this issue May 23, 2017
This change ensures that the WebSocket server can be stopped
(and restarted if needed) buy calling process._debugEnd.

PR-URL: #12777
Fixes: #12559
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c++ Issues and PRs that require attention from people who are familiar with C++. inspector Issues and PRs related to the V8 inspector protocol question Issues that look for answers.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants