serve-d
serve-d copied to clipboard
Process does not terminate on exit notification
I have searched the code for @protocolNotification("exit") but found nothing. Is the behavior that the process does not exit intended?
Also, I get an unexpected notification on startup called "coded/changedSelectedWorkspace", but I can't find anything in the official lsp spec. If this should be D-specific, shouldn't the notification start with $/?
coded/* and served/* are the D-specific messages I'm using. In the LSP spec $/ is for "protocol implementation dependent", which I don't think applies to all custom methods like the extra methods I define. The emitted coded/* notifications should all be opt-in, so that it is sending "coded/changedSelectedWorkspace" could actually be considered a bug (should be a start parameter to have it emitted)
for the exit notification there is a special handler here: https://github.com/Pure-D/serve-d/blob/c745ddb843d075ef501769bc0f3e15bbeb390724/serverbase/source/served/serverbase.d#L260
which if it doesn't fully shutdown the process should terminate it after 1 second here: https://github.com/Pure-D/serve-d/blob/c745ddb843d075ef501769bc0f3e15bbeb390724/source/served/extension.d#L987
it may be possible that there are some stuck threads that don't fully shut it down
Yes, I see the 1-second timeout, but no error message that the server is still running,
2021-11-23T13:48:29.472 [trace] serverbase\source\served\serverbase.d:175:__lambda17 Calling shutdown
2021-11-23T13:48:29.472 [trace] serverbase\source\served\utils\async.d:79:setTimeout Setting timeout for 1 sec
2021-11-23T13:48:29.482 [trace] serverbase\source\served\utils\async.d:79:setTimeout Setting timeout for 1 sec
2021-11-23T13:48:35.103 [trace] serverbase\source\served\serverbase.d:408:collectGC GC run in 463 μs. Freed 77104 bytes (402288 bytes allocated, 4840592 bytes available)
2021-11-23T13:49:05.104 [trace] serverbase\source\served\serverbase.d:408:collectGC GC run in 440 μs and 6 hnsecs. Freed 48192 bytes (402384 bytes allocated, 4840496 bytes available)
2021-11-23T13:49:35.106 [trace] serverbase\source\served\serverbase.d:408:collectGC GC run in 363 μs and 5 hnsecs. Freed 47968 bytes (402384 bytes allocated, 4840496 bytes available)
2021-11-23T13:50:05.108 [trace] serverbase\source\served\serverbase.d:408:collectGC GC run in 413 μs and 6 hnsecs. Freed 48320 bytes (402384 bytes allocated, 4840496 bytes available)
2021-11-23T13:50:35.112 [trace] serverbase\source\served\serverbase.d:408:collectGC GC run in 427 μs and 3 hnsecs. Freed 48272 bytes (402384 bytes allocated, 4840496 bytes available)
2021-11-23T13:51:05.114 [trace] serverbase\source\served\serverbase.d:408:collectGC GC run in 412 μs. Freed 48320 bytes (402384 bytes allocated, 4840496 bytes available)
2021-11-23T13:51:35.118 [trace] serverbase\source\served\serverbase.d:408:collectGC GC run in 454 μs and 9 hnsecs. Freed 48272 bytes (402384 bytes allocated, 4840496 bytes available)
2021-11-23T13:52:05.120 [trace] serverbase\source\served\serverbase.d:408:collectGC GC run in 384 μs. Freed 48320 bytes (402384 bytes allocated, 4840496 bytes available)
2021-11-23T13:52:35.130 [trace] serverbase\source\served\serverbase.d:408:collectGC GC run in 527 μs and 4 hnsecs. Freed 48288 bytes (402384 bytes allocated, 4840496 bytes available)
2021-11-23T13:53:05.132 [trace] serverbase\source\served\serverbase.d:408:collectGC GC run in 486 μs and 4 hnsecs. Freed 48320 bytes (402384 bytes allocated, 4840496 bytes available)
2021-11-23T13:53:35.138 [trace] serverbase\source\served\serverbase.d:408:collectGC GC run in 419 μs and 2 hnsecs. Freed 48304 bytes (402384 bytes allocated, 4840496 bytes available)
and yes, the main thread along with 4 others are still running at that time.
Ok, then I will put coded and served on the TODO list.
Let's see how these can be incorporated/used in Npp in the future.
if it's still running after the timeout that's a bug in serve-d right now, I have seen something like that happen with the tests, need to extend them to properly test quitting.
you can leave the custom prefixes out, but they are nice for extra integration into the editor (see readme of this project for documentation of the custom methods)
has been fixed on master / nightly / pre-release