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

Uncaught Exception: "You need to start the file monitor before watching files" when opening a file #6073

Closed
janbac opened this issue Mar 6, 2020 · 8 comments · Fixed by #6637
Labels
good first issue An issue intended for project-newcomers. Varies in difficulty. ui
Projects

Comments

@janbac
Copy link

janbac commented Mar 6, 2020

JabRef Version 5.0--2020-03-06--b6d6b79 on Debian GNU/Linux 10 (buster)
(installed from .deb file)

What happens:
After a fresh restart jabref works fine. A few days later jabref refuses to open any bib file, producing an error message:
Uncaugh Exception
java.lang.NullPointerException: You need to start the file monitor before watching files

After the next restart jabref works again.

I tracked this down to a restriction in the number of files that inotify can watch concurrently.

If that number is reached on a system, jabref wont open files anymore.

The default on debian is quite low...

Users may recognize this when they use "tail -f" and it says:
tail: inotify cannot be used, reverting to polling: Too many open files

Here is a blog-post that describes the mechanism and the fix
https://medium.com/@ivanermilov/how-to-fix-inotify-cannot-be-used-reverting-to-polling-too-many-open-files-bb1c1437dbf

What should happen:
Jabref should warn me, that it cannot detect changes to my .bib file by other programs
or even also revert to polling as tail does
but open the file anyway

It would be great if the warning would point me to the right solution

Steps to reproduce the behavior:

  1. sudo sysctl -w fs.inotify.max_user_watches=1
  2. sudo sysctl -w fs.inotify.max_user_instances=1
  3. touch aNotExistingFile
  4. tail -f aNotExistingFile &
  5. start jabref
  6. open a bib-file
Full Backtrace java.lang.NullPointerException: You need to start the file monitor before watching files at java.base/java.util.Objects.requireNonNull(Unknown Source) at org.jabref/org.jabref.gui.util.DefaultFileUpdateMonitor.addListenerForFile(Unknown Source) at org.jabref/org.jabref.gui.collab.DatabaseChangeMonitor.lambda$new$0(Unknown Source) at java.base/java.util.Optional.ifPresent(Unknown Source) at org.jabref/org.jabref.gui.collab.DatabaseChangeMonitor.(Unknown Source) at org.jabref/org.jabref.gui.BasePanel.resetChangeMonitorAndChangePane(Unknown Source) at org.jabref/org.jabref.gui.BasePanel.setupMainPanel(Unknown Source) at org.jabref/org.jabref.gui.BasePanel.(Unknown Source) at org.jabref/org.jabref.gui.importer.actions.OpenDatabaseAction.addNewDatabase(Unknown Source) at org.jabref/org.jabref.gui.importer.actions.OpenDatabaseAction.lambda$openTheFile$1(Unknown Source) at org.jabref/org.jabref.gui.util.DefaultTaskExecutor.lambda$getJavaFXTask$3(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source) at org.jabref.merged.module/javafx.event.Event.fireEvent(Unknown Source) at org.jabref.merged.module/javafx.concurrent.EventHelper.fireEvent(Unknown Source) at org.jabref.merged.module/javafx.concurrent.Task.fireEvent(Unknown Source) at org.jabref.merged.module/javafx.concurrent.Task.setState(Unknown Source) at org.jabref.merged.module/javafx.concurrent.Task$TaskCallable.lambda$call$1(Unknown Source) at org.jabref.merged.module/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at org.jabref.merged.module/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source) at org.jabref.merged.module/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)
@tobiasdiez tobiasdiez added good first issue An issue intended for project-newcomers. Varies in difficulty. ui labels Mar 6, 2020
@tobiasdiez tobiasdiez added this to Needs triage in Bugs via automation Mar 6, 2020
@tobiasdiez tobiasdiez moved this from Needs triage to Normal priority in Bugs Mar 6, 2020
@Mebus
Copy link

Mebus commented Jun 11, 2020

Hallo,

i get the same problem on Fedora Linux 23:

java.lang.NullPointerException: You need to start the file monitor before watching files
	at java.base/java.util.Objects.requireNonNull(Unknown Source)
	at org.jabref/org.jabref.gui.util.DefaultFileUpdateMonitor.addListenerForFile(Unknown Source)
	at org.jabref/org.jabref.gui.collab.DatabaseChangeMonitor.lambda$new$0(Unknown Source)
	at java.base/java.util.Optional.ifPresent(Unknown Source)
	at org.jabref/org.jabref.gui.collab.DatabaseChangeMonitor.<init>(Unknown Source)
	at org.jabref/org.jabref.gui.BasePanel.resetChangeMonitorAndChangePane(Unknown Source)
	at org.jabref/org.jabref.gui.BasePanel.setupMainPanel(Unknown Source)
	at org.jabref/org.jabref.gui.BasePanel.<init>(Unknown Source)
	at org.jabref/org.jabref.gui.importer.actions.OpenDatabaseAction.addNewDatabase(Unknown Source)
	at org.jabref/org.jabref.gui.importer.actions.OpenDatabaseAction.lambda$openTheFile$1(Unknown Source)
	at org.jabref/org.jabref.gui.util.DefaultTaskExecutor.lambda$getJavaFXTask$3(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
	at org.jabref.merged.module/javafx.event.Event.fireEvent(Unknown Source)
	at org.jabref.merged.module/javafx.concurrent.EventHelper.fireEvent(Unknown Source)
	at org.jabref.merged.module/javafx.concurrent.Task.fireEvent(Unknown Source)
	at org.jabref.merged.module/javafx.concurrent.Task.setState(Unknown Source)
	at org.jabref.merged.module/javafx.concurrent.Task$TaskCallable.lambda$call$1(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source)
	at java.base/java.security.AccessController.doPrivileged(Unknown Source)
	at org.jabref.merged.module/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source)
	at org.jabref.merged.module/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source)
	at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
	at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source)
	at java.base/java.lang.Thread.run(Unknown Source)

