Skip to content

Add System.exit#13510

Merged
calixtus merged 2 commits into
mainfrom
system-exit
Jul 28, 2025
Merged

Add System.exit#13510
calixtus merged 2 commits into
mainfrom
system-exit

Conversation

@koppor

@koppor koppor commented Jul 8, 2025

Copy link
Copy Markdown
Member

My JabRef had the grizzly threads running on exit. I don't have the time to debug now.

Maybe, in future, there will be other things taking time to properly shut down.

Therfore, I propose to "just" end the JVM so that nothing is left behind by JabRef.

Mandatory checks

  • I own the copyright of the code submitted and I license it under the MIT license
  • [/] Change in CHANGELOG.md described in a way that is understandable for the average user (if change is visible to the user)
  • [/] Tests created for changes (if applicable)
  • [/] Manually tested changed features in running JabRef (always required)
  • [/] Screenshots added in PR description (if change is visible to the user)
  • [/] Checked developer's documentation: Is the information available and up to date? If not, I outlined it in this pull request.
  • [/] Checked documentation: Is the information available and up to date? If not, I created an issue at https://github.com/JabRef/user-documentation/issues or, even better, I submitted a pull request to the documentation repository.

@koppor koppor added the status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers label Jul 8, 2025
@Siedlerchr

Copy link
Copy Markdown
Member

I don't get the problem. We already have shutdown cleanup and stopping of threads. Have you checked with Visual VM what's going on?
and you are sure it's not gradle?

@koppor

koppor commented Jul 9, 2025

Copy link
Copy Markdown
Member Author

I don't get the problem. We already have shutdown cleanup and stopping of threads.
Have you checked with Visual VM what's going on? and you are sure it's not gradle?

Yes, therefore, I wrote following - see the yellow-marked text --> first sentence in the PR description.

image

@koppor

koppor commented Jul 11, 2025

Copy link
Copy Markdown
Member Author

On current main (with some tests in CAYW), grizzly is shut down, but something else is not:

image

Remember: One can start Visual VM by ./gg.cmd gh/oracle/visualvm - gg.cmd is available at https://github.com/eirikb/gg)

@koppor

koppor commented Jul 15, 2025

Copy link
Copy Markdown
Member Author

We log to JavaFX - maybe, this is causing troubles:

