?
Solved

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

Posted on 2006-06-26
16
Medium Priority
?
257 Views
Last Modified: 2008-02-26
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!!
0
Comment
Question by:tbboyett
  • 8
  • 4
  • 2
  • +1
16 Comments
 
LVL 86

Assisted Solution

by:CEHJ
CEHJ earned 600 total points
ID: 16985695
The first thing i would suggest is to close all other running processes and see if you can reproduce the error frequently
0
 
LVL 5

Author Comment

by:tbboyett
ID: 16986065
> 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
 
LVL 86

Expert Comment

by:CEHJ
ID: 16986078
The latter
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 24

Assisted Solution

by:sciuriware
sciuriware earned 200 total points
ID: 16986989
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
 
LVL 5

Author Comment

by:tbboyett
ID: 16987661
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
 
LVL 5

Author Comment

by:tbboyett
ID: 16988447
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
 
LVL 92

Expert Comment

by:objects
ID: 16988771
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
 
LVL 5

Author Comment

by:tbboyett
ID: 16988809
> 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
 
LVL 92

Accepted Solution

by:
objects earned 1200 total points
ID: 16988853
you can batch all instert that use the same sql statement (with different values)

http://javaalmanac.com/egs/java.sql/BatchUpdate.html
0
 
LVL 5

Author Comment

by:tbboyett
ID: 16988885
excellent, i'll give that a shot and get back to you
0
 
LVL 24

Expert Comment

by:sciuriware
ID: 16989993
>>> 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
 
LVL 86

Expert Comment

by:CEHJ
ID: 16990067
Does this happen with other apps in the same VM?
0
 
LVL 5

Author Comment

by:tbboyett
ID: 17017506
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
 
LVL 5

Author Comment

by:tbboyett
ID: 17020230
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
 
LVL 5

Author Comment

by:tbboyett
ID: 17020581
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
 
LVL 86

Expert Comment

by:CEHJ
ID: 17020728
:-)
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Suggested Courses
Course of the Month16 days, 12 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question