Hi Neil,

Am Freitag, den 09.04.2021, 12:41 +0100 schrieb Neil C Smith:
> On Thu, 8 Apr 2021 at 11:18, Neil C Smith <neilcsm...@apache.org> wrote:
> > 
> > On Wed, 7 Apr 2021 at 09:50, antonio <anto...@vieiro.net> wrote:
> > > On 07/04/2021 8:21, Matthias Bläsing wrote:
> > > > Stack: [0x00007fa41ce47000,0x00007fa41d646000],  sp=0x00007fa41d6449c0, 
> > > >  free space=8182k
> > > > Native frames: (J=compiled Java code, A=aot compiled Java code, 
> > > > j=interpreted, Vv=VM code, C=native code)
> > > > V  [libjvm.so+0x91203a]  jni_CallStaticBooleanMethodV+0x7a
> > > > C  [libjfxwebkit.so+0x5fd155]  
> > > > JNIEnv_::CallStaticBooleanMethod(_jclass*, _jmethodID*, ...)+0x85
> > > > C  [libjfxwebkit.so+0x2a0d82a]  
> > > > WTF::FileSystemImpl::makeAllDirectories(WTF::String const&)+0xda
> > > 
> > > It seems "makeAllDirectories"
> > > (https://github.com/openjdk/jfx/blob/e0ce73a3c8d82d3274bd10799b530f397a90ba60/modules/javafx.web/src/main/native/Source/WTF/wtf/java/FileSystemJava.cpp#L143)
> > > being invoked by a native thread does not use jvm->AttachCurrentThread.
> > > We'll have unexpected behaviour.
> > 
> > It's been a long while since I've looked at this (in context of JNA
> > callbacks), but I'm curious why that stack trace would suggest
> > specifically a not attached thread?  Would it not fail earlier?
> 
> To clarify that question, do the calls to GetStaticMethodID and
> FindClass before that not fail even though there's not a JNIEnv in
> scope?
> 
> Like I said, been a while, but wouldn't have thought it would get that far?

you are right and here is the mystery solver:

https://github.com/openjdk/jfx/blob/master/modules/javafx.web/src/main/native/Source/WebKitLegacy/Storage/StorageThread.cpp#L76-L87

   void StorageThread::threadEntryPoint()
   {
   #if PLATFORM(JAVA)
       WTF::AttachThreadAsDaemonToJavaEnv autoAttach;
   #endif
       ASSERT(!isMainThread());
                                                                      
       while (auto function = m_queue.waitForMessage()) {             
           AutodrainedPool pool;                                      
           (*function)();                                             
       }                                                              
   }

So indeed the thread is already attached and thus JNIEnv is rightfully
not-null.

Greetings

Matthias


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@netbeans.apache.org
For additional commands, e-mail: dev-h...@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists



Reply via email to