Hi, AWT & HotSpot teams,

I've just experienced a problem with a simple test - see the attached file. The test shows a file dialog and then hangs when the dialog is being disposed. I tried to get a stack trace... and failed, both with jstack and ctrl+break from the console.

When I attached to the process with Visual Studio, I noticed several suspicious threads:

1. One of the threads with AWT code waits for safe_Malloc() to return, which in turn waits for JVM code in Monitor::set_owner_implementation():

 ntdll.dll!_zwwaitforsingleobj...@12()
 ntdll.dll!_zwwaitforsingleobj...@12()
jvm.dll!Monitor::set_owner_implementation(Thread * new_owner=0x00000000) Line 1307
 ntdll.dll!_rtlentercriticalsect...@4()
 ntdll.d...@rtlpallocateheap@24()
 ntdll.dll!_rtlallocateh...@12()
 msvcr90.dll!75293db8()         
[Frames below may be incorrect and/or missing, no symbols loaded for msvcr90.dll]
 awt.dll!safe_Malloc(unsigned int size=6)  Line 85
awt.dll!CreateLocaleObject(JNIEnv_ * env=0x04601d34, const char * name=0x002a1e58) Line 539 awt.dll!Java_sun_awt_windows_WInputMethod_getNativeLocale(JNIEnv_ * env=0x04601d34, _jclass * cls=0x065bf728) Line 299


2. Another thread is in os::free():

 ntdll.dll!_zwwaitforsingleobj...@12()
 ntdll.dll!_zwwaitforsingleobj...@12()
 kernelbase.dll!_getprocaddr...@8()
 ntdll.dll!_rtlentercriticalsect...@4()
 ntdll.d...@rtlpfreeheap@16()
 ntdll.dll!_rtlfreeh...@12()
 kernel32.dll!_heapf...@12()
 msvcr90.dll!75293c1b()         
[Frames below may be incorrect and/or missing, no symbols loaded for msvcr90.dll]
 jvm.dll!os::free(void * memblock=0x01f64d50)  Line 602
 jvm.dll!ChunkPool::free_all_but(unsigned int n=5)  Line 152
 jvm.dll!ChunkPoolCleaner::task()  Line 195
 jvm.dll!PeriodicTask::real_time_tick(unsigned int delay_time=50)  Line 60
 jvm.dll!WatcherThread::run()  Line 1086
 jvm.dll!java_start(Thread * thread=0x01f5c800)  Line 377


3. One more thread waiting for a memory-related operation - I suspect it's the thread that should provide the stack trace:

 ntdll.dll!_zwwaitforsingleobj...@12()
 ntdll.dll!_zwwaitforsingleobj...@12()
jvm.dll!InterfaceSupport::serialize_memory(JavaThread * thread=0x00000148) Line 37
 kernel32.dll!_waitforsingleobjecteximplementat...@12()
 kernel32.dll!_waitforsingleobj...@8()
 jvm.dll!Win32AttachListener::dequeue()  Line 233
 jvm.dll!AttachListener::dequeue()  Line 353
jvm.dll!attach_listener_thread_entry(JavaThread * thread=0x01f4d800, Thread * __the_thread__=0x01f4d800) Line 376
 jvm.dll!JavaThread::thread_main_inner()  Line 1402
 jvm.dll!java_start(Thread * thread=0x01f4d800)  Line 377


Any ideas about what's going? The hang only occurs if I build JDK and HotSpot using VS2008 - exactly the same JDK7-b99 promoted build (which is built with VS2003) works fine. If I change the file dialog with a regular AWT modal dialog, the problem goes away as well.

Thanks,

Artem
import java.awt.*;

public class Test {

  public static void main(String[] args) throws Exception {
    final Frame f = new Frame("F");
    final FileDialog fd = new FileDialog(f);
//    final Dialog fd = new Dialog(f, true);
    new Thread(new Runnable() {
      public void run() {
        fd.setVisible(true);
      }
    }).start();
    Thread.sleep(3000);
    System.err.println("before dispose");
    System.err.flush();
    fd.dispose();
    System.err.println("after dispose");
    System.err.flush();
    new Thread(new Runnable() {
      public void run() {
        System.err.println("run");
        System.err.flush();
      }
    }).start();
    System.err.println("thread started");
    System.err.flush();
    f.dispose();
  }

}

Reply via email to