Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  how do you deal with Java native crashes?  (Read 1478 times)
0 Members and 1 Guest are viewing this topic.
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Posted 2004-05-04 21:41:54 »

Hi,

While I have been programming in Java for many years now, java native crashes are a new animal to me.

I have had to deal with them when using the JOGL and Odejava native API's over the last year, but in all cases they were bugs in the API - and in the case of Odejava, the java native crash was pretty useful in actually locating the problem within the native library and fixing it.

I currently have a problem described in this thread.
where Java's crashing (the errors occure in the main java libraries - not the third party ones) and I can't work out why.  Is it Odejava causing it to crash?  Or what?  The stack traces are all but useless and I have had to go back to log statements to try and work out where the errors are.  Then it seemed like my log statements were causing the crashing (it would work when I removed them).

I'm out of ideas.

Am I looking at a bug in Java here?  If so what do I need to do to submit a bug - I'm not convinced I can create a small test case here and I'm not convinced it's not Odejava somehow causing the problems.

If you can offer specific advice to my problem - please reply to the other thread I posted.  but general 'dealing with native crashes advice' would be great too.

Thanks in advance,

Will.

Offline tom
« Reply #1 - Posted 2004-05-04 23:53:25 »

Memory trashing can cause a native crash when the garbage collector is called. The stack trace will be useless, as it will only show what caused the gc to kick in. Not where the memory was trashed. You can recognize it by the native function wich called something with "heap".

Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #2 - Posted 2004-05-05 00:59:36 »

thanks for the tip.

So allocating more memory to the heap may be a work around?

Here's the two dumps I get - see anything interesting in them?

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
An unexpected exception has been detected in native code outside the VM.
Unexpected Signal : 11 occurred at PC=0x400AD730
Function=(null)+0x400AD730
Library=/lib/tls/libc.so.6
 
NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.
 
 
Current Java thread:
        at org.odejava.xode.XODEGeom.<init>(XODEGeom.java:90)
        at org.odejava.xode.XODEGroup.parseGroupChild(XODEGroup.java:126)
        at org.odejava.xode.XODEBody.<init>(XODEBody.java:89)
        at org.odejava.xode.XODEGroup.parseGroupChild(XODEGroup.java:122)
        at org.odejava.xode.XODEGroup.parseGroup(XODEGroup.java:106)
        at org.odejava.xode.XODESpace.<init>(XODESpace.java:67)
        at org.odejava.xode.XODEWorld.<init>(XODEWorld.java:74)
        at org.odejava.xode.XODERoot.<init>(XODERoot.java:70)
        at org.odejava.xode.XODEParserDOM.parse(XODEParserDOM.java:118)
        at org.odejava.test.xode.XODEExample.<init>(XODEExample.java:101)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
        at java.lang.Class.newInstance0(Class.java:308)
        at java.lang.Class.newInstance(Class.java:261)
        at org.odejava.xith3d.test.RunDemo.main(RunDemo.java:155)
 
Dynamic libraries:
<snip>
 
Heap at VM Abort:
Heap
 def new generation   total 576K, used 63K [0x44720000, 0x447c0000, 0x44c00000)
  eden space 512K,   7% used [0x44720000, 0x44729ce8, 0x447a0000)
  from space 64K,  37% used [0x447a0000, 0x447a6010, 0x447b0000)
  to   space 64K,   0% used [0x447b0000, 0x447b0000, 0x447c0000)
 tenured generation   total 1408K, used 565K [0x44c00000, 0x44d60000, 0x48720000)
   the space 1408K,  40% used [0x44c00000, 0x44c8d6b0, 0x44c8d800, 0x44d60000)
 compacting perm gen  total 4096K, used 3756K [0x48720000, 0x48b20000, 0x4c720000)
   the space 4096K,  91% used [0x48720000, 0x48acb2b8, 0x48acb400, 0x48b20000)
 
Local Time = Sun May  2 11:02:39 2004
Elapsed Time = 22
#
# The exception above was detected in native code outside the VM
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_04-b05 mixed mode)
#


and...

(edit: snipped)

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #3 - Posted 2004-05-05 01:02:51 »

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
Unexpected Signal : 11 occurred at PC=0x4040111A
Function=(null)+0x4040111A
Library=/usr/java/j2sdk1.4.2_04/jre/lib/i386/client/libjvm.so
 
