Okay guys, I think I've figured out the source of the problem.

If you fail to add a "setName()" attribute on your FileInput element (or,
presumably, any other in the form), the resulting HTTP request is
unparseable which causes the MimeMultipart parser to explode in the way all
of you have encountered. I fixed this just by adding a
"fileInput.setName("file");" and now it uploads to the Blobstore upload url
without any problems.

Even though the problem turned out to be mine, and was easily fixable, I
still consider this a bug in AppEngine because there's no way such a simple
mistake should cause an OutOfMemoryException and crash; it could even be the
source of DOS vulnerabilities in the future just by crafting malicious HTTP
POST requests. I'll file a bug report with Google.

Cheers,
Adrian

On Mon, Jul 5, 2010 at 10:40 PM, Thomas <mylee...@gmail.com> wrote:

> Hi Adrian:
>
>     By plain normal servlet I meaned the url path (of the call to
> blobstoreService.createUploadUrl(url) ) is mapping to a simple plain
> HttpServlet implementation. And it is better to have the servlet
> bypass any filter mapping in development phase. It's how I finally
> succeeded to upload lots of blobs without any problems.
>
> On 7月6日, 上午10時07分, Adrian Petrescu <apetr...@gmail.com> wrote:
> > Hi Thomas,
> >
> > Thanks for your reply :) But I'm not sure what you mean by "a plain
> normal
> > HttpServlet#doPost to handle the upload"; in what sense am I not doing
> that?
> > Do you mean the fact that I'm uploading to Blobstore? Why would that be a
> > problem, and how else would I get them in there?
> >
> > Thanks,
> > Adrian
> >
> > On Mon, Jul 5, 2010 at 10:03 PM, Thomas <mylee...@gmail.com> wrote:
> > > Hi:
> >
> > > I read the post on Stack Overflow. My opinion is that you had better
> > > use a plain normal HttpServlet#doPost to handle the upload. I also
> > > encountered 500 Internal Server Error, but it worked well after I
> > > replace original handler with a plain servlet.
> >
> > > Hope the above helps!
> >
> > > On 7月6日, 上午8時25分, Adrian Petrescu <apetr...@gmail.com> wrote:
> > > > I've also posted about the issue on Stack Overflow here:
> > >http://stackoverflow.com/questions/3177092/uploading-to-blobstore-giv.
> ..
> >
> > > > Hopefully getting some more eyeballs on it will help.
> >
> > > > On Jul 4, 10:47 pm, Adrian Petrescu <apetr...@gmail.com> wrote:
> >
> > > > > I'm having the exact same issue too, down to the line numbers in
> the
> > > > > stack trace.
> >
> > > > > Has anyone figured out what is causing this? I find it hard to
> believe
> > > > > we've all made the exact same identical mistake, all within the
> last
> > > > > month. Is something wrong on Google's end?
> >
> > > > > Cheers,
> > > > > Adrian
> >
> > > > > On Jun 2, 7:14 pm, Jean Hsu <jeanhs...@gmail.com> wrote:
> >
> > > > > > Hi all,
> >
> > > > > > I am trying to set up a basic file upload to blobstore,  but I
> get
> > > > > > this OutOfMemoryError:
> >
> > > > > > WARNING: Error for /_ah/upload/
> > > > > > aghvbWdkcmVzc3IcCxIVX19CbG9iVXBsb2FkU2Vzc2lvbl9fGMACDA
> > > > > > java.lang.OutOfMemoryError: Java heap space
> > > > > >         at java.util.Arrays.copyOf(Arrays.java:2786)
> > > > > >         at
> > > java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:71)
> > > > > >         at
> >
> > >
> javax.mail.internet.MimeMultipart.readTillFirstBoundary(MimeMultipart.java:
> > > > > > 316)
> > > > > >         at
> > > javax.mail.internet.MimeMultipart.parse(MimeMultipart.java:186)
> > > > > >         at
> > > javax.mail.internet.MimeMultipart.getCount(MimeMultipart.java:109)
> > > > > >         at
> >
> > >
> com.google.appengine.api.blobstore.dev.UploadBlobServlet.handleUpload(Uploa
> > > dBlobServlet.java:
> > > > > > 135)
> > > > > >         at
> > > com.google.appengine.api.blobstore.dev.UploadBlobServlet.access
> > > > > > $000(UploadBlobServlet.java:72)
> > > > > >         at
> com.google.appengine.api.blobstore.dev.UploadBlobServlet
> > > > > > $1.run(UploadBlobServlet.java:100)
> > > > > >         at java.security.AccessController.doPrivileged(Native
> Method)
> > > > > >         at
> >
> > >
> com.google.appengine.api.blobstore.dev.UploadBlobServlet.doPost(UploadBlobS
> > > ervlet.java:
> > > > > > 98)
> > > > > >         at
> > > javax.servlet.http.HttpServlet.service(HttpServlet.java:713)
> > > > > >         at
> > > javax.servlet.http.HttpServlet.service(HttpServlet.java:806)
> > > > > >         at
> > > org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:
> > > > > > 511);
> >
> > > > > > I used the Memory Analyzer on Eclipse and it said that the memory
> > > leak
> > > > > > suspect is QueuedThreadPool.  I found this information about a
> memory
> > > > > > leak bug:
> >
> > > > > >http://jira.codehaus.org/browse/JETTY-1188
> >
> > > > > > How can I figure out what release of jetty is running locally?
>  It
> > > > > > looks like they fixed this in version 6.1.23:
> >
> > >http://jira.codehaus.org/secure/ReleaseNote.jspa?projectId=11160&vers.
> ..
> >
> > > > > > Has anyone else had this issue?
> >
> > > > > > Thanks,
> > > > > > Jean
> >
> > > --
> > > You received this message because you are subscribed to the Google
> Groups
> > > "Google App Engine for Java" group.
> > > To post to this group, send email to
> > > google-appengine-j...@googlegroups.com.
> > > To unsubscribe from this group, send email to
> > > google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com>
> <google-appengine-java%2bunsubscr...@googlegroups.com<google-appengine-java%252bunsubscr...@googlegroups.com>
> >
> > > .
> > > For more options, visit this group at
> > >http://groups.google.com/group/google-appengine-java?hl=en.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Google App Engine for Java" group.
> To post to this group, send email to
> google-appengine-j...@googlegroups.com.
> To unsubscribe from this group, send email to
> google-appengine-java+unsubscr...@googlegroups.com<google-appengine-java%2bunsubscr...@googlegroups.com>
> .
> For more options, visit this group at
> http://groups.google.com/group/google-appengine-java?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-j...@googlegroups.com.
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en.

Reply via email to