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

Daemon doesn't quit when sent SIGINT/SIGTERM #950

Closed
DanTup opened this issue Apr 8, 2020 · 6 comments · Fixed by dart-archive/sse#27 or #969
Closed

Daemon doesn't quit when sent SIGINT/SIGTERM #950

DanTup opened this issue Apr 8, 2020 · 6 comments · Fixed by dart-archive/sse#27 or #969

Comments

@DanTup
Copy link
Contributor

DanTup commented Apr 8, 2020

If I run a project with pub global run webdev serve and hit Ctrl+C (in my macOS terminal), it quits fine. However if I do the same for pub global run webdev daemon, it doesn't quit. I think this worked in the past, as it's causing some of Dart-Code's integration tests to fail.

pub global run webdev daemon
[{"event":"daemon.connected","params":{"version":"0.4.2","pid":18408}}]
[{"event":"daemon.log","params":{"log":"[INFO] Connecting to the build daemon..."}}]
[{"event":"daemon.log","params":{"log":"[INFO] Generating build script..."}}]
[{"event":"daemon.log","params":{"log":"[INFO] Generating build script completed, took 280ms"}}]
[{"event":"daemon.log","params":{"log":"[INFO] "}}]
[{"event":"daemon.log","params":{"log":"[INFO] Starting daemon..."}}]
[{"event":"daemon.log","params":{"log":"[INFO] Initializing inputs"}}]
// Trim boring stuff

Then I hit Ctrl+C and see:

^C[{"event":"app.log","params":{"appId":"Zx8LtUMQv8Vik6vK2PDePw==","log":"Lost connection to device."}}]
[{"event":"app.stop","params":{"appId":"Zx8LtUMQv8Vik6vK2PDePw=="}}]
[{"event":"daemon.log","params":{"log":"[INFO] Stopped debug service on ws://127.0.0.1:59201\n"}}]

However, it then continues to sit there and does not terminate (it does close the browser window though).

The app I'm testing with is here:

https://github.com/Dart-Code/Dart-Code/tree/master/src/test/test_projects/web/hello_world

I'm using a globally activated v2.5.6 of webdev.

DanTup added a commit to Dart-Code/Dart-Code that referenced this issue Apr 8, 2020
@jakemac53
Copy link
Contributor

this might be related to some of the SSE stuff if we still have a connection open

@DanTup
Copy link
Contributor Author

DanTup commented Apr 15, 2020

Yeah, removing keepAlive seems to stop this. I'll see if I can find a fix!

@DanTup
Copy link
Contributor Author

DanTup commented Apr 15, 2020

I've opened a PR in SSE that I think will address this:

dart-archive/sse#27

It exposes a shutdown() method on the SseHandler that can be called from the shutdown code here, to ensure all connections are closed (ignoring their keepAlives).

@DanTup
Copy link
Contributor Author

DanTup commented Apr 15, 2020

Using the code in that PR, this is the change I believe should be made here to call it (it fixes the issue in my brief testing):

Screenshot 2020-04-15 at 17 19 28

I'm not sure whether the code I've removed/commented here can be completely replaced though (and whether the comment should be kept/how it should be updated).

@DanTup
Copy link
Contributor Author

DanTup commented Apr 23, 2020

@grouma oops, my bad comment in that other PR caused this to close, but we still need changes here to call shutdown.

@grouma
Copy link
Member

grouma commented Apr 23, 2020 via email

@grouma grouma reopened this Apr 23, 2020
DanTup added a commit to DanTup/webdev that referenced this issue Apr 24, 2020
…ection

This allows bypassing the keep-alive period and fixes dart-lang#950.
DanTup added a commit to DanTup/webdev that referenced this issue Apr 24, 2020
…ection

This allows bypassing the keep-alive period and fixes dart-lang#950.
grouma pushed a commit that referenced this issue Apr 24, 2020
…ection (#969)

* Switch to telling SseHandler to shutdown instead of closing each connection

This allows bypassing the keep-alive period and fixes #950.

* Update changelog
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants