• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JVM crash if Request size is more than 4MB ?

 
Ved Antani
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
could u please copy and paste the error stack trace here
 
Ben Souther
Sheriff
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Ved Antani
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 294
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic