J2ME App Crashes with Error: "An unexpected error has been detected by HotSpot Virtual Machine"
Joined: Jul 22, 2009
I am a Java Mobile Application Developer from India. I am developing an application, which integrates GPS and Mobile Mapping solution in it. I am targeting Motorola iDEN devices. Within Mapping module, the app downloads image tiles from Google Static Maps in the background as the user traverses on the map. I am maintaining a Vector of last 10 downloaded image tiles which are painted on screen as user scrolls on the map. I am using Motorola i605 simulator for testing.
The problem that I am facing is, when I traverse on the Map rigorously, the application crashes and Simulator gets turned off. On the Console, I get the following message:
# An unexpected error has been detected by HotSpot Virtual Machine:
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000, pid=1616, tid=4004
# Java VM: Java HotSpot(TM) Client VM (1.5.0_09-b03 mixed mode, sharing)
# Problematic frame:
# C 0x00000000
# An error report file with more information is saved as hs_err_pid1616.log
# If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp #
The error does not occur frequently..still, once in around 200 tiles. Moreover, rest of the application performs good.
I am completely clueless about the error, its reason and how to handle/avoid it. Please help!
This kind of error is ALWAYS due to a bug in the JVM. Java never terminates this way when it's a user/programmer problem. Only when the JVM itself is defective.
The only solutions are to either code your way around the situation that crashes the JVM or to use an alternate JVM.
Normally, code-arounds are a bad solution. Anything subtle enough to have gotten past the JVM implementor's tests is probably not going to be simple to understand how to avoid. And whatever kludges you used would almost certainly pollute the app for a long time after the bad JVM was history.
In mobile devices, however, the JVM is more likely be more or less permanently welded into the device, which makes the second solution more difficult, if not impossible.
Customer surveys are for companies who didn't pay proper attention to begin with.
Joined: Jul 22, 2009
Thanks a lot Tim, for the reply.
As you said, it was JVM error, I ran my application on two machines with JDK1.5 Update 9 and JDK1.5 Update 17. To my amaze, there was a remarkable difference.!
Well, I have made little change in my code, i.e., I am ignoring user clicks on the Map more frequently than a second. As I supposed, every user click caused heavy calculations (log, exp. etc.) and image tile download from Google server. So, slowing down this process helped and I am not getting this problem on Simulator. But I'm yet to test it on real device. Hoping this should work there too.