Last Comment Bug 325084 - Java crashes under Rosetta
: Java crashes under Rosetta
Status: RESOLVED FIXED
[camino-1.0]
: fixed1.8.0.2, fixed1.8.1
Product: Core Graveyard
Classification: Graveyard
Component: Java: OJI (show other bugs)
: 1.8 Branch
: PowerPC Mac OS X
: -- normal (vote)
: ---
Assigned To: Mark Mentovai
: Pete Zha
:
Mentors:
: 324524 331494 333009 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-01-28 16:01 PST by Mark Mentovai
Modified: 2010-10-16 14:07 PDT (History)
9 users (show)
dveditz: blocking1.8.0.2+
See Also:
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Only try existing JVMs if any had been created (2.35 KB, patch)
2006-02-05 17:42 PST, Mark Mentovai
no flags Details | Diff | Splinter Review

Description Mark Mentovai 2006-01-28 16:01:55 PST
This isn't a significantly big deal, but if it can be fixed easily, it should be.  Java doesn't work under Rosetta, but instead of gracefully accepting the fact that a JVM can't be started, we crash when we're running translated.  I don't have a good stack because, um, we're running under Rosetta.

Printed to the console:

### MRJPlugin: getPluginBundle() here. ###
### MRJPlugin: CFBundleGetBundleWithIdentifier() succeeded. ###
### MRJPlugin: CFURLGetFSRec() succeeded. ###
Java for ppc cannot run in this configuration.
Please consult documentation.

This is one option:

http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_exec_a/chapter_7_section_7.html

But it's probably better to implement a fix that will give up without crashing if a JVM can't be started.
Comment 1 Mark Mentovai 2006-02-05 17:16:36 PST
*** Bug 324524 has been marked as a duplicate of this bug. ***
Comment 2 Mark Mentovai 2006-02-05 17:41:09 PST
Here's what's happening.  On the first call to JEP's [AppletView maybeCreateJavaVM:...], the call to JNI_CreateJavaVM is failing and JEP is properly returning an error (ENOMEM).  On the next call into maybeCreateJavaVM:, JNI_GetCreatedJavaVMs returns success and indicates that one JVM is available, and gives back a JavaVM object for it.  The object is detached, so maybeCreateJVM: attempts to attach it by calling AttachCurrentThread, and that's where the crash occurs.

I can't think of a good reason for JNI_GetCreatedJavaVMs to return bogus JVMs, so I'll follow up separately on that with Apple.

In the mean time, I'm adding a static variable to maybeCreateJavaVM: that tracks whether or not a JVM was ever created successfully, and avoiding calling JNI_GetCreatedJavaVMs if none has been.  Running under Rosetta now, the broken-plugin icon is properly displayed upon encountering Java.

I'll post the patch here and check in a new fat JEP bundle with this modification for Camino 1.0.

Reminder: those of you patching JEP locally for x86/universal builds will also be interested in bug 315163.  This bug affects Rosetta so the ppc build is the critical portion, that bug affects the straight x86 build.
Comment 3 Mark Mentovai 2006-02-05 17:42:51 PST
Created attachment 210813 [details] [diff] [review]
Only try existing JVMs if any had been created
Comment 4 Mark Mentovai 2006-02-05 17:55:27 PST
New JEP bits (0.9.5+c+2) checked in on CAMINO_1_0_BRANCH.
Comment 5 Mark Mentovai 2006-02-05 18:40:32 PST
rdar://4434041
Comment 6 Eric Albert 2006-02-05 19:47:39 PST
Thanks for the Radar number...I'll track that.
Comment 7 Mark Mentovai 2006-02-23 11:45:51 PST
This was fixed on the trunk, 1_8, and 1_8_0 branches by checking in a universal JEP 0.9.5+c with these patches in bug 327785.  Bug 327785 contains details about what exactly was checked in.  This bug will remain open until the patches or something else that accounts for the bugs makes it upstream to the JEP.
Comment 8 Mark Mentovai 2006-04-16 13:57:51 PDT
*** Bug 333009 has been marked as a duplicate of this bug. ***
Comment 9 Mark Mentovai 2006-04-16 14:01:56 PDT
JEP 0.9.5+d now contains a similar fix.  This version is now on the 1.8 branch and trunk.  0.9.5+c, with x86 patches including this one, is now on the 1.8.0 branch and shipped with 1.8.0.2.
Comment 10 Nickolay_Ponomarev 2006-04-16 15:19:36 PDT
*** Bug 331494 has been marked as a duplicate of this bug. ***

Note You need to log in before you can comment on or make changes to this bug.