jabref
jabref copied to clipboard
Saving file throws exception
I saved my file, and got this exception. I cannot repeat this.
JabRef 5.0--2020-03-09--6bff936 Linux 5.5.8-200.fc31.x86_64 amd64 Java 13.0.2
Inspired by the discussion at https://github.com/JabRef/jabref/issues/4877 I like to contribute the fact that my file system is a LVM partition with a cache.
Caused by: java.nio.file.NoSuchFileException: /home/ilippert/Documents/Studies/Publications&Products/Resources/Literature-bibtex.bib.tmp -> /home/ilippert/Documents/Studies/Publications&Products/Resources/Literature-bibtex.bib at
Log File
org.jabref.logic.exporter.SaveException: Problems saving: at org.jabref/org.jabref.gui.exporter.SaveDatabaseAction.saveDatabase(Unknown Source) at org.jabref/org.jabref.gui.exporter.SaveDatabaseAction.doSave(Unknown Source) at org.jabref/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source) at org.jabref/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source) at org.jabref/org.jabref.gui.exporter.SaveAction.execute(Unknown Source) at org.jabref/org.jabref.gui.actions.JabRefAction.lambda$new$2(Unknown Source) at org.jabref.merged.module/org.controlsfx.control.action.Action.handle(Unknown Source) at org.jabref.merged.module/org.controlsfx.control.action.Action.handle(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.scene.control.MenuItem.fire(Unknown Source) at org.jabref.merged.module/com.sun.javafx.scene.control.ControlAcceleratorSupport.lambda$doAcceleratorInstall$1(Unknown Source) at org.jabref.merged.module/com.sun.javafx.scene.KeyboardShortcutsHandler.processAccelerators(Unknown Source) at org.jabref.merged.module/com.sun.javafx.scene.KeyboardShortcutsHandler.dispatchBubblingEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.event.CompositeEventDispatcher.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.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.scene.Scene$KeyHandler.process(Unknown Source) at org.jabref.merged.module/javafx.scene.Scene.processKeyEvent(Unknown Source) at org.jabref.merged.module/javafx.scene.Scene$ScenePeerListener.keyEvent(Unknown Source) at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(Unknown Source) at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$1(Unknown Source) at org.jabref.merged.module/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source) at org.jabref.merged.module/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(Unknown Source) at org.jabref.merged.module/com.sun.glass.ui.View.handleKeyEvent(Unknown Source) at org.jabref.merged.module/com.sun.glass.ui.View.notifyKey(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) Caused by: java.nio.file.NoSuchFileException: /home/ilippert/Documents/Studies/Publications&Products/Resources/Literature-bibtex.bib.tmp -> /home/ilippert/Documents/Studies/Publications&Products/Resources/Literature-bibtex.bib at java.base/sun.nio.fs.UnixException.translateToIOException(Unknown Source) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) at java.base/sun.nio.fs.UnixCopyFile.move(Unknown Source) at java.base/sun.nio.fs.UnixFileSystemProvider.move(Unknown Source) at java.base/java.nio.file.Files.move(Unknown Source) at org.jabref/org.jabref.logic.exporter.AtomicFileOutputStream.close(Unknown Source) at java.base/sun.nio.cs.StreamEncoder.implClose(Unknown Source) at java.base/sun.nio.cs.StreamEncoder.close(Unknown Source) at java.base/java.io.OutputStreamWriter.close(Unknown Source) at org.jabref/org.jabref.logic.exporter.BibDatabaseWriter.savePartOfDatabase(Unknown Source) at org.jabref/org.jabref.logic.exporter.BibDatabaseWriter.saveDatabase(Unknown Source) ... 42 more
Could the file be saved at the end or is it corrupted?
It was saved.
On 12 March 2020 07:54:18 CET, Oliver Kopp [email protected] wrote:
Could the file be saved at the end or is it corrupted?
-- You are receiving this because you authored the thread. Reply to this email directly or view it on GitHub: https://github.com/JabRef/jabref/issues/6102#issuecomment-598034657
-- Sent from my LineageOS device with K-9 Mail. Please excuse my brevity.
I have not experienced the issue for a long time anymore
JabRef 5.1--2020-04-14--e86d415 Linux 5.5.15-200.fc31.x86_64 amd64 Java 14.0.1
these days I have been seeing the phenomenon again - the same as in https://github.com/JabRef/jabref/issues/4877#issuecomment-657228272 I guess?
The problem lies here: https://github.com/JabRef/jabref/blob/4e220f618a755cb7dc18882653ea46e3ed049c9e/src/main/java/org/jabref/logic/exporter/AtomicFileOutputStream.java#L196
And I finally found the root cause. It's a threading problem when you have austosave enabled and at the same time manually hit save. The Autosave Backup manager also calls the writer.close method, through a different path. The problem is that the backup manager invokes this method in https://github.com/JabRef/jabref/blob/7cc57474b7aa991ef6ea148d4030d4bb68ee69bf/src/main/java/org/jabref/logic/exporter/BibDatabaseWriter.java#L221
We somehow need a way to lock that or cancel the save operation when already one is active. The other problem is that always a new object instance of the Writer or Save Action is created. I tried some locking in the cleanup @koppor @tobiasdiez any ideas? File based locking will not work on unix.
What about writing to a unique temporary file (in the users temporary file folder, with some random name)? Then you don't need to worry about locking etc (since the move command is atomic).
Moreover, I think, it's time to finally remove the BackupManager stuff...simply make a copy of the bib file upon loading a library (and say keep the last 10 versions). We run into so many problems with the backup stuff and it's a pretty old concept anyway.
I see mozilla and others simply writing to /tmp/ - i do not know whether that is possible for all unixes. but it would make sense to me.
in case the BackupManager is to keep x versions, I would say: let the user define x. I suggest so because many users will have already other backup/versioning software and might constrain x to 1; and other might like a higher number of backup versions.
@tobiasdiez The backup manager is not that problem it's the autosave manager. change anything in a field. Autosave is triggered. Now hit a manual save repeatedly The autosave manager also calls the writer.close in the savePartOfDatabase which then triggers the file moving. However, as it's a move, the original file is already moved.
I also discovered an issue with the FileOutputStream locking. Trying to check that
Yeah I understand, that's why I suggested that every write process should have their own temporary file.
JabRef 5.3--2021-07-16--c99d61c Linux 5.13.7-200.fc34.x86_64 amd64 Java 16.0.1 JavaFX 16+8
Let me add this exception I got a moment ago - might be related
Log File
org.jabref.logic.exporter.SaveException: Problems saving: java.nio.file.NoSuchFileException: /home/il/Documents/Studies/Publications&Products/Resources/Literature-bibtex.bib.tmp -> /home/il/Documents/Studies/Publications&Products/Resources/Literature-bibtex.bib at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.saveDatabase(Unknown Source) at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source) at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source) at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source) at [email protected]/org.jabref.gui.exporter.SaveAction.execute(Unknown Source) at [email protected]/org.jabref.gui.actions.JabRefAction.lambda$new$3(Unknown Source) at [email protected]/org.controlsfx.control.action.Action.handle(Unknown Source) at [email protected]/org.controlsfx.control.action.Action.handle(Unknown Source) at [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source) at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source) at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source) at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source) at [email protected]/javafx.event.Event.fireEvent(Unknown Source) at [email protected]/javafx.scene.control.MenuItem.fire(Unknown Source) at [email protected]/com.sun.javafx.scene.control.ControlAcceleratorSupport.lambda$doAcceleratorInstall$1(Unknown Source) at [email protected]/com.sun.javafx.scene.KeyboardShortcutsHandler.processAccelerators(Unknown Source) at [email protected]/com.sun.javafx.scene.KeyboardShortcutsHandler.dispatchBubblingEvent(Unknown Source) at [email protected]/com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(Unknown Source) at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source) at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source) at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source) at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source) at [email protected]/javafx.event.Event.fireEvent(Unknown Source) at [email protected]/javafx.scene.Scene$KeyHandler.process(Unknown Source) at [email protected]/javafx.scene.Scene.processKeyEvent(Unknown Source) at [email protected]/javafx.scene.Scene$ScenePeerListener.keyEvent(Unknown Source) at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(Unknown Source) at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler$KeyEventNotification.run(Unknown Source) at java.base/java.security.AccessController.doPrivileged(Unknown Source) at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleKeyEvent$1(Unknown Source) at [email protected]/com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(Unknown Source) at [email protected]/com.sun.javafx.tk.quantum.GlassViewEventHandler.handleKeyEvent(Unknown Source) at [email protected]/com.sun.glass.ui.View.handleKeyEvent(Unknown Source) at [email protected]/com.sun.glass.ui.View.notifyKey(Unknown Source) at [email protected]/com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method) at [email protected]/com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$11(Unknown Source) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.nio.file.NoSuchFileException: /home/il/Documents/Studies/Publications&Products/Resources/Literature-bibtex.bib.tmp -> /home/il/Documents/Studies/Publications&Products/Resources/Literature-bibtex.bib at java.base/sun.nio.fs.UnixException.translateToIOException(Unknown Source) at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source) at java.base/sun.nio.fs.UnixCopyFile.move(Unknown Source) at java.base/sun.nio.fs.UnixFileSystemProvider.move(Unknown Source) at java.base/java.nio.file.Files.move(Unknown Source) at [email protected]/org.jabref.logic.exporter.AtomicFileOutputStream.close(Unknown Source) at java.base/sun.nio.cs.StreamEncoder.implClose(Unknown Source) at java.base/sun.nio.cs.StreamEncoder.close(Unknown Source) at java.base/java.io.OutputStreamWriter.close(Unknown Source) at [email protected]/org.jabref.logic.exporter.BibDatabaseWriter.savePartOfDatabase(Unknown Source) at [email protected]/org.jabref.logic.exporter.BibDatabaseWriter.saveDatabase(Unknown Source) ... 42 more
Hi, I thought I would let you know that I was having a similar error but I managed to fix it.
I was creating a new library. The problem in my case was that I had an emoji (🌱) in path of "main file directory". There is an & still in the directory name with no issue.
(You will think that using emojis in file names is a stupid thing to do but I am a very visual person and having cues makes using the computer much, much easier especially when in the command line. It causes surprisingly few problems but occasionally there is something. Especially with non-native applications.)
Although it doesn't look like the others above do such ridiculous things as I do, maybe it'll be some kind of useful hint.
Thanks for the software. :)
org.jabref.logic.exporter.SaveException: Problems saving: java.nio.file.NoSuchFileException: /Volumes/HDD02/Files/ð± Writing & Research/_JabRef/_BibFiles/Untitled..bib.tmp
at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.saveDatabase(Unknown Source)
at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source)
at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.saveAs(Unknown Source)
at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source)
at [email protected]/org.jabref.gui.exporter.SaveDatabaseAction.save(Unknown Source)
at [email protected]/org.jabref.gui.exporter.SaveAction.execute(Unknown Source)
at [email protected]/org.jabref.gui.actions.JabRefAction.lambda$new$3(Unknown Source)
at [email protected]/org.controlsfx.control.action.Action.handle(Unknown Source)
at [email protected]/org.controlsfx.control.action.Action.handle(Unknown Source)
at [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at [email protected]/javafx.event.Event.fireEvent(Unknown Source)
at [email protected]/javafx.scene.control.MenuItem.fire(Unknown Source)
at [email protected]/com.sun.javafx.scene.control.GlobalMenuAdapter.lambda$bindMenuItemProperties$2(Unknown Source)
at [email protected]/com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(Unknown Source)
at [email protected]/com.sun.javafx.event.EventUtil.fireEventImpl(Unknown Source)
at [email protected]/com.sun.javafx.event.EventUtil.fireEvent(Unknown Source)
at [email protected]/javafx.event.Event.fireEvent(Unknown Source)
at [email protected]/javafx.scene.control.MenuItem.fire(Unknown Source)
at [email protected]/com.sun.javafx.tk.quantum.GlassSystemMenu$1.action(Unknown Source)
Caused by: java.nio.file.NoSuchFileException: /Volumes/HDD02/Files/ð± Writing & Research/_JabRef/_BibFiles/Untitled..bib.tmp
at java.base/sun.nio.fs.UnixException.translateToIOException(Unknown Source)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
at java.base/sun.nio.fs.UnixException.rethrowAsIOException(Unknown Source)
at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(Unknown Source)
at java.base/java.nio.file.spi.FileSystemProvider.newOutputStream(Unknown Source)
at java.base/java.nio.file.Files.newOutputStream(Unknown Source)
at [email protected]/org.jabref.logic.exporter.AtomicFileOutputStream.<init>(Unknown Source)
at [email protected]/org.jabref.logic.exporter.AtomicFileWriter.<init>(Unknown Source)
... 29 more
JabRef 5.3--2021-07-05--50c96a2 Mac OS X 10.14.6 x86_64 Java 16.0.1 JavaFX 16+8
Edit: I was closing the tabs from solving this problem and noticed noticed one I had opened from a search but didn't get to reading: Problem Saving Library - Help - Forum - JabRef
the real cause is a bit hidden in the log:
You have a missing opening curly brace somewhere in this entry:
Error in field ‘TITLE of entry Urpietal2016’: Unescaped ‘}’ character without opening bracket ends string prematurely. Field value: Dynamic simulation of CO{_2}-injection-induced fault rupture with slip-rate dependent friction coefficient
which sounds similar.