United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
Bug ID: JDK-6946559 AWTToolKit thread crashes in JNU_GetEnv
JDK-6946559 : AWTToolKit thread crashes in JNU_GetEnv

Details
Type:
Bug
Submit Date:
2010-04-23
Status:
Resolved
Updated Date:
2011-01-19
Project Name:
JDK
Resolved Date:
2010-05-25
Component:
client-libs
OS:
windows_xp
Sub-Component:
java.awt
CPU:
x86
Priority:
P2
Resolution:
Fixed
Affected Versions:
6u18
Fixed Versions:
6u21 (b05)

Related Reports
Backport:
Relates:
Relates:
Relates:
Relates:
Relates:

Sub Tasks

Description
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.

                                    

Comments
EVALUATION

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

Further investigation showed that the problem was caused by optimization of D3D loading. I am assigning the CR to the proper engineer.
                                     
2010-04-26
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.
                                     
2010-04-26
EVALUATION

http://hg.openjdk.java.net/jdk7/build/jdk/rev/1f45c4c1f3a7
                                     
2010-12-04



Hardware and Software, Engineered to Work Together