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

MacOS only: Preferences.exportSubtree()/childrenNames() always kills process with "Fatal error reported via JNI: JVM_ArrayCopy called: Unimplemented" #9261

Closed
credmond opened this issue Jul 7, 2024 · 9 comments
Assignees

Comments

@credmond
Copy link

credmond commented Jul 7, 2024

Describe the issue
As per title, on MacOs, calling prefs.exportSubtree(x) always causes "Fatal error reported via JNI: JVM_ArrayCopy called: Unimplemented" and kills the running binary immediately. I suspect this has been a problem forever, as I first noticed it on Gluon's build from 2022 and prefs support was only added a little before that -- but it's still present on the latest CE builds: graalvm-community-openjdk-22.0.1 8.1

I regard this as a serious bug, as these methods are used to import/export preferences, etc. -- behaviour that has been stable for a long time.

Steps to reproduce the issue
Reproducing is simple, simply build a native image with something like the below (i.e, I highjacked the StaticFortune example in the demos folder to reproduce with the smallest/simplest project -- just run the commands in build.sh):

public class StaticFortune {
    public static void main(String[] args) throws InterruptedException {
        Path path = Path.of(System.getProperty("java.io.tmpdir")).resolve("whatever.xml");
        System.out.println("Exporting preferences:"   path.toAbsolutePath());

        Preferences prefs = Preferences.userRoot().node("/testapp");
        prefs.put("anything", "here");

        try (OutputStream os = Files.newOutputStream(path)) {
            // ERROR: will cause error because JVM_ArrayCopy is "unimplemented"
            prefs.exportSubtree(os);
        } catch (IOException | BackingStoreException e) {
            throw new RuntimeException(e);
        }
    }
}

The process dies with key error being: "Fatal error reported via JNI: JVM_ArrayCopy called: Unimplemented".

It's ultimately calling a native method called getChildrenForNode(), and that might be reaching this line here (see stracktrace at bottom for more):

https://github.com/openjdk/jdk/blob/6f7f0f1de05fdc0f6a88ccd90b806e8a5c5074ef/src/java.prefs/macosx/native/libprefs/MacOSXPreferencesFile.m#L1013

JVM_ArrayCopy is obviously used by System.arraycopy() and in a couple of other places, so it definitely exists (and I can call that without issue). There there must be some sort of linking issue.

This problem does NOT occur on Windows or Linux (and the equivalent preferences classes do not refer to JVM_ArrayCopy either).

Describe GraalVM and your environment:

  • GraalVM version: graalvm-community-openjdk-22.0.1 8.1
  • JDK major version: graalvm-community-openjdk-22.0.1 8.1
  • OS/arch: Darwin Mac-mini.local 21.6.0 Darwin Kernel Version 21.6.0: Mon Apr 24 21:10:53 PDT 2023; root:xnu-8020.240.18.701.5~1/RELEASE_X86_64 x86_64

More details

Exporting preferences:/var/folders/qm/bkvstgcn4638cwnxfx6rym2m0000gp/T/whatever.xml
Fatal error reported via JNI: JVM_ArrayCopy called:  Unimplemented

Printing instructions (ip=0x000000010443fe48):
  0x000000010443fd48: 0x24 0x10 0xeb 0x88 0x48 0x89 0x6c 0x24 0x40 0x48 0x89 0x54 0x24 0x38 0x48 0x89
  0x000000010443fd58: 0x4c 0x24 0x30 0x4c 0x89 0x6c 0x24 0x28 0x4c 0x89 0x64 0x24 0x20 0x48 0x89 0x5c
  0x000000010443fd68: 0x24 0x18 0x48 0xc7 0xc0 0x00 0x00 0x00 0x00 0x4c 0x8b 0x74 0x24 0x30 0x4c 0x8b
  0x000000010443fd78: 0x7c 0x24 0x38 0x48 0x83 0xc4 0x48 0xc3 0x48 0x8b 0x6c 0x24 0x40 0x48 0x8b 0x54
  0x000000010443fd88: 0x24 0x38 0x48 0x8b 0x4c 0x24 0x30 0x4c 0x8b 0x6c 0x24 0x28 0x4c 0x8b 0x64 0x24
  0x000000010443fd98: 0x20 0x48 0x8b 0x5c 0x24 0x18 0x49 0x2b 0xc6 0x49 0x89 0x47 0x78 0x41 0xc7 0x47
  0x000000010443fda8: 0x14 0x03 0x00 0x00 0x00 0xf0 0x83 0x04 0x24 0x00 0x48 0xc7 0xc0 0x00 0x00 0x00
  0x000000010443fdb8: 0x00 0x4c 0x8b 0xf1 0x4c 0x8b 0xfa 0x48 0x83 0xc4 0x48 0xc3 0xcc 0xcc 0xcc 0xcc
  0x000000010443fdc8: 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0x48 0x83 0xec 0x48 0x48 0x89 0x5c 0x24
  0x000000010443fdd8: 0x40 0x4c 0x89 0x64 0x24 0x38 0x4c 0x89 0x6c 0x24 0x30 0x49 0x8b 0xce 0x48 0x89
  0x000000010443fde8: 0x4c 0x24 0x28 0x49 0x8b 0xd7 0x48 0x89 0x54 0x24 0x20 0x48 0x89 0x6c 0x24 0x18
  0x000000010443fdf8: 0x48 0x89 0x7c 0x24 0x10 0x48 0x89 0x74 0x24 0x08 0x48 0x85 0xff 0x0f 0x84 0xc1
  0x000000010443fe08: 0x00 0x00 0x00 0x4c 0x8b 0xff 0x48 0x8b 0x87 0xb8 0x00 0x00 0x00 0x4c 0x8b 0xf0
  0x000000010443fe18: 0x41 0x83 0xbf 0xf8 0x00 0x00 0x00 0x00 0x0f 0x85 0x53 0x00 0x00 0x00 0xb8 0x03
  0x000000010443fe28: 0x00 0x00 0x00 0x41 0xb8 0x01 0x00 0x00 0x00 0xf0 0x45 0x0f 0xb1 0x47 0x14 0x0f
  0x000000010443fe38: 0x85 0x3c 0x00 0x00 0x00 0x48 0x8b 0xc7 0x4c 0x8b 0xc6 0xe8 0xb8 0x01 0x06 0x00
