JDK-6946559 : AWTToolKit thread crashes in JNU_GetEnv
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6u18
  • Priority: P2
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp
  • CPU: x86
  • Submitted: 2010-04-23
  • Updated: 2014-05-07
  • Resolved: 2010-05-25
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
6u21 b05Fixed 7Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
There're lots of recent reports in the Microsoft's winqual website (https://winqual.microsoft.com/) reporting about this crash.

I download 2 cab files, each of which contains a mini dmp file and both dmp files have similar thread stack when using windbg to analyze them.

024ffe88 6d0b03f1 00000000 00010002 025a85c8 java!JNU_GetEnv+0x9 [c:\build_area\jdk6_18\j2se\src\share\native\common\jni_util.c @ 897]
024ffe98 6d0ae29c 00000000 00000000 024fff08 awt!D3DPipelineManager::NotifyAdapterEventListeners+0x11 [c:\build_area\jdk6_18\j2se\src\windows\native\sun\java2d\d3d\d3dpipelinemanager.cpp @ 165]
024ffeac 6d0ae34a 024fff08 025a85c8 00000001 awt!D3DContext::ReleaseDefPoolResources+0x3c [c:\build_area\jdk6_18\j2se\src\windows\native\sun\java2d\d3d\d3dcontext.cpp @ 243]
024ffebc 6d0ae44e 025a85c8 6d0635f2 88760868 awt!D3DContext::ReleaseContextResources+0xa [c:\build_area\jdk6_18\j2se\src\windows\native\sun\java2d\d3d\d3dcontext.cpp @ 278]
024ffec4 6d0635f2 88760868 00000000 6d0aef57 awt!D3DContext::~D3DContext+0xe [c:\build_area\jdk6_18\j2se\src\windows\native\sun\java2d\d3d\d3dcontext.cpp @ 304]
024ffed0 6d0aef57 00000001 00000000 0044ef28 awt!D3DContext::`vector deleting destructor'+0x42
024ffee0 6d0b0e26 025307e0 00000000 024fff08 awt!D3DContext::CreateInstance+0x47 [c:\build_area\jdk6_18\j2se\src\windows\native\sun\java2d\d3d\d3dcontext.cpp @ 190]
024fff00 6d0b1021 025a85c8 024fff14 025a6e64 awt!D3DPipelineManager::GetD3DContext+0x66 [c:\build_area\jdk6_18\j2se\src\windows\native\sun\java2d\d3d\d3dpipelinemanager.cpp @ 902]
024fff14 6d09a1c7 025a6e64 6d102b18 025a6e6c awt!D3DInitializer::D3DAdapterInitializer::InitImpl+0x31 [c:\build_area\jdk6_18\j2se\src\windows\native\sun\java2d\d3d\d3dpipelinemanager.cpp @ 976]
024fff30 6d09b8dd 00000000 0044e488 0044e3f0 awt!AwtToolkit::PreloadAction::Init+0x47 [c:\build_area\jdk6_18\j2se\src\windows\native\sun\windows\awt_toolkit.cpp @ 1793]
024fff50 6d09c749 7c349565 6d102b18 00000000 awt!AwtToolkit::PreloadThread::ThreadProc+0x6d [c:\build_area\jdk6_18\j2se\src\windows\native\sun\windows\awt_toolkit.cpp @ 1933]
024fff54 7c349565 6d102b18 00000000 00000000 awt!AwtToolkit::PreloadThread::StaticThreadProc+0x9 [c:\build_area\jdk6_18\j2se\src\windows\native\sun\windows\awt_toolkit.cpp @ 1909]
024fff88 76723677 0044e3f0 024fffd4 77dd9d72 msvcr71!_threadstartex+0x6f [f:\vs70builds\3052\vc\crtbld\crt\src\threadex.c @ 241]
024fff94 77dd9d72 0044e3f0 75a92aae 00000000 kernel32!BaseThreadInitThunk+0xe
024fffd4 77dd9d45 7c3494f6 0044e3f0 00000000 ntdll!__RtlUserThreadStart+0x70
024fffec 00000000 7c3494f6 0044e3f0 00000000 ntdll!_RtlUserThreadStart+0x1b

Attached the 2 cab files and the output from windbg from my debug session on analyzing a dmp file.

The crash occurred with JRE 6u18 b07.

EVALUATION http://hg.openjdk.java.net/jdk7/build/jdk/rev/1f45c4c1f3a7

EVALUATION On some d3d failures (when failure occurs on late initialization steps) D3DContext dtor sents notification to java about object disposals. If the failure accurs before JMV initialization completes, it causes crash (due jvm is not exists yet) To fix the issue: 1. set initial NULL value for jvm variable (see src/windows/native/sun/windows/awt_Toolkit.cpp, line 78) 2. before notification tests if jmv is NULL (D3DPipelineManager::NotifyAdapterEventListeners method, src/windows/native/sun/java2d/d3d/D3DPipelineManager.cpp, lines 159..176) and don't sent the notification if jmv is not set yet Unfortunately it's hard to reproduce the issue for appropriate testing.

EVALUATION Further investigation showed that the problem was caused by optimization of D3D loading. I am assigning the CR to the proper engineer.

EVALUATION The first idea is that it is a J2D issue. I am trying to investigate it deeper.