JabRef / jabref

Graphical Java application for managing BibTeX and biblatex (.bib) databases
https://devdocs.jabref.org
MIT License
3.63k stars 2.59k forks source link

Crash erased bibliography file #11454

Open IssaHanou opened 4 months ago

IssaHanou commented 4 months ago

JabRef version

5.13 (latest release)

Operating system

Windows

Details on version and operating system

JabRef 100.0.0 Mac OS X 14.2.1 aarch64 Java 20.0.1 JavaFX 20+19

Checked with the latest development build (copy version output from About dialog)

Steps to reproduce the behaviour

Unfortunately, I don't really know what happened. I was writing a comment for an entry in my bibliography, when JabRef crashed and when I tried to reopen it said "restore recent libary" but the file (library.bib) is now empty (0kb) and the information seems lost. I have a backup from a week ago somewhere else so I'll probably recover, but I don't know what happened or how to reproduce it.

Appendix

...

Log File ``` No open database detected Not updating theme because it hasn't changed Theme set to Theme{type=DEFAULT, name=''} with base css StyleSheet{jrt:/org.jabref/org/jabref/gui/Base.css} Opening: '/Users/issahanou/surfdrive - Issa Hanou@surfdrive.surf.nl/Bibliography/library.bib' ```
MacBook crash report ``` ------------------------------------- Translated Report (Full Report Below) ------------------------------------- Process: JabRef [2946] Path: /Applications/JabRef.app/Contents/MacOS/JabRef Identifier: Jabref Version: 1.0.0 (1.0.0) Code Type: ARM-64 (Native) Parent Process: launchd [1] User ID: 501 Date/Time: 2024-07-05 09:09:09.2565 +0200 OS Version: macOS 14.2.1 (23C71) Report Version: 12 Anonymous UUID: 7C619CBB-F3DE-2102-D654-29B70CD13BE6 Sleep/Wake UUID: EDF11FD0-4049-47BA-A04B-D5E2B0FAF212 Time Awake Since Boot: 400000 seconds Time Since Wake: 988 seconds System Integrity Protection: enabled Crashed Thread: 47 Java: pool-5-thread-2 Exception Type: EXC_BAD_ACCESS (SIGABRT) Exception Codes: KERN_INVALID_ADDRESS at 0x00000000000000fc Exception Codes: 0x0000000000000001, 0x00000000000000fc Termination Reason: Namespace SIGNAL, Code 6 Abort trap: 6 Terminating Process: JabRef [2946] VM Region Info: 0xfc is not in any region. Bytes before following region: 4369743620 REGION TYPE START - END [ VSIZE] PRT/MAX SHRMOD REGION DETAIL UNUSED SPACE AT START ---> __TEXT 104750000-104768000 [ 96K] r-x/r-x SM=COW .../MacOS/JabRef Application Specific Information: abort() called Thread 0:: Dispatch queue: com.apple.main-thread 0 libsystem_kernel.dylib 0x187f90e68 __semwait_signal + 8 1 libsystem_c.dylib 0x187e702f8 nanosleep + 220 2 libsystem_c.dylib 0x187e790bc sleep + 52 3 libjvm.dylib 0x1064aae18 os::infinite_sleep() + 16 4 libjvm.dylib 0x1066d05ac VMError::report_and_die(int, char const*, char const*, char*, Thread*, unsigned char*, void*, void*, char const*, int, unsigned long) + 972 5 libjvm.dylib 0x1066d01d4 VMError::report_and_die(Thread*, unsigned int, unsigned char*, void*, void*, char const*, ...) + 72 6 libjvm.dylib 0x1066d0ee8 VMError::report_and_die(Thread*, unsigned int, unsigned char*, void*, void*) + 36 7 libsystem_platform.dylib 0x187ffda24 _sigtramp + 56 8 ??? 0x1607217c8 ??? Thread 1: 0 libsystem_kernel.dylib 0x187f8f62c __ulock_wait + 8 1 libsystem_pthread.dylib 0x187fd049c _pthread_join + 608 2 libjli.dylib 0x1047ad8b0 CallJavaMainInNewThread + 184 3 libjli.dylib 0x1047ac760 ContinueInNewThread + 144 4 libjli.dylib 0x1047aa6c4 JLI_Launch + 5540 5 JabRef 0x10475e96c jvmLauncherStartJvm + 328 6 JabRef 0x10475d0bc Jvm::launch() + 744 7 JabRef 0x1047636a0 app::launch(std::nothrow_t const&, void (*)(), LogAppender*) + 212 8 libjli.dylib 0x1047ae170 apple_main + 88 9 libsystem_pthread.dylib 0x187fce034 _pthread_start + 136 10 libsystem_pthread.dylib 0x187fc8e3c thread_start + 8 [trancated due to body lenght limit] External Modification Summary: Calls made by other processes targeting this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by this process: task_for_pid: 0 thread_create: 0 thread_set_state: 0 Calls made by all processes on this machine: task_for_pid: 0 thread_create: 0 thread_set_state: 0 ----------- Full Report ----------- {"app_name":"JabRef","timestamp":"2024-07-05 09:09:12.00 +0200","app_version":"1.0.0","slice_uuid":"93e1ef3c-60b4-3faf-a247-3e5ef1e99c5f","build_version":"1.0.0","platform":1,"bundleID":"Jabref","share_with_app_devs":0,"is_first_party":0,"bug_type":"309","os_version":"macOS 14.2.1 (23C71)","roots_installed":0,"name":"JabRef","incident_id":"B89D59C4-A471-4FB3-89CA-34868892ACD6"} { "uptime" : 400000, "procRole" : "Foreground", "version" : 2, "userID" : 501, "deployVersion" : 210, "modelCode" : "MacBookPro18,3", "coalitionID" : 49401, "osVersion" : { "train" : "macOS 14.2.1", "build" : "23C71", "releaseType" : "User" }, "captureTime" : "2024-07-05 09:09:09.2565 +0200", "codeSigningMonitor" : 1, "incident" : "B89D59C4-A471-4FB3-89CA-34868892ACD6", "pid" : 2946, "translated" : false, "cpuType" : "ARM-64", "roots_installed" : 0, "bug_type" : "309", "procLaunch" : "2024-06-25 12:16:17.6328 +0200", "procStartAbsTime" : 4824199286452, "procExitAbsTime" : 9801646566448, "procName" : "JabRef", "procPath" : "\/Applications\/JabRef.app\/Contents\/MacOS\/JabRef", "bundleInfo" : {"CFBundleShortVersionString":"1.0.0","CFBundleVersion":"1.0.0","CFBundleIdentifier":"Jabref"}, "storeInfo" : {"deviceIdentifierForVendor":"6C9A8D31-9B54-5FC7-9835-92F0A36857AD","thirdParty":true}, "parentProc" : "launchd", "parentPid" : 1, "coalitionName" : "Jabref", "crashReporterKey" : "7C619CBB-F3DE-2102-D654-29B70CD13BE6", "lowPowerMode" : 1, "codeSigningID" : "org.jabrefJabref", "codeSigningTeamID" : "6792V39SK3", "codeSigningFlags" : 570491393, "codeSigningValidationCategory" : 6, "codeSigningTrustLevel" : 4294967295, "instructionByteStream" : {"beforePC":"fyMD1f17v6n9AwCRXOD\/l78DAJH9e8Go\/w9f1sADX9YQKYDSARAA1A==","atPC":"AwEAVH8jA9X9e7+p\/QMAkVHg\/5e\/AwCR\/XvBqP8PX9bAA1\/WcAqA0g=="}, "wakeTime" : 988, "sleepWakeUUID" : "EDF11FD0-4049-47BA-A04B-D5E2B0FAF212", "sip" : "enabled", "vmRegionInfo" : "0xfc is not in any region. Bytes before following region: 4369743620\n REGION TYPE START - END [ VSIZE] PRT\/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---> \n __TEXT 104750000-104768000 [ 96K] r-x\/r-x SM=COW ...\/MacOS\/JabRef", "exception" : {"codes":"0x0000000000000001, 0x00000000000000fc","rawCodes":[1,252],"type":"EXC_BAD_ACCESS","signal":"SIGABRT","subtype":"KERN_INVALID_ADDRESS at 0x00000000000000fc"}, "termination" : {"flags":0,"code":6,"namespace":"SIGNAL","indicator":"Abort trap: 6","byProc":"JabRef","byPid":2946}, "vmregioninfo" : "0xfc is not in any region. Bytes before following region: 4369743620\n REGION TYPE START - END [ VSIZE] PRT\/MAX SHRMOD REGION DETAIL\n UNUSED SPACE AT START\n---> \n __TEXT 104750000-104768000 [ 96K] r-x\/r-x SM=COW ...\/MacOS\/JabRef", "asi" : {"libsystem_c.dylib":["abort() called"]}, "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0}, "faultingThread" : 47, "threads": [truncated due to body lenght limit], "usedImages" : [ { "source" : "P", "arch" : "arm64e", "base" : 6172491776, "CFBundleShortVersionString" : "1.0", "CFBundleIdentifier" : "com.apple.icloud.drive.fileprovider.override", "size" : 16384, "uuid" : "75745331-d4d7-374a-b7d0-6421dff7b065", "path" : "\/System\/Library\/Frameworks\/FileProvider.framework\/OverrideBundles\/iCloudDriveFileProviderOverride.bundle\/Contents\/MacOS\/iCloudDriveFileProviderOverride", "name" : "iCloudDriveFileProviderOverride", "CFBundleVersion" : "2461.61.2" }, { "source" : "P", "arch" : "arm64e", "base" : 10828873728, "CFBundleShortVersionString" : "14.2", "CFBundleIdentifier" : "com.apple.findersync.fileprovideroverride.FinderSyncCollaborationFileProviderOverride", "size" : 131072, "uuid" : "c03af63c-8bae-3a07-a2c9-f0758a0853ac", "path" : "\/System\/Library\/Frameworks\/FileProvider.framework\/OverrideBundles\/FinderSyncCollaborationFileProviderOverride.bundle\/Contents\/MacOS\/FinderSyncCollaborationFileProviderOverride", "name" : "FinderSyncCollaborationFileProviderOverride", "CFBundleVersion" : "1630.2.4" }, } ```
Doublonmousse commented 4 months ago

Seems very similar to #10853 . Pretty sure the mechanism is the same (jabref fails to open the backup but doesn't tell you and goes ahead overwriting the database anyway, with nothing).

Though what causes the crash is still a mystery to me (kinda occurs at random, and I haven't found one way to reproduce the bug 100% reliably)

Siedlerchr commented 4 months ago

Did you install the arm version? Jabref also regularly creates backup https://docs.jabref.org/advanced/autosave For mac check /Users/username/Library/Application Support/org.jabref/jabref

See the section on where to find the backup. Is your library bib file stored in iCloud?

Siedlerchr commented 4 months ago

The mac crash report could be a parsing error from the 0kb file that Java cannot read the file

NeymanDmitry commented 4 months ago

I had a similar situation on version 5.12 some time ago. At that moment the program simply froze and quit. After restarting the program, it offered to restore the latest data and after loading the library was empty. I had made a backup a few weeks before, so I wasn't too upset.

This was on Linux Ubuntu 22.04.

koppor commented 4 months ago

JabRef saves the library now and then. See https://docs.jabref.org/advanced/autosave for details.

I would be curious if these files contain data or if all of them are 0 bytes

Doublonmousse commented 4 months ago

The issue is that the backup is here and complete but the file opening fails anyway so jabref just rewrite with nothing

koppor commented 4 months ago

The issue is that the backup is here and complete but the file opening fails anyway so jabref just rewrite with nothing

I think, I understand correctly that the backup file cannot be loaded.

Can you share that backup file @Doublonmousse? You find my email address on my GitHub profile.

Doublonmousse commented 3 months ago

Hello, Sorry, it's been a while. I've not used jabref a lot these recent weeks.

I did not indicate in the bug report what the backup file's name was when the crash occured so finding it back (when there isn't an obvious 0kb file somewhere) is a little bit meh.. Not sure I have it.

The thing is, back on 5.12, a force quit would not trigger the issue but having a segfault (with the mac os report about an error popping up) would. So I was trying to see if triggering a segfault on purpose would recreate the same situation or not. For now I'm unsuccessful.

Although one thing about 5.15 is that unsaved documents aren't backed up (there isn't anymore a temp save in that situation). That seems like a regression from 5.12 (and I wanted to try that as that was one of the setup for which I had some odds of the situation occuring).

Maybe I'll re test this on older versions (5.12 or 5.13)

koppor commented 3 months ago

Although one thing about 5.15 is that unsaved documents aren't backed up (there isn't anymore a temp save in that situation).

What do you mean? Like "unnamed library" if you create a new one? Or while you are working on it?

The directories where these backup files reside were described by Thilo at https://discourse.jabref.org/t/references-suddenly-wiped-urgent/4407/2?u=koppor. I need to check if we are saving during editing, but I would say: yes - because I constantly get "backup existing" messages when I "play around" with JabRef.

koppor commented 2 months ago

Idea to improve user experience

Backup Backup T-2 Backup T-1 Backup T
Date .. .. ..
Number of entries 100 103 (+3) 0 (-100)
File size 100kb 99kb 0 kb

Alternative: Switch to git for backup (refs https://github.com/koppor/jabref/issues/578) - or switch to RCS for backup.


Update:

We should support "squashing" history - so that for one year ago, thre is only one version, not several.

According to so, git-bundle is a nice option to have one file storing the history. - see https://embeddedartistry.com/fieldatlas/git-bundle-workflow/ for some inspiration. If jgit supports git-bundle as remote, we could store the bundle in the directory of the bib file - and clone into TEMP on each open of the library. Save on TEMP dir, commit and push.

IssaHanou commented 1 month ago

It happened again to me, no idea why it crashed (I was writing a comment on an entry) but the library file was still there and only emptied when I tried to restore. I can send the backup file over email.

I have indeed started GitHub backups after last time, and copied the library file before trying to restore so less harm was done.

koppor commented 1 month ago

A screenshot of C:\Users\{username}\AppData\Local\org.jabref\jabref\backups with the files containing the filename would also be interesting.

Example (showing test.bib)

image

I assume the log does not say anything? I mean, I assume, the backup file sized changed from large file to 0 kb. During that time, there should be logs from jabref.

C:\Users\{username}\AppData\Local\org.jabref\jabref\logs\100.0.0

image

IssaHanou commented 1 month ago

My backup folder for library.bib looks as follows:

Screenshot 2024-09-19 at 12 05 54

The log file is this:

2024-09-19 09:24:59 [JavaFX Application Thread] org.jabref.gui.StateManager.setActiveDatabase()
INFO: No open database detected
2024-09-19 09:24:59 [JavaFX Application Thread] org.jabref.gui.theme.ThemeManager.updateThemeSettings()
INFO: Not updating theme because it hasn't changed
2024-09-19 09:24:59 [JavaFX Application Thread] org.jabref.gui.theme.ThemeManager.updateThemeSettings()
INFO: Theme set to Theme{type=DEFAULT, name=''} with base css StyleSheet{jrt:/org.jabref/org/jabref/gui/Base.css}
2024-09-19 09:25:01 [pool-1-thread-1] org.jabref.gui.JabRefDialogService.notify()
INFO: Opening: '/Users/issahanou/surfdrive - Issa Hanou@surfdrive.surf.nl/Bibliography/library.bib'
2024-09-19 09:25:25 [pool-1-thread-1] org.jabref.gui.util.DefaultTaskExecutor.runInJavaFXThread()
ERROR: Problem running in fx thread: java.util.concurrent.ExecutionException: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
    at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122)
    at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191)
    at org.jabref@100.0.0/org.jabref.gui.util.DefaultTaskExecutor.runInJavaFXThread(DefaultTaskExecutor.java:62)
    at org.jabref@100.0.0/org.jabref.gui.dialogs.BackupUIManager.showReviewBackupDialog(BackupUIManager.java:78)
    at org.jabref@100.0.0/org.jabref.gui.dialogs.BackupUIManager.lambda$showRestoreBackupDialog$0(BackupUIManager.java:50)
    at java.base/java.util.Optional.flatMap(Optional.java:289)
    at org.jabref@100.0.0/org.jabref.gui.dialogs.BackupUIManager.showRestoreBackupDialog(BackupUIManager.java:45)
    at org.jabref@100.0.0/org.jabref.gui.importer.actions.OpenDatabaseAction.loadDatabase(OpenDatabaseAction.java:201)
    at org.jabref@100.0.0/org.jabref.gui.importer.actions.OpenDatabaseAction.lambda$openTheFile$1(OpenDatabaseAction.java:179)
    at org.jabref@100.0.0/org.jabref.gui.util.BackgroundTask$1.call(BackgroundTask.java:60)
    at org.jabref@100.0.0/org.jabref.gui.util.DefaultTaskExecutor$1.call(DefaultTaskExecutor.java:161)
    at org.jabref.merged.module@100.0.0/javafx.concurrent.Task$TaskCallable.call(Task.java:1426)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:577)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
    at java.base/java.lang.Thread.run(Thread.java:1623)
