| Author |
JVM crash if Request size is more than 4MB ?
|
Ved Antani
Greenhorn
Joined: Jan 05, 2003
Posts: 28
|
|
I have a strange problem. I have a File Upload servlet, whenever I try to upload a file larger than 4MB, the JVM simply crashes. Apache Server Service is still available but I can see that one of the 2 java.exe processes has died and I get 'INTERNAL SERVER ERROR' page. What I can think of a workaround is not to parse the request if its larger than 4MB, but I just dont like doing that. I wanna know if there is *ANY* restriction that kills the process ? IF so, what should I do to make my code handle larger requests...? If I upgrade to a newer JDK will that help ? I would appreciate any help from you guys... Thanks. -Ved Browser : IE 5.0.x, IE 5.5.x, IE 6.0.x JDK versions ------------- Java Runtime Environment 1.3.1_01 (Sun Microsystems Inc.) Java Virtual Machine specification Java Virtual Machine Specification - 1.0 (Sun Microsystems Inc.) Java Virtual Machine implementation Java HotSpot(TM) Client VM - 1.3.1_01 (Sun Microsystems Inc.) Java Runtime Environment specification Java Platform API Specification - 1.3 (Sun Microsystems Inc.)
|
 |
vinod bonde
Greenhorn
Joined: Oct 03, 2005
Posts: 5
|
|
|
could u please copy and paste the error stack trace here
|
Bond with the Rest
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Ved, You haven't told us what upload library (or container for that matter) that you're using. I'm sure you'll get a lot more help if you take some time to let us know the details.
|
Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
|
 |
Ved Antani
Greenhorn
Joined: Jan 05, 2003
Posts: 28
|
|
Hi, There is nothing special about the container, its an ordinary servlet which first parses the request data. If the request is fine, I read the line into a buffer and finally create a blob out of it before committing to the db. When the request size is large (mostly > 4MB), the JVM dies. The stack is too huge but the crux is : Error : java.io.IOException: Stream closed prematurely This happens mostly when I try with files more than 4MB. I appreciate your help... Thanks
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
Most of us don't write upload handlers ourselves and therefore probably haven't run into this issue. I use Commons Fileupload from Apache. http://jakarta.apache.org/commons/fileupload There are several others out there that get mentioned in this and the JSP forum. This one is open source so you might see a workaround to your issue if you inspect the source.
|
 |
Ved Antani
Greenhorn
Joined: Jan 05, 2003
Posts: 28
|
|
Yes Ben, I agree that its impractical to write upload handlers ourselves but there are people like me...but I will surely check the code from Commons Fileupload from Apache. Thanks a lot. -Ved
|
 |
Ben Souther
Sheriff
Joined: Dec 11, 2004
Posts: 13410
|
|
You might also want to post some more of your setup. What conatiner are you using? Are you using it as a standalone? If not, what webserver and what connector are you using? I know there was an issue in one of the Tomcat/ISS connectors with large multipart requests at one point.
|
 |
dema rogatkin
Ranch Hand
Joined: Oct 09, 2002
Posts: 294
|
|
|
Maybe you can increase xmx settings? I use own upload code and write result in blob. I have no problems to upload files bigger than 4GB. Actually I met some problem, when content length limited to 4GB because uses int, so I parsed this header in long.
|
Tough in space?, <a href="http://tjws.sf.net" target="_blank" rel="nofollow">Get J2EE servlet container under 150Kbytes here</a><br />Love your iPod and want it anywhere?<a href="http://mediachest.sf.net" target="_blank" rel="nofollow">Check it here.</a><br /><a href="http://7bee.j2ee.us/book/Generics%20in%20JDK%201.5.html" target="_blank" rel="nofollow">Curious about generic in Java?</a><br /><a href="http://7bee.j2ee.us/bee/index-bee.html" target="_blank" rel="nofollow">Hate ant? Use bee.</a><br /><a href="http://7bee.j2ee.us/addressbook/" target="_blank" rel="nofollow">Need contacts anywhere?</a><br /><a href="http://searchdir.sourceforge.net/" target="_blank" rel="nofollow">How to promote your business with a search engine</a>
|
 |
 |
|
|
subject: JVM crash if Request size is more than 4MB ?
|
|
|