> 0x000000010443fe48: 0x90 0x41 0xc7 0x47 0x14 0x03 0x00 0x00 0x00 0xf0 0x83 0x04 0x24 0x00 0x48 0x8b
  0x000000010443fe58: 0x5c 0x24 0x40 0x48 0x8b 0x6c 0x24 0x18 0x4c 0x8b 0x64 0x24 0x38 0x4c 0x8b 0x6c
  0x000000010443fe68: 0x24 0x30 0x4c 0x8b 0x74 0x24 0x28 0x4c 0x8b 0x7c 0x24 0x20 0x48 0x83 0xc4 0x48
  0x000000010443fe78: 0xc3 0xbf 0x01 0x00 0x00 0x00 0xbe 0x00 0x00 0x00 0x00 0xe8 0xe8 0x32 0x0a 0x00
  0x000000010443fe88: 0x90 0x48 0x8b 0x74 0x24 0x08 0x48 0x8b 0x7c 0x24 0x10 0xeb 0xa8 0x49 0x2b 0xc6
  0x000000010443fe98: 0x49 0x89 0x47 0x78 0x41 0xc7 0x47 0x14 0x03 0x00 0x00 0x00 0xf0 0x83 0x04 0x24
  0x000000010443fea8: 0x00 0x48 0x8b 0x5c 0x24 0x40 0x48 0x8b 0x6c 0x24 0x18 0x4c 0x8b 0x64 0x24 0x38
  0x000000010443feb8: 0x4c 0x8b 0x6c 0x24 0x30 0x4c 0x8b 0x74 0x24 0x28 0x4c 0x8b 0x7c 0x24 0x20 0x48
  0x000000010443fec8: 0x83 0xc4 0x48 0xc3 0x48 0x8d 0x05 0xc5 0xde 0x3f 0x01 0xbf 0x02 0x00 0x00 0x00
  0x000000010443fed8: 0x48 0x8b 0xf0 0xe8 0x40 0x7a 0x03 0x00 0x90 0x48 0x8b 0x5c 0x24 0x40 0x48 0x8b
  0x000000010443fee8: 0x6c 0x24 0x18 0x4c 0x8b 0x64 0x24 0x38 0x4c 0x8b 0x6c 0x24 0x30 0x4c 0x8b 0x74
  0x000000010443fef8: 0x24 0x28 0x4c 0x8b 0x7c 0x24 0x20 0xcc 0x48 0x83 0xec 0x48 0x49 0x8b 0xce 0x49
  0x000000010443ff08: 0x8b 0xd7 0x48 0x85 0xff 0x0f 0x84 0xe2 0x00 0x00 0x00 0x4c 0x8b 0xff 0x48 0x8b
  0x000000010443ff18: 0x87 0xb8 0x00 0x00 0x00 0x4c 0x8b 0xf0 0x41 0x83 0xbf 0xf8 0x00 0x00 0x00 0x00
  0x000000010443ff28: 0x0f 0x85 0x7c 0x00 0x00 0x00 0xb8 0x03 0x00 0x00 0x00 0x41 0xb8 0x01 0x00 0x00
  0x000000010443ff38: 0x00 0xf0 0x45 0x0f 0xb1 0x47 0x14 0x90 0x0f 0x85 0x64 0x00 0x00 0x00 0x48 0x89

Top of stack (sp=0x00007ff7bbaf7380):
  0x00007ff7bbaf7360: 0x0000000105e0c668 0x000000010443fe48 0x00007ff7bbaf7380 0x000000010443fe48
> 0x00007ff7bbaf7380: 0x00007ff7bbaf73e8 0x0000000104d34b2b 0x00007fab86704480 0x00007ff7bbaf73d0
  0x00007ff7bbaf73a0: 0x520bcfb74e6a33c7 0x000000020048c668 0x00007fab86704480 0x0000000000000004
  0x00007ff7bbaf73c0: 0x0000000000000005 0x0000000104d30d24 0x00007ff7bbaf7450 0x0000000104d1d04e
  0x00007ff7bbaf73e0: 0x0000600000000000 0x0000000000000004 0x00007fab86704480 0x0000000000000000
  0x00007ff7bbaf7400: 0xf90c6ff551bd0001 0x0000000000000008 0x000000014e6a33c7 0x0000600002cc4030
  0x00007ff7bbaf7420: 0x0000600001bc00e0 0x0000000000506410 0x0000000104b6457f 0x00007ff7bbaf7478
  0x00007ff7bbaf7440: 0x0000000105980000 0x00007fab86704480 0x000000000000000a 0x0000000104b64592
  0x00007ff7bbaf7460: 0x0000000105e7fa40 0x00000001065051f8 0x0000000105cc24d8 0x0000000104b6457f
  0x00007ff7bbaf7480: 0x00007ff7bbaf7460 0x0000000000000000 0x0000000000000003 0x00000001004ffa40
  0x00007ff7bbaf74a0: 0x0000000106522940 0x00007ff858bcec20 0x00007ff858c75e40 0x0000000104b619f9
  0x00007ff7bbaf74c0: 0x0000000104a6ff20 0x0000000000b81f58 0x00000001065051f8 0x0000000105e7fa40
  0x00007ff7bbaf74e0: 0x0000000106501f58 0x0000000106505070 0x0000000106522940 0x0000000104b5d810
  0x00007ff7bbaf7500: 0x00000001fffffffe 0x0000000104533cdc 0x0000000105e7fa40 0x0000000106522940
  0x00007ff7bbaf7520: 0x00000001065228b0 0x00000001065228e8 0x0000000106505140 0x0000000106505070
  0x00007ff7bbaf7540: 0x0000000106522560 0x0000000104b67849 0x0000000106520518 0x0000000106522560
  0x00007ff7bbaf7560: 0x0000000105cb6c78 0x0000000106520aa0 0x0000000105cc2f98 0x0000000106520788

VM thread locals for the failing thread 0x00007fab86704480:
  0: JNIThreadLocalEnvironment.jniFunctions = (bytes) 0x0000000105de5010
  8: StackOverflowCheckImpl.stackBoundaryTL = (Word) 0x0000000000000001 (1)
  16: Safepoint.safepointRequested = (int) 0x7fff3c92 (2147433618)
  20: StatusSupport.statusTL = (int) 0x00000001 (1)
  24: ThreadLocalAllocation.regularTLAB = (bytes) 
    0x00007fab86704498: 0x0000000106500000 0x0000000106580000
    0x00007fab867044a8: 0x0000000106522c30 0x0000000000000000
  56: PlatformThreads.currentThread = (Object) 0x0000000106082c28
    is an object of type java.lang.Thread
  64: JavaFrameAnchors.lastAnchor = (Word) 0x00007ff7bbaf7478 (140701982487672)
  72: JavaThreads.currentVThreadId = (long) 0x0000000000000001 (1)
  80: ExceptionUnwind.currentException = (Object) 0x0000000000000000
  88: IdentityHashCodeSupport.hashCodeGeneratorTL = (Object) 0x00000001065020b0
    is an object of type java.util.SplittableRandom
  96: IsolatedCompileClient.currentClient = (Object) 0x0000000000000000
  104: IsolatedCompileContext.currentContext = (Object) 0x0000000000000000
  112: JNIObjectHandles.handles = (Object) 0x00000001065009c8
    is an object of type com.oracle.svm.core.handles.ThreadLocalHandles
  120: JNIThreadLocalPendingException.pendingException = (Object) 0x0000000000000000
  128: JNIThreadLocalReferencedObjects.referencedObjectsListHead = (Object) 0x0000000000000000
  136: JNIThreadOwnedMonitors.ownedMonitors = (Object) 0x0000000000000000
  144: NoAllocationVerifier.openVerifiers = (Object) 0x0000000000000000
  152: RecurringCallbackTimer.exception = (Object) 0x0000000000000000
  160: ThreadingSupportImpl.activeTimer = (Object) 0x0000000000000000
  168: SubstrateDiagnostics.threadOnlyAttachedForCrashHandler = (bytes) 0x0000000000000000
  176: ThreadLocalAllocation.allocatedBytes = (Word) 0x0000000000000000 (0)
  184: VMThreads.IsolateTL = (Word) 0x0000000105980000 (4388814848)
  192: VMThreads.OSThreadHandleTL = (Word) 0x000000010ca51600 (4507112960)
  200: VMThreads.OSThreadIdTL = (Word) 0x0000000000000103 (259)
  208: VMThreads.StackBase = (Word) 0x00007ff7bbaf8000 (140701982490624)
  216: VMThreads.StackEnd = (Word) 0x00007ff7bb2f8000 (140701974102016)
  224: VMThreads.StartedByCurrentIsolate = (bytes) 0x0000000000000000
  232: VMThreads.nextTL = (Word) 0x0000000000000000 (0)
  240: VMThreads.unalignedIsolateThreadMemoryTL = (Word) 0x00007fab86704470 (140374671639664)
  248: ActionOnTransitionToJavaSupport.actionTL = (int) 0x00000000 (0)
  252: ImplicitExceptions.implicitExceptionsAreFatal = (int) 0x00000000 (0)
  256: StackOverflowCheckImpl.yellowZoneStateTL = (int) 0x7efefefe (2130640638)
  260: StatusSupport.safepointBehaviorTL = (int) 0x00000001 (1)
  264: ThreadingSupportImpl.currentPauseDepth = (int) 0x00000000 (0)
  
Java frame anchors for the failing thread 0x00007fab86704480:
  Anchor 0x00007ff7bbaf7478 LastJavaSP 0x00007ff7bbaf7460 LastJavaIP 0x0000000104b6457f
  
