What would cause java to crash a mac computer when inserting records to a database (urgent)

I have a client/server application that connects to a database (using Openbase which can be found at www.openbase.com).
I was inserting a few thousand records into the database using a threaded process from the client application.
Basically the client code takes file input, converts everything to an insert statement and then using RMI it calls a method on the server that inserts the records to the database.

The process seems to work perfectly fine.  However, there was two occasions where the mac machine (server machine) crashed while in this process.  The process inserted roughly 20,000 records, then all of a sudden the mac locked up and said that I needed to restart the computer.  

After the first time this happened, I went back and made sure all ResultSets and Statements were being closed properly to prevent a memory leak and increased the heap size to a gig.  Then I tried it a second time and it happened again but at 25,000 records instead of 20,000.

Can anyone thing of any other reasons that this may occur?  

If you guys don't have better suggestions, I'm going to try using a profiler of some sort to try and figure out what happened but not sure if this would even be the best approach because I'm uncertain if it was the database, my application, or some other factor that may have caused this.

Any suggestions are greatly appreciated!!
LVL 5
tbboyettAsked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
objectsConnect With a Mentor Commented:
you can batch all instert that use the same sql statement (with different values)

http://javaalmanac.com/egs/java.sql/BatchUpdate.html
0
 
CEHJConnect With a Mentor Commented:
The first thing i would suggest is to close all other running processes and see if you can reproduce the error frequently
0
 
tbboyettAuthor Commented:
> all other running processes

by this are you referring to other processes that the java application is doing? or other programs and such that are running?
0
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
CEHJCommented:
The latter
0
 
sciuriwareConnect With a Mentor Commented:
The only 2 things I can think of are:
- a very bad JAVA implementation (do they exist?),
- an exploding and exagerating memory use beyond memory and swap space.
Did you monitor your memory usage? From within?
;JOOP!
0
 
tbboyettAuthor Commented:
Before taking it too far, I'm going to take CEHJ's recommendation and make sure no other processes are running and try it again to see if the problem occurs and at the same time i'm going to check the memory usage.

> a very bad JAVA implementation (do they exist?)
As far as bad implementation, what do would cause it to be bad? (just curious)

I have my server that connects to the database using the openbase driver Class.forName("com.openbase.jdbc.ObDriver");
my methods have the keyword synchronized and I have a single global connection for the clients to use.
Also, as mentioned above I close all statements and Resultsets after each update and then commit to the database.  Everything works fine the only time that this occurs is when I'm inserting about 20,000 records or more (long process).

Could any of this have potential issues that would cause this?

One other thing is it possible that an old jdbc driver could cause this problem?  I just download the newest driver Openbase JDBC3.0 that is for Java 1.5 which is the version of Java that I'm using.  
0
 
tbboyettAuthor Commented:
if it helps the first image on this page, is exactly what happened to the mac  http://docs.info.apple.com/article.html?artnum=106227 .  They seem to call it a "kernal Panic".   Thanks for the responses.
0
 
objectsCommented:
Thats most likely a problem with your VM, and not your application or other processes that are running.
You can try to workaround it by perhaps doing your inserts differently. Are you inserting records into the same table, if so make sure you are doing a batch update. Inserting records one ata time is quite inefficient.

> One other thing is it possible that an old jdbc driver could cause this problem?

could be, can't hurt to upgrade.
0
 
tbboyettAuthor Commented:
> Are you inserting records into the same table

Each record has data that goes into different tables and i just split it up and insert them one at a time (I figured this would be inefficient but haven't really dealt with batches).  For example:  for each record i'd create 4 different sql insert statements, one for table1, table2, and so on.  Could i create seperate batches for each and then run each batch individually.  Say, 15 statements in each batch at a time and then run the batch for table1, when that batch is done run the batch for table2 and so on, and then just repeat?

Thanks again
0
 
tbboyettAuthor Commented:
excellent, i'll give that a shot and get back to you
0
 
sciuriwareCommented:
>>> As far as bad implementation, what do would cause it to be bad? (just curious)
Yes, in the past some versions were quickly replaced.
I've seen some 25 updates on SUN's official editions of JAVA and some for a good reason.

;JOOP!
0
 
CEHJCommented:
Does this happen with other apps in the same VM?
0
 
tbboyettAuthor Commented:
What's a good recommended number of inserts for a batch?  I just ran a test of 30 statements in a batch and it completed in 37 milliseconds.  Would you guys say that would be a good number to stay at or would you increase or decrease it?
0
 
tbboyettAuthor Commented:
I attemted to run the process by using batches instead of individual inserts.  This time it crashed again but with a different screen.  Instead of the screen that has the box saying you must shut down your computer, it locked up the computer and displayed the following text on a grayed screen (white text with black background for the text):

System Failure:  cpu=0 code=00000008 (Unaligned stack)
Latest crash info for cpu=0:
Exception state (sv=0x5DF35A00)
      PC=0x9000A758; MSR=0x0200F030; DAR=0x19148144; DSIR=0x40000000; LR=0x9000A69C; R1=0xBFFFEA80;  XCP=0x00000030 (0xC00 - System call)
Procedding back via exception chain:
      Exception state (sv=0x5DF35A00)
      previously dumped as "Latest" state skipping...

Do you have any idea what this means?
0
 
tbboyettAuthor Commented:
Thanks for the help guys, It turned out  being a defective stick of ram causing the problem.  However, I'm going to split the points for the help you guys gave
0
 
CEHJCommented:
:-)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.