Caused by: java.lang.IndexOutOfBoundsException: Index 0 out of bounds for length 0
    at java.base/java.util.Objects.checkIndex(Objects.java:385)
    at java.base/java.util.ArrayList.get(ArrayList.java:427)
    at org.jabref@100.0.0/org.jabref.logic.bibtex.comparator.BibDatabaseDiff.compareEntries(BibDatabaseDiff.java:92)
    at org.jabref@100.0.0/org.jabref.logic.bibtex.comparator.BibDatabaseDiff.<init>(BibDatabaseDiff.java:39)
    at org.jabref@100.0.0/org.jabref.logic.bibtex.comparator.BibDatabaseDiff.compare(BibDatabaseDiff.java:118)
    at org.jabref@100.0.0/org.jabref.gui.collab.DatabaseChangeList.compareAndGetChanges(DatabaseChangeList.java:36)
    at org.jabref@100.0.0/org.jabref.gui.dialogs.BackupUIManager.lambda$showReviewBackupDialog$2(BackupUIManager.java:79)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:317)
    at org.jabref.merged.module@100.0.0/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:456)
    at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
    at org.jabref.merged.module@100.0.0/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:455)
    at org.jabref.merged.module@100.0.0/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
2024-09-19 09:31:17 [JavaFX Application Thread] org.jabref.gui.StateManager.setActiveDatabase()
INFO: No open database detected
2024-09-19 09:31:20 [pool-1-thread-4] org.jabref.gui.JabRefDialogService.notify()
INFO: Opening: '/Users/issahanou/surfdrive - Issa Hanou@surfdrive.surf.nl/Bibliography/library.bib'
2024-09-19 09:38:25 [JavaFX Application Thread] org.jabref.gui.StateManager.setActiveDatabase()
INFO: No open database detected
2024-09-19 09:38:30 [pool-1-thread-4] org.jabref.gui.JabRefDialogService.notify()
INFO: Opening: '/Users/issahanou/surfdrive - Issa Hanou@surfdrive.surf.nl/Bibliography/library copy.bib'
2024-09-19 09:38:36 [pool-1-thread-5] org.jabref.gui.JabRefDialogService.notify()
INFO: Opening: '/Users/issahanou/surfdrive - Issa Hanou@surfdrive.surf.nl/Bibliography/library.bib'
2024-09-19 09:38:51 [JavaFX Application Thread] org.jabref.gui.collab.DatabaseChangesResolverDialog.lambda$new$0()
INFO: External changes aren't resolved
2024-09-19 09:38:57 [pool-1-thread-3] org.jabref.gui.JabRefDialogService.notify()
INFO: Opening: '/Users/issahanou/surfdrive - Issa Hanou@surfdrive.surf.nl/Bibliography/library.bib'
2024-09-19 09:39:25 [JavaFX Application Thread] org.jabref.gui.JabRefDialogService.notify()
INFO: Saving library...
2024-09-19 09:39:26 [JavaFX Application Thread] org.jabref.gui.JabRefDialogService.notify()
INFO: Library saved
2024-09-19 09:41:44 [JavaFX Application Thread] org.jabref.gui.JabRefDialogService.notify()
INFO: Preferences recorded.
2024-09-19 09:56:04 [JavaFX Application Thread] org.jabref.gui.JabRefDialogService.notify()
INFO: Saving library...
2024-09-19 09:56:04 [JavaFX Application Thread] org.jabref.gui.JabRefDialogService.notify()
INFO: Library saved
2024-09-19 09:56:42 [JavaFX Application Thread] org.jabref.gui.JabRefDialogService.notify()
INFO: Saving library...
2024-09-19 09:56:42 [JavaFX Application Thread] org.jabref.gui.JabRefDialogService.notify()
INFO: Library saved
2024-09-19 09:58:08 [JavaFX Application Thread] org.jabref.gui.JabRefDialogService.notify()
INFO: Saving library...
2024-09-19 09:58:08 [JavaFX Application Thread] org.jabref.gui.JabRefDialogService.notify()
INFO: Library saved
ThiloteE commented 1 month ago

Relevant files can be sent to web@jabref.org.

Would be interesting to know exactly what text you entered and what you did before the crash happened. Since JabRef 5.8, backups are created automatically 20 seconds after changes to library files. Maybe the creation of a backup file coincided with you editing the library file, triggering the index out of bounds and crashing.

IssaHanou commented 1 month ago

I think I was writing a comment, switched to my chrome browser, then switched back to writing the comment, probably hitting the space bar and then it crashed.