Stacktrace for the failing thread 0x00007fab86704480 (A=AOT compiled, J=JIT compiled, D=deoptimized, i=inlined):
  A  SP 0x00007ff7bbaf7380 IP 0x000000010443fe48 size=80    com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FatalError_2d6e7de51007501356372d87ae0cc671dc9d1a91(IsolateEnterStub.java:0)
  A  SP 0x00007ff7bbaf7460 IP 0x0000000104b6457f size=96    java.util.prefs.MacOSXPreferencesFile.getChildrenForNode(Native Method)
  i  SP 0x00007ff7bbaf74c0 IP 0x0000000104b619f9 size=64    java.util.prefs.MacOSXPreferencesFile.getChildrenForNode(MacOSXPreferencesFile.java:425)
  A  SP 0x00007ff7bbaf74c0 IP 0x0000000104b619f9 size=64    java.util.prefs.MacOSXPreferences.childrenNamesSpi(MacOSXPreferences.java:196)
  A  SP 0x00007ff7bbaf7500 IP 0x0000000104b5d810 size=80    java.util.prefs.AbstractPreferences.childrenNames(AbstractPreferences.java:756)
  A  SP 0x00007ff7bbaf7550 IP 0x0000000104b67849 size=160   java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:169)
  A  SP 0x00007ff7bbaf75f0 IP 0x0000000104b67057 size=128   java.util.prefs.XmlSupport.export(XmlSupport.java:123)
  i  SP 0x00007ff7bbaf7670 IP 0x000000010488a227 size=80    java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1660)
  A  SP 0x00007ff7bbaf7670 IP 0x000000010488a227 size=80    demo.StaticFortune.main(StaticFortune.java:60)
  i  SP 0x00007ff7bbaf76c0 IP 0x000000010441d2cb size=16    java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
  i  SP 0x00007ff7bbaf76c0 IP 0x000000010441d2cb size=16    com.oracle.svm.core.JavaMainWrapper.invokeMain(JavaMainWrapper.java:182)
  A  SP 0x00007ff7bbaf76c0 IP 0x000000010441d2cb size=16    com.oracle.svm.core.JavaMainWrapper.runCore0(JavaMainWrapper.java:233)
  i  SP 0x00007ff7bbaf76d0 IP 0x000000010441d090 size=48    com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:202)
  A  SP 0x00007ff7bbaf76d0 IP 0x000000010441d090 size=48    com.oracle.svm.core.JavaMainWrapper.doRun(JavaMainWrapper.java:301)
  i  SP 0x00007ff7bbaf7700 IP 0x0000000104445bcb size=96    com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:286)
  A  SP 0x00007ff7bbaf7700 IP 0x0000000104445bcb size=96    com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b(IsolateEnterStub.java:0)
  
Threads:
  0x00007fab87004200 STATUS_IN_NATIVE (ALLOW_SAFEPOINT) "Timer-0" - 0x0000000106502740, daemon, stack(0x000070000029e000,0x000070000031e000)
  0x00007fab87004080 STATUS_IN_NATIVE (ALLOW_SAFEPOINT) "Reference Handler" - 0x0000000106082b70, daemon, stack(0x000070000021b000,0x000070000029b000)
  0x00007fab86704480 STATUS_IN_JAVA (PREVENT_VM_FROM_REACHING_SAFEPOINT) "main" - 0x0000000106082c28, stack(0x00007ff7bb2f8000,0x00007ff7bbaf8000)
  
No VMOperation in progress

The 30 most recent VM operation status changes:
  
VM mutexes:
  mutex "RealLog.backTracePrinterMutex" is unlocked.
  mutex "mainVMOperationControlWorkQueue" is unlocked.
  mutex "referencePendingList" is unlocked.
  mutex "thread" is unlocked.
  
Build time information:
  Version: 22.0.1 8, serial gc
  Platform: darwin/amd64
  Page size: 4096
  Container support: true
  CPU features used for AOT compiled code: CX8, CMOV, FXSR, MMX, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, POPCNT, LZCNT, AVX, AVX2, BMI1, BMI2, FMA, F16C
  
Runtime information:
  CPU cores (container): unknown
  CPU cores (OS): 4
  Memory: 8192M
  Page size: 4096
  VM uptime: 0.018s
  Current timestamp: 1720355563771
  AOT compiled code: 0x000000010440a000 - 0x0000000104d1aa3f
  
Command line: 

Heap settings and statistics:
  Supports isolates: true
  Heap base: 0x0000000105980000
  Object reference size: 8
  Reserved object header bits: 0b111
  Aligned chunk size: 524288
  Large array threshold: 131072
  Incremental collections: 0
  Complete collections: 0
  
Heap usage:
  Eden: 1.50M (0.00M in 0 aligned chunks, 0.00M in 0 unaligned chunks)
  Old: 0.00M (0.00M in 0 aligned chunks, 0.00M in 0 unaligned chunks)
  
Native image heap boundaries:
  ReadOnly Primitives: 0x0000000105a00830 - 0x0000000105c1c4f0
  ReadOnly References: 0x0000000105c1c4f0 - 0x0000000105de47e0
  ReadOnly Relocatables: 0x0000000105de5000 - 0x0000000105eadd58
  Writable Primitives: 0x0000000105eae000 - 0x0000000105f9a668
  Writable References: 0x0000000105f9a668 - 0x00000001062083e8
  Writable Huge: 0x0000000000000000 - 0x0000000000000000
  ReadOnly Huge: 0x0000000106280038 - 0x00000001064fa628
  