My version information is:

JabRef 5.0--2020-03-06--2e6f433
Linux 5.6.15-300.fc32.x86_64 amd64 
Java 13.0.2

Mebus

@Mebus
Copy link

Mebus commented Jun 11, 2020

Is there a workaround for this?

Mebus

Bugs automation moved this from Normal priority to Closed Jul 1, 2020
@rezaeimohammad
Copy link

I have same problem with Jabref.
It is possible to write clear solution about it?

@Mebus
Copy link

Mebus commented Jul 19, 2020

Maybe rebooting your systems helps :-P

Mebus

@rezaeimohammad
Copy link

Maybe rebooting your systems helps :-P

Mebus
Thanks
Yes, But the rebooting system is the final solution. I have several open application and I can not reboot my system for each time.

@Mebus
Copy link

Mebus commented Aug 22, 2020

I just hit the problem again:

Screenshot_20200822_104808

java.lang.NullPointerException: You need to start the file monitor before watching files at java.base/java.util.Objects.requireNonNull(Unknown Source) at org.jabref/org.jabref.gui.util.DefaultFileUpdateMonitor.addListenerForFile(Unknown Source) at org.jabref/org.jabref.gui.collab.DatabaseChangeMonitor.lambda$new$0(Unknown Source) at java.base/java.util.Optional.ifPresent(Unknown Source) at org.jabref/org.jabref.gui.collab.DatabaseChangeMonitor.(Unknown Source) at org.jabref/org.jabref.gui.BasePanel.resetChangeMonitorAndChangePane(Unknown Source) at org.jabref/org.jabref.gui.BasePanel.setupMainPanel(Unknown Source) at org.jabref/org.jabref.gui.BasePanel.(Unknown Source) at org.jabref/org.jabref.gui.importer.actions.OpenDatabaseAction.addNewDatabase(Unknown Source) at org.jabref/org.jabref.gui.importer.actions.OpenDatabaseAction.lambda$openTheFile$1(Unknown Source) at org.jabref/org.jabref.gui.util.DefaultTaskExecutor.lambda$getJavaFXTask$3(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source) at org.jabref.merged.module/javafx.event.Event.fireEvent(Unknown Source) at org.jabref.merged.module/javafx.concurrent.EventHelper.fireEvent(Unknown Source) at org.jabref.merged.module/javafx.concurrent.Task.fireEvent(Unknown Source) at org.jabref.merged.module/javafx.concurrent.Task.setState(Unknown Source) at org.jabref.merged.module/javafx.concurrent.Task$TaskCallable.lambda$call$1(Unknown Source) at org.jabref.merged.module/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at org.jabref.merged.module/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(Unknown Source) at org.jabref.merged.module/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(Unknown Source) at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at org.jabref.merged.module/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source)

koppor pushed a commit that referenced this issue Sep 1, 2022
8d69f16 Create university-of-hull-harvard.csl (#6146)
139dfdd Create current organic synthesis.csl (#6139)
bb006c8 Update acta-universitatis-agriculturae-sueciae.csl (#6143)
5815da0 Create food-science-and-biotechnology.csl (#6132)
2702a7c Update harvard-university-for-the-creative-arts.csl (#6104)
ef34543 Update economic-geology.csl (#6128)
0adcd30 Bump mathieudutour/github-tag-action from 5.6 to 6.0 (#6141)
3c36e97 Create universite-du-quebec-a-montreal-prenoms.csl (#6073)
415bc05 Bump softprops/action-gh-release from 0.1.14 to 1 (#6142)
ae8c5e4 Create politique-europeenne.csl (#6074)
09cbc09 Update cell-numeric-superscript.csl (#6188)
6ee1ace Update avian-conservation-and-ecology.csl (#6191)
cb5c43f Update harvard-anglia-ruskin-university.csl (#6189)
5c4f4c0 Create anais-da-academia-brasileira-de-ciencias.csl (#6066)
a60dfe9 Update cardiff-university-harvard.csl (#6190)
999a45c Create sociologia-urbana-e-rurale.csl (#6042)
1bc9d62 Bluebook (#6183)
a4f2a72 Oxford Brookes (#6182)
88df8d5 Delete harvard-cardiff-university-old.csl (#6180)
b9302fd Update APA styles for "event" macro (#6174)
d4daec6 remove DOI for printed articles organizational-studies.csl (#6176)
acfc620 Create liver-transplantation.csl (#6167)
129a775 Change "event" to "event-title" (#6164)

git-subtree-dir: buildres/csl/csl-styles
git-subtree-split: 8d69f16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue An issue intended for project-newcomers. Varies in difficulty. ui
Projects
Archived in project
Bugs
  
Done
Development

Successfully merging a pull request may close this issue.

5 participants