Repository navigation
Fix crash when the native jabgui opens a library with a fulltext index - #18007
Conversation
ThiloteE
left a comment
There was a problem hiding this comment.
Fixes
com.oracle.svm.core.jdk.UnsupportedFeatureError: Support for Arena.ofShared is not active: enable with -H:+SharedArenaSupport
at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.VMError.unsupportedFeature(VMError.java:121)
at org.graalvm.nativeimage.foreign/com.oracle.svm.core.foreign.ForeignAPIPredicates$SharedArenasDisabled.fail(ForeignAPIPredicates.java:77)
at java.base@25.0.2/jdk.internal.misc.ScopedMemoryAccess.closeScope0Unsupported(ScopedMemoryAccess.java:214)
at java.base@25.0.2/jdk.internal.misc.ScopedMemoryAccess.closeScope(ScopedMemoryAccess.java:88)
at java.base@25.0.2/jdk.internal.foreign.SharedSession.justClose(SharedSession.java:92)
at java.base@25.0.2/jdk.internal.foreign.MemorySessionImpl.close(MemorySessionImpl.java:240)
at java.base@25.0.2/jdk.internal.foreign.ArenaImpl.close(ArenaImpl.java:47)
at org.apache.lucene.store.RefCountedSharedArena.release(RefCountedSharedArena.java:114)
at org.apache.lucene.store.RefCountedSharedArena.close(RefCountedSharedArena.java:123)
at org.apache.lucene.store.MemorySegmentIndexInput.close(MemorySegmentIndexInput.java:735)
at org.apache.lucene.util.IOUtils.close(IOUtils.java:85)
at org.apache.lucene.codecs.lucene90.Lucene90CompoundReader.close(Lucene90CompoundReader.java:169)
at org.apache.lucene.index.IndexWriter.readFieldInfos(IndexWriter.java:1265)
at org.apache.lucene.index.IndexWriter.getFieldNumberMap(IndexWriter.java:1281)
at org.apache.lucene.index.IndexWriter.<init>(IndexWriter.java:1129)
at org.jabref.logic.search.sqlbased.indexing.DefaultLinkedFilesIndexer.<init>(DefaultLinkedFilesIndexer.java:77)
at org.jabref.logic.search.LinkedFilesIndexManager.createIndexer(LinkedFilesIndexManager.java:73)
at org.jabref.logic.search.LinkedFilesIndexManager.<init>(LinkedFilesIndexManager.java:56)
at org.jabref.logic.search.inmemory.InMemoryLuceneSearchBackend.<init>(InMemoryLuceneSearchBackend.java:33)
at org.jabref.gui.LibraryTab.lambda$createSearchContext$1(LibraryTab.java:549)
at org.jabref.logic.search.SearchContext.buildBackend(SearchContext.java:54)
at org.jabref.logic.search.SearchContext.<init>(SearchContext.java:49)
at org.jabref.gui.LibraryTab.createSearchContext(LibraryTab.java:551)
at org.jabref.gui.LibraryTab.initializeComponentsAndListeners(LibraryTab.java:361)
at org.jabref.gui.LibraryTab.setDatabaseContext(LibraryTab.java:600)
at org.jabref.gui.LibraryTab.finishDatabaseLoading(LibraryTab.java:523)
at org.jabref.gui.util.UiTaskExecutor.lambda$getJavaFXTask$1(UiTaskExecutor.java:265)
at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:232)
at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:189)
at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
at javafx.event.Event.fireEvent(Event.java:199)
at javafx.concurrent.EventHelper.fireEvent(EventHelper.java:219)
at javafx.concurrent.Task.fireEvent(Task.java:1340)
at javafx.concurrent.Task.setState(Task.java:724)
at javafx.concurrent.Task$TaskCallable.lambda$call$1(Task.java:1418)
at com.sun.javafx.application.PlatformImpl.lambda$runLater$0(PlatformImpl.java:424)
at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
at com.sun.glass.ui.gtk.GtkApplication._runLoop(Native Method)
at com.sun.glass.ui.gtk.GtkApplication.lambda$runLoop$0(GtkApplication.java:242)
at java.base@25.0.2/java.lang.Thread.runWith(Thread.java:1487)
at java.base@25.0.2/java.lang.Thread.run(Thread.java:1474)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:832)
at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:808)
PR Summary by QodoEnable shared arenas in jabgui native image to fix fulltext index crash
AI Description
Merge Risk
|
Code Review by Qodo
1. Other native CLI binaries keep the same Lucene crash
|
|
Successfully tested build & run on windows 11 with GraalVM 25.0.5.1; native windows and under WSL2. |
|
Qodo raised some good issues. |
…00/jabref into fix/jabgui-native-shared-arena
|
@qodo Please check your finding again: "Other native CLI binaries keep the same Lucene crash". Is there a path from jabkit, jabsrv-cli or jabls-cli to FSDirectory.open? |
I can't confirm a path from Here is what would settle it:
My expectation is that If you want, I can look at the finding's full evidence and suggested fix, or you can point me to the relevant files and I'll work through the path with you. |
|
I checked the Qodo finding about the other CLIs. Only two classes open the Lucene index with FSDirectory.open: Only jabgui creates them, in LibraryTab.java#L547-L549. So the CLIs do not hit this crash |
* main: (22 commits) Keep citation controls reachable in narrow windows / split screens (#17919) Chore(deps): Bump com.dlsc.pdfviewfx:pdfviewfx from 3.6.1 to 3.6.2 in /versions (#18026) Chore(deps): Bump com.konghq:unirest-java-bom from 4.12.7 to 4.12.9 in /versions (#18027) Chore(deps): Bump jablib/src/main/resources/csl-styles from `2af1e53` to `9205842` (#18021) Chore(deps): Bump jablib/src/main/abbrv.jabref.org from `1710477` to `4932890` (#18023) Chore(deps): Bump ruby/setup-ruby from 1.345.0 to 1.346.0 (#18025) Chore(deps): Bump anthropics/claude-code-action from 1.0.290 to 1.0.291 (#18024) Chore(deps): Bump softprops/action-gh-release from 3.0.4 to 3.0.5 (#18022) chore(deps): update dependency com.nimbusds:oauth2-oidc-sdk to v11.39.1 (#18020) chore(deps): update dependency com.konghq:unirest-modules-gson to v4.12.9 (#18019) Fix crash when the native jabgui opens a library with a fulltext index (#18007) Use GroupsEditor for the groups field in the merge dialog (#17798) Chore(deps): Bump com.konghq:unirest-java-bom from 4.12.5 to 4.12.7 in /versions (#18018) Chore(deps): Bump us.hebi.graalvm:jfx-static-feature from 1.1.1 to 1.2 in /versions (#18017) chore(deps): update dependency jbangdev/jbang to v0.144.0 (#18013) chore(deps): update dependency com.konghq:unirest-modules-gson to v4.12.7 (#18011) Chore(deps): Bump org.mockito:mockito-core from 5.24.0 to 5.25.0 in /versions (#18001) chore(deps): update dependency textlint to v16.1.4 (#18000) Chore(deps): Bump com.konghq:unirest-java-bom from 4.12.0 to 4.12.5 in /versions (#18002) Fix RIS patent, date, and PDF round trips (#17992) ...
* refs/heads/main: (55 commits) Keep citation controls reachable in narrow windows / split screens (JabRef#17919) Chore(deps): Bump com.dlsc.pdfviewfx:pdfviewfx from 3.6.1 to 3.6.2 in /versions (JabRef#18026) Chore(deps): Bump com.konghq:unirest-java-bom from 4.12.7 to 4.12.9 in /versions (JabRef#18027) Chore(deps): Bump jablib/src/main/resources/csl-styles from `2af1e53` to `9205842` (JabRef#18021) Chore(deps): Bump jablib/src/main/abbrv.jabref.org from `1710477` to `4932890` (JabRef#18023) Chore(deps): Bump ruby/setup-ruby from 1.345.0 to 1.346.0 (JabRef#18025) Chore(deps): Bump anthropics/claude-code-action from 1.0.290 to 1.0.291 (JabRef#18024) Chore(deps): Bump softprops/action-gh-release from 3.0.4 to 3.0.5 (JabRef#18022) chore(deps): update dependency com.nimbusds:oauth2-oidc-sdk to v11.39.1 (JabRef#18020) chore(deps): update dependency com.konghq:unirest-modules-gson to v4.12.9 (JabRef#18019) Fix crash when the native jabgui opens a library with a fulltext index (JabRef#18007) Use GroupsEditor for the groups field in the merge dialog (JabRef#17798) Chore(deps): Bump com.konghq:unirest-java-bom from 4.12.5 to 4.12.7 in /versions (JabRef#18018) Chore(deps): Bump us.hebi.graalvm:jfx-static-feature from 1.1.1 to 1.2 in /versions (JabRef#18017) chore(deps): update dependency jbangdev/jbang to v0.144.0 (JabRef#18013) chore(deps): update dependency com.konghq:unirest-modules-gson to v4.12.7 (JabRef#18011) Chore(deps): Bump org.mockito:mockito-core from 5.24.0 to 5.25.0 in /versions (JabRef#18001) chore(deps): update dependency textlint to v16.1.4 (JabRef#18000) Chore(deps): Bump com.konghq:unirest-java-bom from 4.12.0 to 4.12.5 in /versions (JabRef#18002) Fix RIS patent, date, and PDF round trips (JabRef#17992) ...
…omment * upstream/main: Fix path traversal in file directory pattern expansion (CWE-22) (JabRef#17923) chore(deps): update dependency com.konghq:unirest-modules-gson to v4.12.10 (JabRef#18028) Correct module name: Should be oauth2.oidc.sdk rather than nimbusds.oauth2.oidc.sdk (JabRef#18004) Chore(deps): Bump com.konghq:unirest-java-bom from 4.12.9 to 4.12.10 in /versions (JabRef#18031) Keep citation controls reachable in narrow windows / split screens (JabRef#17919) Chore(deps): Bump com.dlsc.pdfviewfx:pdfviewfx from 3.6.1 to 3.6.2 in /versions (JabRef#18026) Chore(deps): Bump com.konghq:unirest-java-bom from 4.12.7 to 4.12.9 in /versions (JabRef#18027) Chore(deps): Bump jablib/src/main/resources/csl-styles from `2af1e53` to `9205842` (JabRef#18021) Chore(deps): Bump jablib/src/main/abbrv.jabref.org from `1710477` to `4932890` (JabRef#18023) Chore(deps): Bump ruby/setup-ruby from 1.345.0 to 1.346.0 (JabRef#18025) Chore(deps): Bump anthropics/claude-code-action from 1.0.290 to 1.0.291 (JabRef#18024) Chore(deps): Bump softprops/action-gh-release from 3.0.4 to 3.0.5 (JabRef#18022) chore(deps): update dependency com.nimbusds:oauth2-oidc-sdk to v11.39.1 (JabRef#18020) chore(deps): update dependency com.konghq:unirest-modules-gson to v4.12.9 (JabRef#18019) Fix crash when the native jabgui opens a library with a fulltext index (JabRef#18007) Use GroupsEditor for the groups field in the merge dialog (JabRef#17798) Chore(deps): Bump com.konghq:unirest-java-bom from 4.12.5 to 4.12.7 in /versions (JabRef#18018) Chore(deps): Bump us.hebi.graalvm:jfx-static-feature from 1.1.1 to 1.2 in /versions (JabRef#18017) chore(deps): update dependency jbangdev/jbang to v0.144.0 (JabRef#18013) chore(deps): update dependency com.konghq:unirest-modules-gson to v4.12.7 (JabRef#18011)
Summary
This PR fixes two runtime errors in the native jabgui.
1. Library with a fulltext index does not open
UnsupportedFeatureError: Support for Arena.ofShared is not active.Arena.ofShared. Native image disables shared arenas by default.-H:+SharedArenaSupportto the jabgui native build.2. Entry preview with Markdown fails
ExceptionInInitializerErrorin flexmarkLineInfo$Preformatted, caused byArrayIndexOutOfBoundsException: Index 0 out of bounds for length 0.LineInfo$FlagswithgetFields(). The enum was not in the metadata, so native image returns no fields.LineInfo$Flagsin the jablib metadata, next toTextContainer$Flags.Steps to test
Build the native binary:
./gradlew :jabgui:nativeCompileError 1:
jabgui/build/native/nativeCompile/jabref <library>.bibError 2:
commentfield of an entry.ExceptionInInitializerError. After this PR, the preview shows the comment.Related issues and pull requests
Closes NA
This PR is part of the JabRef components as native images project.
Related to #17638
AI usage
Claude Code (claude-opus-5-5), AIL_: found the cause from the stack trace and the GraalVM source, and drafted the change and this description. I reviewed the change.
AI CHECKLIST.md walkthrough
1. Code self-review
Nullability and control flow
== null/!= nullchecksObjects.requireNonNull(...)@NullMarked@NullMarkedOptionalconsumed withifPresent/ifPresentOrElse/map/orElseThrowStringUtil.isBlank(...)usedExceptions
catch (Exception e)throw new RuntimeException(...)/IllegalStateException(...)Style and idioms
BibEntryobjects built with withersPattern.compile(...)constantBackgroundTask///) uses Markdown syntaxUser-facing text
Security
Tests
org.jabref.model/org.jabref.logichave tests2. Verification commands
./gradlew :jablib:check(no Java changed; CI runs the tests)./gradlew modernizer(no Java changed)./gradlew --no-configuration-cache :rewriteDryRun(no Java changed)./gradlew javadoc(no Java changed)npx markdownlint-cli2(no Markdown changed)npm run textlint(no Markdown changed)3. Documentation
CHANGELOG.mdentry (native binary is not released yet)docs/requirements/docs/4. Pull request
.github/PULL_REQUEST_TEMPLATE.md, every section filledgh pr create --body-file <file>Checklist
CHANGELOG.mddescribing the change from the user's point of view (if the change is visible to the user)🤖 Generated with Claude Code