JDK-6457572 : JVM crashes when invoking java.awt.Desktop.getDesktop().browse()
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 6,6u10
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: windows_xp,windows_vista
  • CPU: x86
  • Submitted: 2006-08-07
  • Updated: 2020-11-20
  • Resolved: 2006-10-02
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.
JDK 7
7 b02Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Relates :  
Description
SYSTEM
-------------------------------------------
Platform: PC
OS: Windows XP Build 2600 Service Pack 2
CPU:total 1 family 15, cmov, cx8, fxsr, mmx, sse, sse2
Memory: 4k page, physical 1047552k(346588k free), swap 1971936k(1468680k free)
vm_info: Java HotSpot(TM) Client VM (1.6.0-rc-b94) for windows-x86, built on Aug  3 2006 00:30:37 by "java_re" with unknown MS VC++:1310

PROBLEM
--------------------------------------------
JVM crashes when invoking java.awt.Desktop.getDesktop().browse()

DESCRIPTION
--------------------------------------------
1) run Netbeans on JDK 1.6
(http://www.netbeans.info/downloads/download.php?a=n&p=1
choose e.g. latest netbeans 6.0 build)
2) on welcome page,click on e.g. Quick Start Guide. That invokes java.awt.Desktop.browse(file:/C:/Sw/NetBeans%206.0%20M2CAN/nb6.0/docs/quickstart_jump.html) 
3) JVM crashes with attached log


full information can be found in netbeans issuezilla:
http://www.netbeans.org/issues/show_bug.cgi?id=77058



JVM crash log is attached

Comments
SUGGESTED FIX ------- awt_Desktop.cpp ------- *** - Mon Aug 28 17:03:22 2006 --- awt_Desktop.cpp Thu Aug 24 16:46:40 2006 *************** *** 8,13 **** --- 8,14 ---- #include <jni.h> #include <Windows.h> #include <shellapi.h> + #include <float.h> #ifdef __cplusplus extern "C" { #endif *************** *** 23,29 **** --- 24,33 ---- const WCHAR* uri_c = env->GetStringChars(uri_j, JNI_FALSE); const WCHAR* verb_c = env->GetStringChars(verb_j, JNI_FALSE); + // 6457572: ShellExecute possibly changes FPU control word - saving it here + unsigned oldcontrol87 = _control87(0, 0); HINSTANCE retval = ShellExecuteW(NULL, verb_c, uri_c, NULL, NULL, SW_SHOWNORMAL); + _control87(oldcontrol87, 0xffffffff); env->ReleaseStringChars(uri_j, uri_c); env->ReleaseStringChars(verb_j, verb_c);
28-08-2006

EVALUATION Looks like saving/restoring fpu control word around ShellExecute call fixes the problem. Committing this bug to Dolphin for now. Backporting to 6.0 is possible.
25-08-2006

EVALUATION It would be really better to fix it on JNI level as there may be other buggy API functions changing FPU control word.
22-08-2006

EVALUATION Could not reproduce the crash on 2 machines despite all efforts. However, what is obvious is that Desktop.browse() results in a ShellExecute call, and I found at least one mention of ShellExecute changing FPU control word: http://tolstoy.newcastle.edu.au/R/devel/06/02/4262.html
22-08-2006

EVALUATION I have looked into the attached hs_err log (and several more located in the NetBeans issuezilla) and it seems that the crash always happens in the VM code in RuntimeStub::resolve_opt_virtual_call. I have also noticed that the crash not neccessary happens in AWT/Swing code, so it looks like a VM issue or memory corruption.
09-08-2006