Community
Participate
Working Groups
Created attachment 284649 [details] JDK output on start and close of Eclipse, with -Xcheck:jni VM argument. We see the following warnings when running Eclipse with -Xcheck:jni VM argument: WARNING in native method: JNI call made without checking exceptions when required to from CallStaticLongMethodV at org.eclipse.swt.internal.gtk.GTK.gtk_widget_destroy(Native Method) at org.eclipse.swt.widgets.Widget.destroyWidget(Widget.java:497) at org.eclipse.swt.widgets.Widget.release(Widget.java:1254) at org.eclipse.swt.widgets.Control.release(Control.java:4658) at org.eclipse.swt.widgets.Widget.dispose(Widget.java:533) ... To reproduce, add -Xcheck:jni to eclipse.ini, start Eclipse in a new workspace (from the command line, to see the JDK output), then close it. Example output is attached, see "eclipse_checkjni_output.txt". Seen with: Eclipse SDK Version: 2020-12 (4.18) Build id: I20201103-0030 RHEL 7.4 GTK 3.22.30
Thanks for CC'ing me. To my knowledge, this means that some native method (probably in callback.c) invoked a java method via 'CallStaticLongMethodV' and didn't check for exceptions via JNI 'ExceptionOccurred()' or a similar JNI API after that. The risk here is that native method will take return value as genuine return, not understanding that java method actually thrown an exception and didn't return anything. I will be able to look into it next week, but please feel free to do it yourself :) I have quite a few things to do at the moment. Still, please keep CC'ing me to other findings!
Please CC me via @syntevo.com box. Replacing the wrong CC here.
When running org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting with -Xcheck:jni, I see the same warning, plus the other warning we see in our product tests, plus some more: Warning: SIGINT handler expected:libjvm.so+0x938680 found:0x0000000000000001 Running in non-interactive shell, SIGINT handler is replaced by shell Signal Handlers: SIGSEGV: [libjvm.so+0x9385c0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGBUS: [libjvm.so+0x9385c0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGFPE: [libjvm.so+0x9385c0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGPIPE: [libjvm.so+0x9385c0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGXFSZ: [libjvm.so+0x9385c0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGILL: [libjvm.so+0x9385c0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGUSR1: SIG_DFL, sa_mask[0]=00000000000000000000000000000000, sa_flags=none SIGUSR2: [libjvm.so+0x938470], sa_mask[0]=00100000000000000000000000000000, sa_flags=SA_RESTART|SA_SIGINFO SIGHUP: [libjvm.so+0x938680], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGINT: SIG_IGN, sa_mask[0]=00000000000000000000000000000000, sa_flags=none SIGTERM: [libjvm.so+0x938680], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGQUIT: [libjvm.so+0x938680], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO Warning: SIGPIPE handler expected:libjvm.so+0x9385c0 found:0x0000000000000001 Signal Handlers: SIGSEGV: [libjvm.so+0x9385c0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGBUS: [libjvm.so+0x9385c0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGFPE: [libjvm.so+0x9385c0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGPIPE: SIG_IGN, sa_mask[0]=00000000000010000000000000000000, sa_flags=SA_RESTART SIGXFSZ: [libjvm.so+0x9385c0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGILL: [libjvm.so+0x9385c0], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGUSR1: SIG_DFL, sa_mask[0]=00000000000000000000000000000000, sa_flags=none SIGUSR2: [libjvm.so+0x938470], sa_mask[0]=00100000000000000000000000000000, sa_flags=SA_RESTART|SA_SIGINFO SIGHUP: [libjvm.so+0x938680], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGINT: SIG_IGN, sa_mask[0]=00000000000000000000000000000000, sa_flags=none SIGTERM: [libjvm.so+0x938680], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO SIGQUIT: [libjvm.so+0x938680], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO WARNING in native method: JNI call made without checking exceptions when required to from CallStaticLongMethodV at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4495) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.waitForClose(Bug528251_CTabFolder_nested_highlighting.java:91) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.showCase(Bug528251_CTabFolder_nested_highlighting.java:86) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.main(Bug528251_CTabFolder_nested_highlighting.java:110) WARNING in native method: JNI call made without checking exceptions when required to from CallStaticLongMethodV at org.eclipse.swt.internal.gtk.GTK.gtk_widget_get_allocation(Native Method) at org.eclipse.swt.widgets.Control.getSizeInPixels(Control.java:1355) at org.eclipse.swt.widgets.Control.getSize(Control.java:1348) at org.eclipse.swt.custom.CTabFolder.getClientArea(CTabFolder.java:873) at org.eclipse.swt.custom.CTabFolder.runUpdate(CTabFolder.java:3891) at org.eclipse.swt.custom.CTabFolder.lambda$3(CTabFolder.java:3882) at org.eclipse.swt.custom.CTabFolder$$Lambda$13/1323165413.run(Unknown Source) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:185) - locked <0x00000005806f87f0> (a org.eclipse.swt.widgets.RunnableLock) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4994) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4500) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.waitForClose(Bug528251_CTabFolder_nested_highlighting.java:91) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.showCase(Bug528251_CTabFolder_nested_highlighting.java:86) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.main(Bug528251_CTabFolder_nested_highlighting.java:110) WARNING in native method: JNI call made without checking exceptions when required to from CallStaticLongMethodV at org.eclipse.swt.internal.gtk.OS.g_object_unref(Native Method) at org.eclipse.swt.accessibility.AccessibleObject.release(AccessibleObject.java:4624) at org.eclipse.swt.accessibility.Accessible.release(Accessible.java:574) at org.eclipse.swt.accessibility.Accessible.internal_dispose_Accessible(Accessible.java:538) at org.eclipse.swt.widgets.Control.releaseWidget(Control.java:4842) at org.eclipse.swt.widgets.Composite.releaseWidget(Composite.java:1555) at org.eclipse.swt.widgets.Widget.release(Widget.java:1260) at org.eclipse.swt.widgets.Control.release(Control.java:4789) at org.eclipse.swt.widgets.Composite.releaseChildren(Composite.java:1541) at org.eclipse.swt.widgets.Canvas.releaseChildren(Canvas.java:279) at org.eclipse.swt.widgets.Decorations.releaseChildren(Decorations.java:486) at org.eclipse.swt.widgets.Shell.releaseChildren(Shell.java:3263) at org.eclipse.swt.widgets.Widget.release(Widget.java:1251) at org.eclipse.swt.widgets.Control.release(Control.java:4789) at org.eclipse.swt.widgets.Widget.dispose(Widget.java:533) at org.eclipse.swt.widgets.Shell.dispose(Shell.java:3180) at org.eclipse.swt.widgets.Shell.closeWidget(Shell.java:689) at org.eclipse.swt.widgets.Shell.gtk_delete_event(Shell.java:1492) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2285) at org.eclipse.swt.widgets.Control.windowProc(Control.java:6888) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5995) at org.eclipse.swt.internal.gtk.GTK.gtk_main_do_event(Native Method) at org.eclipse.swt.widgets.Display.eventProc(Display.java:1519) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4495) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.waitForClose(Bug528251_CTabFolder_nested_highlighting.java:91) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.showCase(Bug528251_CTabFolder_nested_highlighting.java:86) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.main(Bug528251_CTabFolder_nested_highlighting.java:110) WARNING in native method: JNI call made without checking exceptions when required to from CallStaticLongMethodV at org.eclipse.swt.internal.gtk.GTK.gtk_widget_destroy(Native Method) at org.eclipse.swt.widgets.Widget.destroyWidget(Widget.java:497) at org.eclipse.swt.widgets.Widget.release(Widget.java:1258) at org.eclipse.swt.widgets.Control.release(Control.java:4789) at org.eclipse.swt.widgets.Widget.dispose(Widget.java:533) at org.eclipse.swt.widgets.Shell.dispose(Shell.java:3180) at org.eclipse.swt.widgets.Shell.closeWidget(Shell.java:689) at org.eclipse.swt.widgets.Shell.gtk_delete_event(Shell.java:1492) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2285) at org.eclipse.swt.widgets.Control.windowProc(Control.java:6888) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5995) at org.eclipse.swt.internal.gtk.GTK.gtk_main_do_event(Native Method) at org.eclipse.swt.widgets.Display.eventProc(Display.java:1519) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4495) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.waitForClose(Bug528251_CTabFolder_nested_highlighting.java:91) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.showCase(Bug528251_CTabFolder_nested_highlighting.java:86) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.main(Bug528251_CTabFolder_nested_highlighting.java:110) WARNING in native method: JNI call made without checking exceptions when required to from CallStaticLongMethodV at org.eclipse.swt.internal.gtk.GTK.gtk_widget_destroy(Native Method) at org.eclipse.swt.widgets.Widget.destroyWidget(Widget.java:497) at org.eclipse.swt.widgets.Widget.release(Widget.java:1258) at org.eclipse.swt.widgets.Control.release(Control.java:4789) at org.eclipse.swt.widgets.Widget.dispose(Widget.java:533) at org.eclipse.swt.widgets.Shell.dispose(Shell.java:3180) at org.eclipse.swt.widgets.Shell.closeWidget(Shell.java:689) at org.eclipse.swt.widgets.Shell.gtk_delete_event(Shell.java:1492) at org.eclipse.swt.widgets.Widget.windowProc(Widget.java:2285) at org.eclipse.swt.widgets.Control.windowProc(Control.java:6888) at org.eclipse.swt.widgets.Display.windowProc(Display.java:5995) at org.eclipse.swt.internal.gtk.GTK.gtk_main_do_event(Native Method) at org.eclipse.swt.widgets.Display.eventProc(Display.java:1519) at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4495) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.waitForClose(Bug528251_CTabFolder_nested_highlighting.java:91) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.showCase(Bug528251_CTabFolder_nested_highlighting.java:86) at org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting.main(Bug528251_CTabFolder_nested_highlighting.java:110) Andrey do we want extra tickets for each one, or is this ticket enough (if so I'll adjust the title)?
(In reply to Simeon Andreev from comment #3) > When running > org.eclipse.swt.tests.manual.Bug528251_CTabFolder_nested_highlighting with > -Xcheck:jni, I see the same warning, plus the other warning we see in our > product tests, plus some more: > ... > Andrey do we want extra tickets for each one, or is this ticket enough (if > so I'll adjust the title)? Let keep it simple, all the changes will be anyway in same component / same people looking at it, so please update the title.
Another 2 we see: WARNING: JNI local refs: 33, exceeds capacity: 32 at org.eclipse.swt.internal.gtk.GTK.gtk_widget_destroy(Native Method) at org.eclipse.swt.widgets.Widget.destroyWidget(Widget.java:494) at org.eclipse.swt.widgets.Widget.release(Widget.java:1250) at org.eclipse.swt.widgets.Control.release(Control.java:4573) at org.eclipse.swt.widgets.Widget.dispose(Widget.java:529) at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.disposeWidget(SWTPartRenderer.java:174) at org.eclipse.e4.ui.workbench.renderers.swt.ContributedPartRenderer.disposeWidget(ContributedPartRenderer.java:273) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeRemoveGui(PartRenderingEngine.java:945) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$1(PartRenderingEngine.java:873) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:868) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.removeGui(PartRenderingEngine.java:852) at org.eclipse.e4.ui.workbench.renderers.swt.ElementReferenceRenderer.disposeWidget(ElementReferenceRenderer.java:115) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.safeRemoveGui(PartRenderingEngine.java:945) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.access$1(PartRenderingEngine.java:873) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$4.run(PartRenderingEngine.java:868) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.removeGui(PartRenderingEngine.java:852) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.subscribeTopicToBeRendered(PartRenderingEngine.java:187) at jdk.internal.reflect.GeneratedMethodAccessor90.invoke(Unknown Source) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@11.0.8/DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(java.base@11.0.8/Method.java:566) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:58) at org.eclipse.e4.core.di.internal.extensions.EventObjectSupplier$DIEventHandler.handleEvent(EventObjectSupplier.java:92) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:205) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:203) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:1) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:151) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:132) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:75) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:44) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:55) at org.eclipse.e4.ui.internal.workbench.UIEventPublisher.notifyChanged(UIEventPublisher.java:63) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:424) at org.eclipse.e4.ui.model.application.ui.impl.UIElementImpl.setToBeRendered(UIElementImpl.java:314) at org.eclipse.e4.ui.internal.workbench.PartServiceImpl.hidePart(PartServiceImpl.java:1406) at org.eclipse.ui.internal.WorkbenchPage.hidePart(WorkbenchPage.java:1537) at org.eclipse.ui.internal.WorkbenchPage.hidePart(WorkbenchPage.java:1496) at org.eclipse.ui.internal.WorkbenchPage.hideView(WorkbenchPage.java:2597) WARNING in native method: JNI call made without checking exceptions when required to from CallStaticLongMethodV at org.eclipse.swt.internal.gtk.GTK.gtk_clipboard_wait_for_contents(Native Method) (will have to reproduce the clipboard one, its seen during one of our many test plug-ins and I didn't store the full stack trace)
New Gerrit change created: https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/174752
The first patch probably fixes all 'GTK.gtk_widget_destroy' problems. There's also a chance that all other problems are now fixed too. If this is not the case, please provide specific steps to reproduce.
(In reply to Alexandr Miloslavskiy from comment #7) > The first patch probably fixes all 'GTK.gtk_widget_destroy' problems. > There's also a chance that all other problems are now fixed too. If this is > not the case, please provide specific steps to reproduce. We'll be able to test with our product tests (should be extensive enough to know if its gone), once the change is merged. Would also be possible without merging the change, but I'm not sure if we'll have time for that (we have more or less streamlined running our tests with recent Eclipse builds as platform).
That's fine. Please review the change and let's merge it.
Just found a nice article about common JNI issues: https://developer.ibm.com/languages/java/articles/j-jni/
Gerrit change https://git.eclipse.org/r/c/platform/eclipse.platform.swt/+/174752 was merged to [master]. Commit: http://git.eclipse.org/c/platform/eclipse.platform.swt.git/commit/?id=6f48e1bc8d88d3242c1244531d8ce6ee757b61fd
Thanks for a quick review!
(In reply to Alexandr Miloslavskiy from comment #12) > Thanks for a quick review! Thanks for the patch! Could you please take a look at bug 570238? We see a native memory leak if running Progress view, with constant tasks scheduling we observe memory leaking with ~1GB/hour speed.
Soon (tm)
(In reply to Alexandr Miloslavskiy from comment #7) > The first patch probably fixes all 'GTK.gtk_widget_destroy' problems. > There's also a chance that all other problems are now fixed too. If this is > not the case, please provide specific steps to reproduce. Those warnings are still shown on IDE startup (starting Eclipse feom Eclipse): WARNING: JNI local refs: 33, exceeds capacity: 32 Had no time yet to narrow down what causes that.
(In reply to Andrey Loskutov from comment #10) > Just found a nice article about common JNI issues: > https://developer.ibm.com/languages/java/articles/j-jni/ Thanks for the article! I did a quick analysis and it seems that SWT is mostly good now: * Article: Recommends caching FindClass(), GetFieldID(), GetMethodId(), GetStaticMethodID() 'callback()' already does that. 'call_accessible_object_function()' doesn't. * Article: Recommends accessing only part of array with GetTypeArrayRegion() / SetTypeArrayRegion() I can't quickly remember any arrays for which SWT could JNI-access them partially. * Article: Recommends to pass more arguments instead of accessing fields like 'GetIntField()' I think that SWT only uses methods like 'GetIntField()' when converting Java structs to native and vice versa. * Article: Recommends to minimize transitions between native and Java Doesn't apply to SWT due to its design of thin API wrappers. * Article: Recommends to properly handle local references This is actually interesting, I'll keep that in mind. On Windows, when I run our product with '-Xcheck:jni', I see a number of warnings about exceeding local refs count. But all of these warnings occur outside SWT. * Article: Warns against using the wrong JNIEnv SWT already requests 'JNIEnv' each time. * Article: Warns against not checking for exceptions That's what I fixed, with the idea that exceptions should not occur. * Article: Warns against not checking return values SWT seems to check return values correctly. * Article: Reminds to use 'ReleaseXXX()' methods after 'GetXXXArrayElements()' SWT does it correctly, JniGenerator takes care about it. * Article: Warns against blocking between 'GetXXXCritical()' and 'ReleaseXXXCritical()' SWT uses 'flags=critical' only for select functions. * Article: Reminds to delete global references I glanced at every use of 'NewGlobalRef()' and all of them seem to have a matching 'DeleteGlobalRef()'
On Linux, I can see the followign warnign when starting Eclipse: JNI local refs: 637, exceeds capacity: 32 However, it only happens when starting it from debugger (I'm using IDEA), and the stack is: ---- #0 outputStream::print_cr (this=0x7ffff0000b60, format=format@entry=0x7ffff7a10b40 "WARNING: JNI local refs: %lu, exceeds capacity: %lu") at ./src/hotspot/share/utilities/ostream.cpp:151 #1 0x00007ffff73ac5da in functionExit (thr=0x7ffff0022000) at ./src/hotspot/share/prims/jniCheck.cpp:243 #2 checked_jni_GetJavaVM (env=<optimized out>, vm=<optimized out>) at ./src/hotspot/share/prims/jniCheck.cpp:1821 #3 0x00007ffff66204d8 in loadTransport (info=0x7ffff02fe980, name=0x7ffff0015580 "dt_socket") at ./src/jdk.jdwp.agent/share/native/libjdwp/transport.c:218 #4 transport_startTransport (isServer=<optimized out>, name=0x7ffff0015580 "dt_socket", address=0x7ffff001558a "127.0.0.1:51695", timeout=0, allowed_peers=0x0) at ./src/jdk.jdwp.agent/share/native/libjdwp/transport.c:485 #5 0x00007ffff660a12b in startTransport (item=0x7ffff0014a50, arg=0x7ffff677ca78) at ./src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:570 #6 0x00007ffff66085a1 in bagEnumerateOver (theBag=<optimized out>, func=func@entry=0x7ffff660a0e0 <startTransport>, arg=arg@entry=0x7ffff677ca78) at ./src/jdk.jdwp.agent/share/native/libjdwp/bag.c:154 #7 0x00007ffff660aa58 in initialize (env=env@entry=0x7ffff0022340, thread=thread@entry=0x7ffff0295ff0, triggering_ei=triggering_ei@entry=EI_VM_INIT) at ./src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:725 #8 0x00007ffff660b540 in cbEarlyVMInit (jvmti_env=<optimized out>, env=0x7ffff0022340, thread=0x7ffff0295ff0) at ./src/jdk.jdwp.agent/share/native/libjdwp/debugInit.c:442 #9 0x00007ffff74a690e in JvmtiExport::post_vm_initialized () at ./src/hotspot/share/prims/jvmtiEnvBase.hpp:231 #10 0x00007ffff78e1b48 in Threads::create_vm (args=<optimized out>, canTryAgain=canTryAgain@entry=0x7ffff677cdd7) at ./src/hotspot/share/runtime/thread.cpp:3969 #11 0x00007ffff73a26d5 in JNI_CreateJavaVM_inner (args=<optimized out>, penv=0x7ffff677ce88, vm=0x7ffff677ce80) at ./src/hotspot/share/prims/jni.cpp:3961 #12 JNI_CreateJavaVM (vm=0x7ffff677ce80, penv=0x7ffff677ce88, args=<optimized out>) at ./src/hotspot/share/prims/jni.cpp:4052 #13 0x00007ffff7fb8daf in InitializeJVM (ifn=<synthetic pointer>, penv=0x7ffff677ce88, pvm=0x7ffff677ce80) at ./src/java.base/share/native/libjli/java.c:1527 #14 JavaMain (_args=<optimized out>) at ./src/java.base/share/native/libjli/java.c:414 #15 0x00007ffff7fbdce1 in call_continuation (_args=<optimized out>) at ./src/java.base/unix/native/libjli/java_md_solinux.c:739 #16 0x00007ffff7d73609 in start_thread (arg=<optimized out>) at pthread_create.c:477 #17 0x00007ffff7ed1293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95 ---- Here, 'jdk.jdwp.agent' seems to be guilty. It's related to '-agentlib:jdwp=' in JVM options used by debugger.
I encounter the following in my logs: CRITICAL **: 07:29:13.031: JNI class pointer is NULL for class org/eclipse/swt/accessibility/AccessibleObject this might be related to Bug 563392 as it is printed just before the CNF exception occurs.
Could you please narrow this problem to a test snippet?
I could try to create a test-case but don't expect it to be a snippet ;-) It seems only to happen in a E4 App where I use a Splashscreen so a litte bit more context seems to be required.. I enabled the Xcheck:jni maybe this stacktraces already help a bit? CRITICAL **: 10:56:06.289: JNI class pointer is NULL for class org/eclipse/swt/accessibility/AccessibleObject WARNING in native method: JNI call made with exception pending at org.eclipse.equinox.launcher.JNIBridge._takedown_splash(Native Method) at org.eclipse.equinox.launcher.JNIBridge.takeDownSplash(JNIBridge.java:173) at org.eclipse.equinox.launcher.Main.takeDownSplash(Main.java:2170) at org.eclipse.equinox.launcher.Main$SplashHandler.run(Main.java:122) at org.eclipse.core.runtime.internal.adaptor.DefaultStartupMonitor.applicationRunning(DefaultStartupMonitor.java:71) at org.eclipse.equinox.internal.app.EclipseAppHandle$1.run(EclipseAppHandle.java:279) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.equinox.internal.app.EclipseAppHandle.applicationRunning(EclipseAppHandle.java:267) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1092) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:166) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@11.0.9/Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@11.0.9/NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@11.0.9/DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(java.base@11.0.9/Method.java:566) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590) at org.eclipse.equinox.launcher.Main.run(Main.java:1461) at org.eclipse.equinox.launcher.Main.main(Main.java:1434) CRITICAL **: 10:56:06.289: JNI class pointer is NULL for class org/eclipse/swt/accessibility/AccessibleObject !ENTRY org.eclipse.equinox.app 4 2 2021-03-07 10:56:06.290 !MESSAGE Problems occurred when invoking code from plug-in: "org.eclipse.equinox.app". !STACK 0 java.lang.NoClassDefFoundError: org/eclipse/swt/accessibility/AccessibleObject at org.eclipse.equinox.launcher.JNIBridge._takedown_splash(Native Method) at org.eclipse.equinox.launcher.JNIBridge.takeDownSplash(JNIBridge.java:173) at org.eclipse.equinox.launcher.Main.takeDownSplash(Main.java:2170) at org.eclipse.equinox.launcher.Main$SplashHandler.run(Main.java:122) at org.eclipse.core.runtime.internal.adaptor.DefaultStartupMonitor.applicationRunning(DefaultStartupMonitor.java:71) at org.eclipse.equinox.internal.app.EclipseAppHandle$1.run(EclipseAppHandle.java:279) at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45) at org.eclipse.equinox.internal.app.EclipseAppHandle.applicationRunning(EclipseAppHandle.java:267) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1092) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:166) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590) at org.eclipse.equinox.launcher.Main.run(Main.java:1461) at org.eclipse.equinox.launcher.Main.main(Main.java:1434) Caused by: java.lang.ClassNotFoundException: org.eclipse.swt.accessibility.AccessibleObject at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:581) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ... 26 more WARNING in native method: JNI call made without checking exceptions when required to from CallStaticLongMethodV at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4524) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1157) at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338) at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046) at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155) at org.eclipse.e4.ui.internal.workbench.swt.E4Application.start(E4Application.java:166) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134) at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(java.base@11.0.9/Native Method) at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(java.base@11.0.9/NativeMethodAccessorImpl.java:62) at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(java.base@11.0.9/DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(java.base@11.0.9/Method.java:566) at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653) at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590) at org.eclipse.equinox.launcher.Main.run(Main.java:1461) at org.eclipse.equinox.launcher.Main.main(Main.java:1434)
This part is very suspicious to me: java.lang.NoClassDefFoundError: org/eclipse/swt/accessibility/AccessibleObject Is it really related to -XCheck:jni ?
Nope but I see these warnings / error also without -Xcheck:jni but I think it could give some good hints that there is something going wrong in the native code.
When core class is not found, the rest is not really interesting. Obviously this is a big problem and shouldn't happen.
See Bug 563392 the application is working and slash is displayed fine beside the CNF I see no consequences/malfunction. So my supicion is that the CNF is more a side-effect of not proper exception checks that the cause. e.g in maybe NoClassDefFoundError is actually raised because of a classloader incompatibility? (I have no idea why AccessibleObject is actually used by _takedown_splash anyways...)
Hopefully someone else will help you here. My scope is only limited to SWT issues.
(In reply to Christoph Laeubrich from comment #24) > See Bug 563392 the application is working and slash is displayed fine beside > the CNF I see no consequences/malfunction. So my supicion is that the CNF is > more a side-effect of not proper exception checks that the cause. > > e.g in maybe NoClassDefFoundError is actually raised because of a > classloader incompatibility? (I have no idea why AccessibleObject is > actually used by _takedown_splash anyways...) Please do not hijack this bug with bug 563392. The warning you get is not because of JNI issue - how JNI should work if classes can't be found? I would assume a problem with e4 application dependencies / configuration in bug 563392.
(In reply to Andrey Loskutov from comment #26) > Please do not hijack this bug with bug 563392. > The warning you get is not because of JNI issue - how JNI should work if > classes can't be found? I would assume a problem with e4 application > dependencies / configuration in bug 563392. As described above the application works fine and from the stack trace / JNI output one can clearly see that the native code is not checking for exception properly so it is clearly related here. I don't expect that this solves the referenced bug but as long as the native code behaves wrong its hard to diagnose the real root cause for this.
Just another one: WARNING in native method: JNI call made without checking exceptions when required to from CallStaticLongMethodV at org.eclipse.swt.internal.gtk.OS.g_main_context_iteration(Native Method) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:4524)
This is closer to the scope of this Bug. How do you reproduce this problem? Can you make a snippet?