2025-07-15 21:03:58 [] org.glassfish.grizzly.http.server.NetworkListener.shutdownNow()
INFO: Stopped listener bound to [127.0.0.1:23119]
2025-07-15 21:04:28 [] org.jabref.gui.util.UiThreadList.sourceChanged()
ERROR: Error while running on JavaFX thread: java.lang.InterruptedException
        at java.base/java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(AbstractQueuedSynchronizer.java:1139)
        at java.base/java.util.concurrent.CountDownLatch.await(CountDownLatch.java:230)
        at org.jabref/org.jabref.gui.util.UiThreadList.sourceChanged(UiThreadList.java:32)
        at javafx.base@24.0.1/javafx.collections.transformation.TransformationList.lambda$getListener$0(TransformationList.java:105)
        at javafx.base@24.0.1/javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
        at javafx.base@24.0.1/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:162)
        at javafx.base@24.0.1/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
        at javafx.base@24.0.1/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:246)
        at javafx.base@24.0.1/javafx.collections.FXCollections$UnmodifiableObservableListImpl.lambda$new$0(FXCollections.java:947)
        at javafx.base@24.0.1/javafx.collections.WeakListChangeListener.onChanged(WeakListChangeListener.java:88)
        at javafx.base@24.0.1/com.sun.javafx.collections.ListListenerHelper$SingleChange.fireValueChangedEvent(ListListenerHelper.java:162)
        at javafx.base@24.0.1/com.sun.javafx.collections.ListListenerHelper.fireValueChangedEvent(ListListenerHelper.java:71)
        at javafx.base@24.0.1/javafx.collections.ObservableListBase.fireChange(ObservableListBase.java:246)
        at javafx.base@24.0.1/javafx.collections.ListChangeBuilder.commit(ListChangeBuilder.java:482)
        at javafx.base@24.0.1/javafx.collections.ListChangeBuilder.endChange(ListChangeBuilder.java:541)
        at javafx.base@24.0.1/javafx.collections.ObservableListBase.endChange(ObservableListBase.java:210)
        at javafx.base@24.0.1/javafx.collections.ModifiableObservableListBase.add(ModifiableObservableListBase.java:200)
        at java.base/java.util.AbstractList.add(AbstractList.java:113)
        at org.jabref/org.jabref.gui.logging.LogMessages.add(LogMessages.java:30)
        at org.jabref/org.jabref.gui.logging.GuiWriter.write(GuiWriter.java:28)
        at org.tinylog.impl@2.7.0/org.tinylog.core.TinylogLoggingProvider.output(TinylogLoggingProvider.java:259)
        at org.tinylog.impl@2.7.0/org.tinylog.core.TinylogLoggingProvider.log(TinylogLoggingProvider.java:186)
        at org.tinylog.api.slf4j@2.7.0/org.tinylog.slf4j.AbstractTinylogLogger.log(AbstractTinylogLogger.java:501)
        at jul.to.slf4j@2.0.17/org.slf4j.bridge.SLF4JBridgeHandler.callLocationAwareLogger(SLF4JBridgeHandler.java:232)
        at jul.to.slf4j@2.0.17/org.slf4j.bridge.SLF4JBridgeHandler.publish(SLF4JBridgeHandler.java:313)
        at java.logging/java.util.logging.Logger.log(Logger.java:962)
        at java.logging/java.util.logging.Logger.doLog(Logger.java:989)
        at java.logging/java.util.logging.Logger.log(Logger.java:1055)
        at org.glassfish.grizzly.http.server@4.0.2/org.glassfish.grizzly.http.server.NetworkListener.shutdownNow(NetworkListener.java:859)
        at org.glassfish.grizzly.http.server@4.0.2/org.glassfish.grizzly.http.server.HttpServer.removeListener(HttpServer.java:188)
        at org.glassfish.grizzly.http.server@4.0.2/org.glassfish.grizzly.http.server.HttpServer.shutdownNow(HttpServer.java:382)
        at org.jabref.jabsrv/org.jabref.http.manager.HttpServerThread.interrupt(HttpServerThread.java:50)
        at org.jabref.jabsrv/org.jabref.http.manager.HttpServerManager.stop(HttpServerManager.java:41)
        at org.jabref/org.jabref.gui.JabRefGUI.lambda$stop$4(JabRefGUI.java:458)
        at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:545)
        at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:328)
        at java.base/java.lang.VirtualThread.run(VirtualThread.java:466)
2025-07-15 21:04:58 [JavaFX Application Thread] org.jabref.logic.util.HeadlessExecutorService.gracefullyShutdown()
ERROR: HeadlessExecutorService did not terminate

@subhramit subhramit added the dev: hotfix High-level fix for a bug, may need root-cause investigation in future. label Jul 26, 2025
Comment on lines +509 to +510
// Just to be sure that we do not leave any threads running
System.exit(0);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment merely restates what the code does without providing additional insight into why this approach was chosen or what specific thread issues it addresses.

@calixtus calixtus left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Und bist du nicht willig, so brauch ich Gewalt!" (Goethe, Der Erlkönig, 1782)

@calixtus calixtus enabled auto-merge July 28, 2025 21:44
@calixtus calixtus added this pull request to the merge queue Jul 28, 2025
Merged via the queue into main with commit 486f4a2 Jul 28, 2025
2 checks passed
@calixtus calixtus deleted the system-exit branch July 28, 2025 22:09
Siedlerchr added a commit that referenced this pull request Aug 2, 2025
* 'main' of github.com:JabRef/jabref: (26 commits)
  Change Open AI to Open AI  (or API Compatible)  (#13608)
  Remove all assignment tracking labels
  Updated architecture and components link in CONTRIBUTING.md (#13606)
  #13301 Fix/unicode reference marks (#13590)
  Show fetch exception at citation relation (#13549)
  More jbang caching
  Sequential run for moving issues
  Update CSL Styles (#13601)
  Fix gradle issues (#13603)
  Add System.exit (#13510)
  New Crowdin updates (#13600)
  Automatic lookup DOI at citation information. (#13596)
  Update heylogs from 0.10.0 to 0.11.1 (#13594)
  add fallback and reenable defaultcomeslast (#13593)
  Fix debian vagrant image (#13589)
  Fix: Replace string "Tests" with "Source Code Tests" in PR Comment (#13587)
  Fix version for SNAPSHOT (#13581)
  Update JDK and JavaFX (#13580)
  Add icon (#13579)
  Fixes link I broke in PR 13568 (#13577)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev: hotfix High-level fix for a bug, may need root-cause investigation in future. status: ready-for-review Pull Requests that are ready to be reviewed by the maintainers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants