View Issue Details

IDProjectCategoryView StatusLast Update
0002189Spring engineGeneralpublic2010-10-26 15:04
Reportercranphin Assigned To 
PrioritynormalSeveritycrashReproducibilityrandom
Status newResolutionopen 
Product Version0.82.6.1 
Summary0002189: JVM may fail to load and crash spring engine
DescriptionI'm developing a Java AI, and have had Spring crash on me trying to load the JVM.
This has been on recent git master versions.
With one version this would happen pretty much randomly with the default Spring JVM settings (Spring\AI\Interfaces\Java\0.1\jvm.properties).
Current master this does not seem to happen, unless I tweak the settings.
I'm attaching both the infolog.txt and interface-log.txt.

There has already been some analyzing of the problem with hoijui, and the first thing we found is that the initial event causing the crash is the JVM claiming not enough (contiguous) memory. This leaves a env (or so) variable null or unitialized, which then later on causes the whole spring engine to crash.

Hoijui has already commited a change on master to log this event (in interface-log.txt), and try to keep spring itself from crashing (which partially works, it crashes at a later point now).

In interface-log.txt the message now is:
10/25/10 20:32:08 / ERROR(1): Failed to create Java VM: -4 - JNI_ENOMEM - not enough (contiguous) memory


Now it's easy to assume this is caused by a simple lack of memory, but there's two things against this theory: My machine still has plenty of memory left (and has a big pagefile if ram runs out), and Sysinternals vmmap shows me that there's plenty of memory left in spring's virtual memory space (which is sized about 2GB, since spring is 32bit), on a random check there's well over 600mb left. This is more then enough for the JVM.

The clue seems to be that the JVM wants a big chunk of contiguous memory. Again using vmmap it's possible to see that the largest available contiguous chunk of memory is a lot smaller then 600mb, and in the cases of the crashes, too small to fit the JVM.

Now this seems to be a problem some people who embed Java in other programs have also run into at times, but noone has reported a easy or decent fix yet. The problem is partially cause because windows likes to load it's dll's all over the virtual memory space, leaving chunks of memory between them.


Now with a previous version from master I had this problem randomly with the default settings, which sets the Java max stack size to 64MB. Looking at vmmap back then I saw some 100-200 mb free contigious space.
The current version from master seems to have some more contigious space (and I have no idea why :) ), vmmap tells me almost 400mb.
I'm not sure if there has actually been a code change that's caused that, or just some random influence on how the memory get's layed out (which is well possible I think).
In this case I can still reproduce the crash, I just need to manually increase the max JVM heap space by quite a bit, for example use: jvm.option.x=-Xmx384M (this is set in Spring\AI\Interfaces\Java\0.1\jvm.properties ) instead of the default jvm.option.x=-Xmx64M. This is how the attached infolog with stack trace is created.

So right now it seems kinda ok, but the fact that it's changed without being sure why, and the randomness of it occuring when it did, worries me some :)



TagsNo tags attached.
Attached Files
infolog.txt (Attachment missing)
interface-log.txt (Attachment missing)
Checked infolog.txt for Errors

Issue History

Date Modified Username Field Change
2010-10-25 21:02 cranphin New Issue
2010-10-25 21:02 cranphin File Added: infolog.txt
2010-10-25 21:02 cranphin File Added: interface-log.txt
2010-10-26 15:04 hoijui Note Added: 0005796