Skip to content

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

Closed
@janbac

Description

@janbac

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    component: uigood first issueAn issue intended for project-newcomers. Varies in difficulty.

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions