LWJGL Forum

Archive => Resolved Bugs/RFE => Topic started by: smith on January 20, 2011, 21:45:26

Title: [CLOSED] AppletLoader crashing java plugin on windows?
Post by: smith on January 20, 2011, 21:45:26
My lwjgl applet is crashing on Windows (all browsers) with the 1.6.0_23 plugin. No exceptions in the console (locked up). Can someone else check that it isn't just me:

http://www.angryoctopus.co.nz/webflight/WebFlight.html (http://www.angryoctopus.co.nz/webflight/WebFlight.html)

Works fine under Linux.
Title: Re: AppletLoader crashing java plugin on windows?
Post by: Matzon on January 21, 2011, 06:48:40
getting the same effect on windows too - however, without some debug, I'd be hard pressed to say if it is the applet loader or your code :)
Title: Re: AppletLoader crashing java plugin on windows?
Post by: Mickelukas on January 21, 2011, 07:56:57
I'm running 6u23 on windows 7 and it doesn't crash here...

Mike
Title: Re: AppletLoader crashing java plugin on windows?
Post by: smith on January 21, 2011, 07:57:21
Fixed the problem, turns out using the applet loader jars signed with the lwjgl cert mixed with any jars signed with the Odd labs cert will crash the Java plugin.
Title: Re: AppletLoader crashing java plugin on windows?
Post by: Matzon on January 21, 2011, 08:23:58
hmm, is it a bug in the JRE or is it the appletloaders certificate checking that is buggy?
Title: Re: AppletLoader crashing java plugin on windows?
Post by: kappa on January 21, 2011, 09:41:13
Thats odd, having different certificates should just show multiple security dialogs (one for each certificate) but there have been occasions were due to some buggy vm's it would freeze like you explain above. One would expect Oracle/Sun to have fixed these sort of issues by now.

Besides you should never need more then one certificate for your application/game anyway, if you don't need to sign your own jars, just use LWJGL's certificate or if you are signing yourself, just sign all the jars (including lwjgl jars) with your own certificate. Multiple Security dialogs just annoy users.

Just curious, were any of the certificates set to always remember (i.e. the checked box on the security dialog selected in a previous run)?

Also when you say crash the plugin do you mean that it would just freeze or actually crash?

I know you've fixed the issue now, but it would be useful if you could just upload an example of the crashing applet somewhere to allow further testing just to make sure its not the appletloader or if there is some workaround that can be used to stop the crash.
Title: Re: AppletLoader crashing java plugin on windows?
Post by: smith on January 21, 2011, 16:47:25
I tried removing all certificates and it still crashed. I wasn't deliberately mixing certificates, I was using the lwjgl zip downloads from SourceForge and they were signed with the old odd labs certificate. I updated the lwjgl_applet_util.jar,lzma.jar and the native jars because I knew they were required to be signed for the AppletLoader but I forgot that all the other lwjgl jars were also signed.
It's should be easy to reproduce, I don't think you even need an applet as it crashes in the AppletLoader while loading the jars, just put the lwgl.jar from the SF zip at lwjgl.org/applet and it will crash before the applet even starts running.
Title: Re: AppletLoader crashing java plugin on windows?
Post by: kappa on January 21, 2011, 16:52:18
If you do that, then the appletloader will finish doing its stuff successfully and your application will start. Now when your application makes a call that requires signed permissions from an unsigned jar it will crash due to the applet security manager and the jvm will throw a security exception in the java console.
Title: Re: AppletLoader crashing java plugin on windows?
Post by: smith on January 21, 2011, 19:39:05
Don't you have to accept the certificates before the applet starts? I never got any security exceptions in the java console and in fact the java console itself becomes unresponsive. I can set up an applet to demo the crash if someone more qualified is willing to try debug the issue.


Title: Re: AppletLoader crashing java plugin on windows?
Post by: kappa on January 21, 2011, 19:53:53
yeh, if you can set one up that'd be cool, can then allow narrowing down where its crashing.
Title: Re: AppletLoader crashing java plugin on windows?
Post by: smith on January 21, 2011, 20:36:04
Here is a copy of the original setup that was causing the jvm to lockup:
http://www.angryoctopus.co.nz/test/WebFlight.html (http://www.angryoctopus.co.nz/test/WebFlight.html)

Title: Re: AppletLoader crashing java plugin on windows?
Post by: kappa on January 21, 2011, 20:46:03
ok thx for that, preliminary checks show that the appletloader does complete and the crash/hang is somewhere in the application.

Are you catching exceptions in your application somewhere and not throwing them again? (could explain why their is nothing in the console).

It'd be helpful if you could put a number of System.out.println()'s in your applications to narrow down exactly how far along it gets and where it stops.
Title: Re: AppletLoader crashing java plugin on windows?
Post by: smith on January 21, 2011, 20:53:23
I'm not catching any exceptions that don't have a printStackTrace() in the handling. I'll spam println statements through the app when I get home from work but my money would be on Display.create().
Title: Re: AppletLoader crashing java plugin on windows?
Post by: smith on January 22, 2011, 03:09:19
Ok, bunch of println() statements added at some key points in the lifecycle, test away.
Title: Re: AppletLoader crashing java plugin on windows?
Post by: kappa on January 22, 2011, 13:58:32
thanks.

I've spent some time today trying to debug this.

Also improved the debug mode in the AppletLoader to be more useful.

I can confirm that it does actually crash in the AppletLoader on method switchApplet() and so doesn't even reach your application.

Once the following line is called
Code: [Select]
Class appletClass = classLoader.loadClass(getParameter("al_main"));
it never returns, hence the freeze/crash, some sort of deadlock.

It does look like a jvm bug and without actually debugging the jvm not sure how else to fix this.

any ideas?
Title: Re: AppletLoader crashing java plugin on windows?
Post by: kappa on January 22, 2011, 14:28:26
ok, thx to matthiasmann on irc lwjgl, he narrowed the problem down a AWT Lock issue caused by switchApplet running on the EDT. Investigating a possible fix now using invokeLater.
Title: Re: AppletLoader crashing java plugin on windows?
Post by: bobjob on January 22, 2011, 17:31:16
I noticed a similar crash on MacOSX when you accept the cerfiticate temporarily. it would cause a crash on the second run in the same place (switch applet) when it checks the certificate of the downloaded jars it somehow conflicted with the first cerftificate check. I fixed it by creating a minimum delay between the first certficate accept prompt and the switch applet method.

edit:
I set the delay to the first time check plus 1000 milliseconds
Also the applet example doesn contain "<param name="separate_jvm" value="true">" this may help prevent at least the browser crashing (otherwise it kills firefox even when closing the browser window).

edit2:
after testing the applet using no cache, and running in a seperate vm, it seems that it really is a problem with multiple certificates, strange that no exception is thrown. I doubt it can be fixed short of making sure correct certificates are used.
Title: Re: AppletLoader crashing java plugin on windows?
Post by: kappa on January 22, 2011, 18:15:31
after a few hours of fiddling with this it appears that it is indeed a JVM bug. It appears the culprit is a thread called SysExecutionThread which appears to be doing stuff outside the EDT and causing a deadlock. A bug has been submitted to Oracle and hopefully we'll see a fix for this soon. Will post a link here once I receive a number for the bug report.

On the bright side I think the dialog issue on mac's should be fixed now without adding a 1 second delay to startup.

So for now as mentioned above by bobjob just make sure you've got the right certificate and you'll be fine.