NOTE: We are unable to locate the function name symbol for the error
      just occurred. Please refer to release documentation for possible
      reason and solutions.
 
 
Current Java thread:
        at java.lang.ClassLoader.findLoadedClass(Native Method)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:278)
        - locked <0x44c0f2f8> (a sun.misc.Launcher$ExtClassLoader)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
        - locked <0x44c0f220> (a sun.misc.Launcher$AppClassLoader)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
        - locked <0x44c0f220> (a sun.misc.Launcher$AppClassLoader)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
        - locked <0x44c0f220> (a sun.misc.Launcher$AppClassLoader)
        at com.xith3d.render.MaterialShader.<clinit>(MaterialShader.java:54)
        at com.xith3d.render.Renderer.getDefaultPriorities(Renderer.java:222)
        at com.xith3d.render.Renderer.<init>(Renderer.java:64)
        at com.xith3d.scenegraph.View.<init>(View.java:214)
        at org.odejava.xith3d.test.RunDemo.<init>(RunDemo.java:66)
        at org.odejava.xith3d.test.RunDemo.main(RunDemo.java:155)
 Dynamic libraries:
08048000-0804e000 r-xp 00000000 03:06 233919     /usr/java/j2sdk1.4.2_04/jre/bin/java
0804e000-0804f000 rw-p 00005000 03:06 233919     /usr/java/j2sdk1.4.2_04/jre/bin/java

<snip>

Heap at VM Abort:
Heap
 def new generation   total 576K, used 42K [0x44720000, 0x447c0000, 0x44c00000)
  eden space 512K,   1% used [0x44720000, 0x44721d10, 0x447a0000)
  from space 64K,  54% used [0x447b0000, 0x447b8bf8, 0x447c0000)
  to   space 64K,   0% used [0x447a0000, 0x447a0000, 0x447b0000)
 tenured generation   total 1408K, used 1130K [0x44c00000, 0x44d60000, 0x48720000)
   the space 1408K,  80% used [0x44c00000, 0x44d1aa30, 0x44d1ac00, 0x44d60000)
 compacting perm gen  total 4864K, used 4841K [0x48720000, 0x48be0000, 0x4c720000)
   the space 4864K,  99% used [0x48720000, 0x48bda750, 0x48bda800, 0x48be0000)
 
Local Time = Mon May  3 10:22:48 2004
Elapsed Time = 3
#
# HotSpot Virtual Machine Error : 11
# Error ID : 4F530E43505002EF
# Please report this error at
# http://java.sun.com/cgi-bin/bugreport.cgi
#
# Java VM: Java HotSpot(TM) Client VM (1.4.2_04-b05 mixed mode)
#


Thanks,

Will.

Offline William Denniss

JGO Coder


Projects: 2


Fire at will


« Reply #4 - Posted 2004-05-05 04:27:49 »

You bloody legend that was it!  Thank you, you have just made my day.

Finally, some deterministic behaviour.

Demo crashes when no -Xms & -Xmx set - Demo works when -Xms and -Xmx are set to 200M

I didn't think to try that because I wasn't getting out of memory errors - but it was the minimum heap size - not the maximum which was causing the crash (hence the cryptic dump rather than a kind Java error).

Now when I set the minimum nice and high - the bug doesn't manifest itself.

Thanks again for helping me find the work around.

Now the question remains - should I submit a bug report to Sun?  Surely libc.so and libjvm.so should in theory never crash.  I have no qualms in giving them all the code - it's open source anyway.

Grin

Will.

Offline tom
« Reply #5 - Posted 2004-05-05 09:53:13 »

I've no idee what actually is going on, but here are some wild speculations:

There is a bug in Ode4java that causes it write to memory that it do not own. It do not cause a access violation because the memory is part of the java heap and owned by the vm. Later the vm needs to move or grow the heap as part of a gc. Somehow some critical memory was trashed by ode wich makes the vm cause a access vialoation when it accesses memory. That is why it works when you set -Xms & -Xmx very high, because the vm don't need to move/grow the heap.

When I encountered this behavior, it was because I used a opengl get function that wrote outside by nio Buffer. When I fixed the get bug, the native crashes went away.

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (47 views)
2014-11-29 21:32:03

toopeicgaming1999 (113 views)
2014-11-26 15:22:04

toopeicgaming1999 (100 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!