Heap chunks: E=eden, S=survivor, O=old, F=free; A=aligned chunk, U=unaligned chunk; T=to space
@credmond
Copy link
Author

credmond commented Jul 7, 2024

Can also be reproduced simply by calling childrenNames, which also ultimately calls the same native methods:

public class StaticFortune {
    public static void main(String[] args) throws InterruptedException {
        Preferences prefs = Preferences.userRoot().node("/testapp");
        prefs.childrenNames();
    }
}

@credmond credmond changed the title MacOS: Preferences.exportSubtree() kills process with "Fatal error reported via JNI: JVM_ArrayCopy called: Unimplemented" MacOS: Preferences.exportSubtree()/childrenNames() kills process with "Fatal error reported via JNI: JVM_ArrayCopy called: Unimplemented" Jul 7, 2024
@credmond credmond changed the title MacOS: Preferences.exportSubtree()/childrenNames() kills process with "Fatal error reported via JNI: JVM_ArrayCopy called: Unimplemented" MacOS only: Preferences.exportSubtree()/childrenNames() always kills process with "Fatal error reported via JNI: JVM_ArrayCopy called: Unimplemented" Jul 8, 2024
@oubidar-Abderrahim oubidar-Abderrahim self-assigned this Jul 8, 2024
@oubidar-Abderrahim
Copy link
Member

Thank you for reaching out about this, we'll take a look into it shortly

@oubidar-Abderrahim
Copy link
Member

Could you please confirm if this issue happens on one of the latest dev builds as well?

@credmond
Copy link
Author

credmond commented Jul 9, 2024

Yes, exact same problem happening on:

mac1@Mac-mini staticfortune % java -version
openjdk version "24" 2025-03-18
OpenJDK Runtime Environment GraalVM CE 24-dev 3.1 (build 24 3-jvmci-b01)
OpenJDK 64-Bit Server VM GraalVM CE 24-dev 3.1 (build 24 3-jvmci-b01, mixed mode, sharing)
mac1@Mac-mini staticfortune % 

Build downloaded from:

https://github.com/graalvm/graalvm-ce-dev-builds/releases/download/24.2.0-dev-20240706_0026/graalvm-community-java24-darwin-amd64-dev.tar.gz

Exporting preferences:/var/folders/qm/bkvstgcn4638cwnxfx6rym2m0000gp/T/whatever.xml
Fatal error reported via JNI: JVM_ArrayCopy called:  Unimplemented

Printing instructions (ip=0x000000010f81f289):
  0x000000010f81f189: 0x24 0x08 0xeb 0x87 0x48 0x89 0x6c 0x24 0x38 0x48 0x89 0x54 0x24 0x30 0x48 0x89
  0x000000010f81f199: 0x4c 0x24 0x28 0x4c 0x89 0x6c 0x24 0x20 0x4c 0x89 0x64 0x24 0x18 0x48 0x89 0x5c
  0x000000010f81f1a9: 0x24 0x10 0x48 0xc7 0xc0 0x00 0x00 0x00 0x00 0x4c 0x8b 0x74 0x24 0x28 0x4c 0x8b
  0x000000010f81f1b9: 0x7c 0x24 0x30 0x48 0x83 0xc4 0x40 0x5d 0xc3 0x48 0x8b 0x6c 0x24 0x38 0x48 0x8b
  0x000000010f81f1c9: 0x54 0x24 0x30 0x48 0x8b 0x4c 0x24 0x28 0x4c 0x8b 0x6c 0x24 0x20 0x4c 0x8b 0x64
  0x000000010f81f1d9: 0x24 0x18 0x48 0x8b 0x5c 0x24 0x10 0x49 0x2b 0xc6 0x49 0x89 0x47 0x68 0x41 0xc7
  0x000000010f81f1e9: 0x47 0x14 0x03 0x00 0x00 0x00 0xf0 0x83 0x04 0x24 0x00 0x48 0xc7 0xc0 0x00 0x00
  0x000000010f81f1f9: 0x00 0x00 0x4c 0x8b 0xf1 0x4c 0x8b 0xfa 0x48 0x83 0xc4 0x40 0x5d 0xc3 0xcc 0xcc
  0x000000010f81f209: 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0x55 0x48 0x83 0xec 0x50 0x48 0x89 0x5c 0x24
  0x000000010f81f219: 0x48 0x4c 0x89 0x64 0x24 0x40 0x4c 0x89 0x6c 0x24 0x38 0x49 0x8b 0xce 0x48 0x89
  0x000000010f81f229: 0x4c 0x24 0x30 0x49 0x8b 0xd7 0x48 0x89 0x54 0x24 0x28 0x48 0x89 0x6c 0x24 0x20
  0x000000010f81f239: 0x48 0x89 0x7c 0x24 0x18 0x48 0x89 0x74 0x24 0x10 0x48 0x85 0xff 0x0f 0x84 0xc3
  0x000000010f81f249: 0x00 0x00 0x00 0x4c 0x8b 0xff 0x48 0x8b 0x87 0xa8 0x00 0x00 0x00 0x4c 0x8b 0xf0
  0x000000010f81f259: 0x41 0x83 0xbf 0xe8 0x00 0x00 0x00 0x00 0x0f 0x85 0x54 0x00 0x00 0x00 0xb8 0x03
  0x000000010f81f269: 0x00 0x00 0x00 0x41 0xb8 0x01 0x00 0x00 0x00 0xf0 0x45 0x0f 0xb1 0x47 0x14 0x0f
  0x000000010f81f279: 0x85 0x3d 0x00 0x00 0x00 0x48 0x8b 0xc7 0x4c 0x8b 0xc6 0xe8 0x47 0x68 0x07 0x00
> 0x000000010f81f289: 0x90 0x41 0xc7 0x47 0x14 0x03 0x00 0x00 0x00 0xf0 0x83 0x04 0x24 0x00 0x48 0x8b
  0x000000010f81f299: 0x5c 0x24 0x48 0x48 0x8b 0x6c 0x24 0x20 0x4c 0x8b 0x64 0x24 0x40 0x4c 0x8b 0x6c
  0x000000010f81f2a9: 0x24 0x38 0x4c 0x8b 0x74 0x24 0x30 0x4c 0x8b 0x7c 0x24 0x28 0x48 0x83 0xc4 0x50
  0x000000010f81f2b9: 0x5d 0xc3 0xbf 0x01 0x00 0x00 0x00 0xbe 0x00 0x00 0x00 0x00 0xe8 0x86 0x17 0x0b
  0x000000010f81f2c9: 0x00 0x90 0x48 0x8b 0x74 0x24 0x10 0x48 0x8b 0x7c 0x24 0x18 0xeb 0xa7 0x49 0x2b
  0x000000010f81f2d9: 0xc6 0x49 0x89 0x47 0x68 0x41 0xc7 0x47 0x14 0x03 0x00 0x00 0x00 0xf0 0x83 0x04
  0x000000010f81f2e9: 0x24 0x00 0x48 0x8b 0x5c 0x24 0x48 0x48 0x8b 0x6c 0x24 0x20 0x4c 0x8b 0x64 0x24
  0x000000010f81f2f9: 0x40 0x4c 0x8b 0x6c 0x24 0x38 0x4c 0x8b 0x74 0x24 0x30 0x4c 0x8b 0x7c 0x24 0x28
  0x000000010f81f309: 0x48 0x83 0xc4 0x50 0x5d 0xc3 0x48 0x8d 0x05 0x42 0x3a 0x42 0x01 0xbf 0x02 0x00
  0x000000010f81f319: 0x00 0x00 0x48 0x8b 0xf0 0xe8 0x1d 0xc2 0x04 0x00 0x90 0x48 0x8b 0x5c 0x24 0x48
  0x000000010f81f329: 0x48 0x8b 0x6c 0x24 0x20 0x4c 0x8b 0x64 0x24 0x40 0x4c 0x8b 0x6c 0x24 0x38 0x4c
  0x000000010f81f339: 0x8b 0x74 0x24 0x30 0x4c 0x8b 0x7c 0x24 0x28 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc
  0x000000010f81f349: 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0xcc 0x55 0x48 0x83 0xec 0x50 0x49 0x8b 0xce 0x49
  0x000000010f81f359: 0x8b 0xd7 0x48 0x85 0xff 0x0f 0x84 0xe1 0x00 0x00 0x00 0x4c 0x8b 0xff 0x48 0x8b
  0x000000010f81f369: 0x87 0xa8 0x00 0x00 0x00 0x4c 0x8b 0xf0 0x41 0x83 0xbf 0xe8 0x00 0x00 0x00 0x00
  0x000000010f81f379: 0x0f 0x85 0x7c 0x00 0x00 0x00 0xb8 0x03 0x00 0x00 0x00 0x41 0xb8 0x01 0x00 0x00

Top of stack (sp=0x00007ff7b072d380):
  0x00007ff7b072d360: 0x000000011123ce00 0x000000010f81f289 0x00007ff7b072d380 0x000000010f81f289
> 0x00007ff7b072d380: 0x000000000000001a 0x000000010f895aab 0x000000011015c309 0x00007fb903704480
  0x00007ff7b072d3a0: 0x00007ff7b072d3e0 0x108fa408c95ab573 0x00000002004bce00 0x00007fb903704480
  0x00007ff7b072d3c0: 0x0000000000000004 0x0000000000000005 0x00007ff7b072d3e0 0x0000000110158544
  0x00007ff7b072d3e0: 0x00007ff7b072d460 0x00000001101448ee 0x00007fb950000000 0x0000000000000004
  0x00007ff7b072d400: 0x00007fb903704480 0x0000000000000000 0x108fa408c95ab501 0x0000000000000008
  0x00007ff7b072d420: 0x0000000100de8030 0x0000600000de8000 0x0000600003ae40e0 0x0000000000532cb8
  0x00007ff7b072d440: 0x000000010ff7112f 0x00007ff7b072d488 0x0000000110d80000 0x00007fb903704480
  0x00007ff7b072d460: 0x000000000000000a 0x000000010ff71142 0x0000000111922d00 0x00000001119054f0
  0x00007ff7b072d480: 0x0000000111055a48 0x000000010f8a5831 0x000000010ff7112f 0x00007ff7b072d470
  0x00007ff7b072d4a0: 0x0000000000000000 0x000000010f8a0ab0 0x0000000000000003 0x00000001005248e8
  0x00007ff7b072d4c0: 0x0000000111923000 0x00007ff862502c20 0x00007ff8625a9e40 0x000000010ff6e7d9
  0x00007ff7b072d4e0: 0x000000010fe73860 0x0000000000b81f70 0x00000001119054f0 0x00000001112a48e8
  0x00007ff7b072d500: 0x0000000111901f70 0x0000000111905368 0x0000000111923000 0x000000010ff6a64a
  0x00007ff7b072d520: 0x00000001fffffffe 0x000000010f920b76 0x0000000111901f70 0x0000000111923000
  0x00007ff7b072d540: 0x0000000111905438 0x0000000111922fa8 0x0000000111905438 0x0000000111905368
  0x00007ff7b072d560: 0x0000000111922c20 0x000000010ff742c2 0x0000000111920c00 0x0000000111920b78

VM thread locals for the failing thread 0x00007fb903704480:
  0: JNIThreadLocalEnvironment.jniFunctions = (bytes) 0x0000000111217970
  8: StackOverflowCheckImpl.stackBoundaryTL = (Word) 0x0000000000000001 (1)
  16: Safepoint.safepointRequested = (int) 0x7fff3c11 (2147433489)
  20: StatusSupport.statusTL = (int) 0x00000001 (1)
  24: ThreadLocalAllocation.regularTLAB = (bytes) 
    0x00007fb903704498: 0x0000000111950000 0x0000000111980000
    0x00007fb9037044a8: 0x00000001119232f0 0x0000000000000000
  56: PlatformThreads.currentThread = (Object) 0x000000011149de48
    is an object of type java.lang.Thread
  64: JavaFrameAnchors.lastAnchor = (Word) 0x00007ff7b072d488 (140701793965192)
  72: JavaThreads.currentVThreadId = (long) 0x0000000000000001 (1)
  80: ExceptionUnwind.currentException = (Object) 0x0000000000000000
  88: IdentityHashCodeSupport.hashCodeGeneratorTL = (Object) 0x00000001119020c8
    is an object of type java.util.SplittableRandom
  96: JNIObjectHandles.handles = (Object) 0x00000001119009d0
    is an object of type com.oracle.svm.core.handles.ThreadLocalHandles
  104: JNIThreadLocalPendingException.pendingException = (Object) 0x0000000000000000
  112: JNIThreadLocalReferencedObjects.referencedObjectsListHead = (Object) 0x0000000000000000
  120: JNIThreadOwnedMonitors.ownedMonitors = (Object) 0x0000000000000000
  128: NoAllocationVerifier.openVerifiers = (Object) 0x0000000000000000
  136: RecurringCallbackTimer.exception = (Object) 0x0000000000000000
  144: ThreadingSupportImpl.activeTimer = (Object) 0x0000000000000000
  152: SubstrateDiagnostics.threadOnlyAttachedForCrashHandler = (bytes) 0x0000000000000000
  160: ThreadLocalAllocation.allocatedBytes = (Word) 0x0000000000000000 (0)
  168: VMThreads.IsolateTL = (Word) 0x0000000110d80000 (4577558528)
  176: VMThreads.OSThreadHandleTL = (Word) 0x000000011b609600 (4754281984)
  184: VMThreads.OSThreadIdTL = (Word) 0x0000000000000103 (259)
  192: VMThreads.StackBase = (Word) 0x00007ff7b072e000 (140701793968128)
  200: VMThreads.StackEnd = (Word) 0x00007ff7aff2e000 (140701785579520)
  208: VMThreads.StartedByCurrentIsolate = (bytes) 0x0000000000000000
  216: VMThreads.nextTL = (Word) 0x0000000000000000 (0)
  224: VMThreads.unalignedIsolateThreadMemoryTL = (Word) 0x00007fb903704470 (140432603366512)
  232: ActionOnTransitionToJavaSupport.actionTL = (int) 0x00000000 (0)
  236: ImplicitExceptions.implicitExceptionsAreFatal = (int) 0x00000000 (0)
  240: Safepoint.suspended = (int) 0x00000000 (0)
  244: StackOverflowCheckImpl.yellowZoneStateTL = (int) 0x7efefefe (2130640638)
  248: StatusSupport.safepointBehaviorTL = (int) 0x00000001 (1)
  252: ThreadingSupportImpl.currentPauseDepth = (int) 0x00000000 (0)
  
Java frame anchors for the failing thread 0x00007fb903704480:
  Anchor 0x00007ff7b072d488 LastJavaSP 0x00007ff7b072d470 LastJavaIP 0x000000010ff7112f
  
Stacktrace for the failing thread 0x00007fb903704480 (A=AOT compiled, J=JIT compiled, D=deoptimized, i=inlined):
  A  SP 0x00007ff7b072d380 IP 0x000000010f81f289 size=96    com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_FatalError_lnAeWJzbKX7xreBcsLcdq7(IsolateEnterStub.java:0)
  A  SP 0x00007ff7b072d470 IP 0x000000010ff7112f size=112   java.util.prefs.MacOSXPreferencesFile.getChildrenForNode(Native Method)
  i  SP 0x00007ff7b072d4e0 IP 0x000000010ff6e7d9 size=64    java.util.prefs.MacOSXPreferencesFile.getChildrenForNode(MacOSXPreferencesFile.java:425)
  A  SP 0x00007ff7b072d4e0 IP 0x000000010ff6e7d9 size=64    java.util.prefs.MacOSXPreferences.childrenNamesSpi(MacOSXPreferences.java:196)
  A  SP 0x00007ff7b072d520 IP 0x000000010ff6a64a size=80    java.util.prefs.AbstractPreferences.childrenNames(AbstractPreferences.java:756)
  A  SP 0x00007ff7b072d570 IP 0x000000010ff742c2 size=176   java.util.prefs.XmlSupport.putPreferencesInXml(XmlSupport.java:169)
  A  SP 0x00007ff7b072d620 IP 0x000000010ff73ab6 size=144   java.util.prefs.XmlSupport.export(XmlSupport.java:123)
  i  SP 0x00007ff7b072d6b0 IP 0x000000010fc6d840 size=80    java.util.prefs.AbstractPreferences.exportSubtree(AbstractPreferences.java:1660)
  A  SP 0x00007ff7b072d6b0 IP 0x000000010fc6d840 size=80    demo.StaticFortune.main(StaticFortune.java:60)
  i  SP 0x00007ff7b072d700 IP 0x000000010f7f680b size=16    java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)
  i  SP 0x00007ff7b072d700 IP 0x000000010f7f680b size=16    com.oracle.svm.core.JavaMainWrapper.invokeMain(JavaMainWrapper.java:181)
  A  SP 0x00007ff7b072d700 IP 0x000000010f7f680b size=16    com.oracle.svm.core.JavaMainWrapper.runCore0(JavaMainWrapper.java:232)
  i  SP 0x00007ff7b072d710 IP 0x000000010f7f65d0 size=48    com.oracle.svm.core.JavaMainWrapper.runCore(JavaMainWrapper.java:201)
  A  SP 0x00007ff7b072d710 IP 0x000000010f7f65d0 size=48    com.oracle.svm.core.JavaMainWrapper.doRun(JavaMainWrapper.java:299)
  i  SP 0x00007ff7b072d740 IP 0x000000010f82ac2c size=96    com.oracle.svm.core.JavaMainWrapper.run(JavaMainWrapper.java:284)
  A  SP 0x00007ff7b072d740 IP 0x000000010f82ac2c size=96    com.oracle.svm.core.code.IsolateEnterStub.JavaMainWrapper_run_XNhh1mz2Ib2aPR1wdv014D(IsolateEnterStub.java:0)
  
Threads:
  0x00007fb903704700 STATUS_IN_NATIVE (ALLOW_SAFEPOINT) "Timer-0" - 0x0000000111902758, daemon, stack(0x000070000c687000,0x000070000c707000)
  0x00007fb904004080 STATUS_IN_NATIVE (ALLOW_SAFEPOINT) "Reference Handler" - 0x000000011149dfb8, daemon, stack(0x000070000c604000,0x000070000c684000)
  0x00007fb903704480 STATUS_IN_JAVA (PREVENT_VM_FROM_REACHING_SAFEPOINT) "main" - 0x000000011149de48, stack(0x00007ff7aff2e000,0x00007ff7b072e000)
  
No VMOperation in progress

The 30 most recent VM operation status changes:
  
VM mutexes:
  mutex "RealLog.backTracePrinterMutex" is unlocked.
  mutex "mainVMOperationControlWorkQueue" is unlocked.
  mutex "referencePendingList" is unlocked.
  mutex "thread" is unlocked.
  
Build time information:
  Version: 24 3, serial gc
  Platform: darwin/amd64
  Page size: 65536
  Container support: true
  CPU features used for AOT compiled code: CX8, CMOV, FXSR, MMX, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2, POPCNT, LZCNT, AVX, AVX2, BMI1, BMI2, FMA, F16C
  
Runtime information:
  CPU cores (container): unknown
  CPU cores (OS): 4
  Memory: 8192M
  Page size: 4096
  VM uptime: 0.020s
  Current timestamp: 1720563374757
  AOT compiled code: 0x000000010f7e2000 - 0x00000001101422bf
  
Command line: 

Heap settings and statistics:
  Supports isolates: true
  Heap base: 0x0000000110d80000
  Object reference size: 8
  Reserved object header bits: 0b111
  Aligned chunk size: 524288
  Large array threshold: 131072
  Incremental collections: 0
  Complete collections: 0
  
Heap usage:
  Eden: 1.50M (0.00M in 0 aligned chunks, 0.00M in 0 unaligned chunks)
  Old: 0.00M (0.00M in 0 aligned chunks, 0.00M in 0 unaligned chunks)
  
Native image heap boundaries:
  ReadOnly: 0x0000000110e00838 - 0x0000000111217960
  ReadOnly Relocatables: 0x0000000111217960 - 0x00000001112e5fc0
  Writable: 0x00000001112e5fc0 - 0x0000000111672590
  Writable Huge: 0x0000000000000000 - 0x0000000000000000
  ReadOnly Huge: 0x0000000111680038 - 0x00000001118a2760
  
Heap chunks: E=eden, S=survivor, O=old, F=free; A=aligned chunk, U=unaligned chunk; T=to space

@lewurm
Copy link
Member

lewurm commented Jul 10, 2024

Thanks for the report @credmond. We saw this internally already at some point (GR-54756), but wasn't considered "important" yet.

Thanks for the concise reproducer, I'll have a look.

@lewurm lewurm assigned lewurm and unassigned oubidar-Abderrahim Jul 10, 2024
@lewurm
Copy link
Member

lewurm commented Jul 10, 2024

Proposed fix: #9285

@lewurm
Copy link
Member

lewurm commented Jul 22, 2024

@credmond would you mind giving it another shot with a newer build? https://github.com/graalvm/graalvm-ce-dev-builds/releases

@credmond
Copy link
Author

@lewurm
Copy link
Member

lewurm commented Jul 30, 2024

Thanks a lot!

@lewurm lewurm closed this as completed Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants