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

Freeing resources on the Cleaner thread might cause issues w/ e.g. OpenGL #130

Open
tonsky opened this issue Sep 15, 2021 · 6 comments
Open

Comments

@tonsky
Copy link
Collaborator

tonsky commented Sep 15, 2021

Current thread (0x00007f13e8004190):  JavaThread "Cleaner-0" daemon [_thread_in_native, id=40186, stack(0x00007f143a3fc000,0x00007f143a4fd000)]

Stack: [0x00007f143a3fc000,0x00007f143a4fd000],  sp=0x00007f143a4fb798,  free space=1021k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libGLdispatch.so.0+0x4a529]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 8681  org.jetbrains.skija.impl.Managed._nInvokeFinalizer(JJ)V (0 bytes) @ 0x00007f15558528ec [0x00007f15558528a0+0x000000000000004c]
J 15477 c2 org.jetbrains.skija.impl.Managed$CleanerThunk.run()V (31 bytes) @ 0x00007f1555edbf78 [0x00007f1555edbf20+0x0000000000000058]
J 17362 c2 jdk.internal.ref.PhantomCleanable.clean()V java.base@17 (16 bytes) @ 0x00007f155646e2a0 [0x00007f155646e040+0x0000000000000260]
j  jdk.internal.ref.CleanerImpl.run()V+57 java.base@17
j  java.lang.Thread.run()V+11 java.base@17
j  jdk.internal.misc.InnocuousThread.run()V+20 java.base@17
v  ~StubRoutines::call_stub
@vladimir-koshelev
Copy link

The last dispose before the crash: 2021-09-16T21:00:01.932797401Z [TRACE] Cleaning DirectContext 7f6200672af0

@tonsky
Copy link
Collaborator Author

tonsky commented Sep 16, 2021

@vedun-z Does closing DirectContext explicitly solves the issue?

@tonsky
Copy link
Collaborator Author

tonsky commented Sep 20, 2021

Solution: remove finalizer cleaning from “GL-related” resource like Context, make user free them explicitly. Maybe print a warning if not

@vladimir-koshelev
Copy link

Now it's started crashing with:

---------------  T H R E A D  ---------------

Current thread (0x00007f20650e2000):  JavaThread "AWT-EventQueue-0 @coroutine#92" [_thread_in_native, id=37514, stack(0x00007f1eec065000,0x00007f1eec166000)]

Stack: [0x00007f1eec065000,0x00007f1eec166000],  sp=0x00007f1eec160598,  free space=1005k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libnvidia-glcore.so.470.57.02+0x1019f20]

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 16742  org.jetbrains.skia.DirectContextKt.DirectContext_nFlush(J)J (0 bytes) @ 0x00007f2059e5bb11 [0x00007f2059e5bac0+0x0000000000000051]
J 16666 c1 org.jetbrains.skiko.SkiaLayer.draw$skiko()V (147 bytes) @ 0x00007f205460bcdc [0x00007f205460adc0+0x0000000000000f1c]
J 24132 c1 org.jetbrains.skiko.redrawer.LinuxOpenGLRedrawer$Companion$frameDispatcher$1.invokeSuspend(Ljava/lang/Object;)Ljava/lang/Object; (802 bytes) @ 0x00007f2054edc13c [0x00007f2054ed8e20+0x000000000000331c]
J 6609 c2 kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(Ljava/lang/Object;)V (142 bytes) @ 0x00007f205931a0d8 [0x00007f205931a000+0x00000000000000d8]
J 24549 c2 kotlinx.coroutines.DispatchedTask.run()V (658 bytes) @ 0x00007f205a880d4c [0x00007f205a880920+0x000000000000042c]
J 19257 c2 java.awt.EventQueue$4.run()Ljava/lang/Object; java.desktop@11.0.12 (5 bytes) @ 0x00007f205a1ea234 [0x00007f205a1e9840+0x00000000000009f4]
v  ~StubRoutines::call_stub
J 8040  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;Ljava/security/AccessControlContext;)Ljava/lang/Object; java.base@11.0.12 (0 bytes) @ 0x00007f205942cb33 [0x00007f205942cac0+0x0000000000000073]
J 18832 c2 java.awt.EventQueue.dispatchEvent(Ljava/awt/AWTEvent;)V java.desktop@11.0.12 (80 bytes) @ 0x00007f205a13f6c0 [0x00007f205a13f260+0x0000000000000460]
J 21047 c2 java.awt.EventDispatchThread.pumpOneEventForFilters(I)V java.desktop@11.0.12 (113 bytes) @ 0x00007f205903bf4c [0x00007f205903bd20+0x000000000000022c]
j  java.awt.EventDispatchThread.pumpEventsForFilter(ILjava/awt/Conditional;Ljava/awt/EventFilter;)V+35 java.desktop@11.0.12
j  java.awt.EventDispatchThread.pumpEventsForHierarchy(ILjava/awt/Conditional;Ljava/awt/Component;)V+11 java.desktop@11.0.12
j  java.awt.EventDispatchThread.pumpEvents(ILjava/awt/Conditional;)V+4 java.desktop@11.0.12
j  java.awt.EventDispatchThread.pumpEvents(Ljava/awt/Conditional;)V+3 java.desktop@11.0.12
j  java.awt.EventDispatchThread.run()V+9 java.desktop@11.0.12
v  ~StubRoutines::call_stub

siginfo: si_signo: 11 (SIGSEGV), si_code: 1 (SEGV_MAPERR), si_addr: 0x0000000000000000

@tonsky
Copy link
Collaborator Author

tonsky commented Sep 22, 2021

@vedun-z what’s your environment? Hardware, software?

@tonsky
Copy link
Collaborator Author

tonsky commented Sep 22, 2021

@vedun-z Also, any chance you could share source code?

Does LWJGL example runs on your machine? Try

./examples/lwjgl/script/run.py --skija-version 0.93.4

or

./examples/jwm/script/run.py --skija-version 0.93.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants