With basic installation, the tray app always kills Jellyfin instead of safely stopping it
#81 opened on Mar 9, 2023
Repository metrics
- Stars
- (117 stars)
- PR merge metrics
- (PR metrics pending)
Description
Version: 10.8.9
Operating System: Windows 11 21H2
Architecture: X64
Hi,
First of all, many thanks to you and the Jellyfin team for a wonderful media server.
I install Jellyfin in the recommended Basic Install mode. I noticed that whenever stopping Jellyfin via the tray app, C:\ProgramData\Jellyfin\Server\data would still contain jellyfin.db-shm and jellyfin.db-wal, indicating there was changes yet to be still written to jellyfin.db but couldn't occur because it was killed. Conversely, shutting down Jellyfin with the button on JF's dashboard appears to shut it down cleanly; the extra files mentioned previously aren't in that folder.
I see that the tray app tries to close the main window before killing the process, but Jellyfin has no window to send the message to (and even then, Jellyfin itself needs a message handler for WM_CLOSE), so it will always get killed. I changed the close mechanism to send Ctrl+C here instead and it works, but my code is crude and the reliability of the console APIs always seem to vary from Windows version to Windows version. (As an aside, another commit to the same repo adds a very-hacky-implemented listener for shutdown events so that Jellyfin has about ~10 seconds to safely exit before my PC finally gets powered off.)
It's my understanding that this won't happen in the service mode, because NSSM will also send Ctrl+C to Jellyfin. Thanks again.