-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
PostgreSQL processes remain running after JabRef crashes or is forcefully terminated #12844
Comments
Sigkill cannot be caught, but it would probably make sense to add a shutdown hook to ensure running instances are closed when sigterm occurs |
I have faced this too (noticed this yesterday). Every time I close and re-run JabRef (when running via IntelliJ), my task manager shows the old Postgres instance running. On running a new JabRef session again, a new Postgres session is also launched. After 5-6 trials, I was wondering why my system was lagging so much, then checked the task manager which had 6 running postgres instances. Edit - what I meant was another implication of this is lag during development. Edit - more details: Second run using IntelliJ reload: Now there are 2 background processes, 12 instances: All of them on CPU 00: And so on... |
https://adambien.blog/roller/abien/entry/sigterm_sigint_sigkill_and_java https://docs.oracle.com/en/java/javase/21/troubleshoot/handle-signals-and-exceptions.html |
Tried with: public class Launcher {
public static void main(String[] args) {
...
PostgreServer postgreServer = new PostgreServer();
Injector.setModelOrService(PostgreServer.class, postgreServer);
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
if (postgreServer != null) {
try {
postgreServer.shutdown();
System.out.println("PostgreServer successfully shut down");
} catch (Exception e) {
System.err.println("Error shutting down PostgreServer: " + e.getMessage());
}
}
}));
JabRefGUI.setup(uiCommands, preferences, fileUpdateMonitor);
JabRefGUI.launch(JabRefGUI.class, args);
}
} Didn't work |
On checking logs, neither the try nor the catch is executed. On reading more, it appears that it's because there is no way to reliably execute code in case of a SIGKILL (the shutdownhook helps in case of SIGTERM and SIGINT). |
Sigkill is not catchable. That would be against its purpose
Subhramit Basu ***@***.***> schrieb am Fr., 28. März 2025,
19:42:
… Tried with:
...
Didn't work
On checking logs, neither the try nor the catch is executed. On reading
more, it appears that it's because there is no way to reliably execute code
in case of a SIGKILL (the shutdownhook helps in case of SIGTERM and SIGINT).
—
Reply to this email directly, view it on GitHub
<#12844 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACOFZESHHWCNLJHJILYGWL2WWJ2ZAVCNFSM6AAAAABZ7S5722VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRSGE2TMMRXGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
[image: subhramit]*subhramit* left a comment (JabRef/jabref#12844)
<#12844 (comment)>
Tried with:
...
Didn't work
On checking logs, neither the try nor the catch is executed. On reading
more, it appears that it's because there is no way to reliably execute code
in case of a SIGKILL (the shutdownhook helps in case of SIGTERM and SIGINT).
—
Reply to this email directly, view it on GitHub
<#12844 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACOFZESHHWCNLJHJILYGWL2WWJ2ZAVCNFSM6AAAAABZ7S5722VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDONRSGE2TMMRXGY>
.
You are receiving this because you commented.Message ID:
***@***.***>
|
Hmm...so is this issue unsolvable from the perspective of shutdown it seems.. |
Idea for workaround: On start of new JabRef instance, old postgres (from JabRef) could be re-used (or killed) |
To me, this feels a bit like performing "magic" on the user's machine. Implementing such behavior is likely to be complex and error-prone.
This leads to a critical question: Which instance should JabRef attempt to reuse - or safely shut down? |
JabRef version
Latest development branch build (please note build date below)
Operating system
Windows
Details on version and operating system
Windows 10
Checked with the latest development build (copy version output from About dialog)
Steps to reproduce the behaviour
When JabRef crashes or is forcefully terminated (e.g., via
kill -9
or Task Manager), associated PostgreSQL processes often remain running. These orphaned processes continue to consume system resources unnecessarily.Steps to Reproduce
kill -9
or Task Manager).ps
on Linux/macOS.PostgreSQL Server
processes are still running.Expected Behavior
All PostgreSQL-related processes spawned by JabRef should terminate when JabRef is unexpectedly closed.
Actual Behavior
PostgreSQL processes persist after JabRef exits unexpectedly, leading to orphaned background processes.
Appendix
Screenshot
The text was updated successfully, but these errors were encountered: