velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shawn Church" <sh...@boxity.com>
Subject Re: Form upload failure
Date Wed, 03 Jul 2002 16:46:30 GMT
A couple more things.  Even though on the browser page Apache seemed to
report a 200, in the access log I see a 200 for the initial presentation of
the form, but the submit results in a 500 like in IIS.  The 200 text which
displays on the browser page is apparenty "left-over" from the initial form,
with the "internal error" displayed below actually indicating the 500.

I tried turning off keep-alive in Apache, and I've also tried forcing to
HTTP1.0, but neither of these made any difference.  Is it possible Velocity
is closing the connection? (I don't think so).

Shawn

----- Original Message -----
From: "Shawn Church" <shawn@boxity.com>
To: "Velocity Users List" <velocity-user@jakarta.apache.org>
Sent: Wednesday, July 03, 2002 10:44 AM
Subject: Re: Form upload failure


> After more testing, I realize that the problem actually did not go away
with
> IIS, but IIS handles the exception differently than Apache.  Apache
results
> in an http 200, along with the complaint that "The server encountered an
> internal error or misconfiguration and was unable to complete your
request".
> IIS results in an http 500, page cannot be displayed.  Again, the problem
is
> intermittent but can be easily produced by quickly resubmitting the form.
>
> Eliminating Velocity from the mix seems to also eliminate the problem.
> Using a plain html page with the same type of form, handled by a normal
> HttpServlet, everything works smoothly.  Tomcat is still involved here, so
> the only thing I can think of to do now is to begin tracing through
Velocity
> code to see if anything might somehow relate to <input type=file>.
>
> Thanks for everyone's input,
> Shawn
>
>
> ----- Original Message -----
> From: "Shawn Church" <shawn@boxity.com>
> To: "Velocity Users List" <velocity-user@jakarta.apache.org>
> Sent: Tuesday, July 02, 2002 4:47 PM
> Subject: Re: Form upload failure
>
>
> > FYI, I moved everything to IIS 5 and the problem went away.  However, I
> > really do not want to run this app on IIS because I plan on moving it to
a
> > Linux box for production.  I can move to Tomcat 4 if no one can
reproduce
> > the problem there.
> >
> >
> > Kevin,
> >
> > The last code I sent was not a snippet.  Everything is stripped out for
> this
> > test, so there is only a single servlet and a single template.  There
are
> no
> > globally-scoped objects in this code.
> >
> > I should mention also that I have several other production servers
running
> > both WebMacro (because Velocity didn't exist at the time they were
> > developed), and Velocity, which are perfectly stable under continuous
> usage,
> > so I am fairly confident this is unfortunately an issue with <input
> > type=file>.
> >
> > Shawn
> >
> > ----- Original Message -----
> > From: "Kevin Baynes" <kbaynes@seagullsw.com>
> > To: "Velocity Users List" <velocity-user@jakarta.apache.org>
> > Sent: Tuesday, July 02, 2002 3:44 PM
> > Subject: RE: Form upload failure
> >
> >
> > >
> > > Shawn-
> > >
> > > I couldn't tell from the code snippet you sent whether my suspicion is
> > > correct.
> > >
> > > Look for any objects of global scope in the Servlet (ones that are
> outside
> > > of the scope of the methods), that are then modified or accessed
within
> > the
> > > methods. This is an easy thing to let happen within a Servlet, but it
> > yields
> > > unpredictable behavior as an object is modified by one method while
> > another
> > > is still using it.
> > >
> > > I'd have to see the entire file to make sure, but it could be your
> > problem.
> > > You can also test this way: If all your action happens inside of
> > > handleRequest, you can add the "synchronized" keyword to the method
> > > declaration, that will prevent two threads from accessing the method
at
> > the
> > > same time. Declare it synchronized and see if your problem goes
away...
> > then
> > > fix it, don't leave it synchronized.
> > >
> > > ~kevin
> > >
> > >
> > >
> > > > -----Original Message-----
> > > > From: Shawn Church [mailto:shawn@boxity.com]
> > > > Sent: Tuesday, July 02, 2002 3:52 PM
> > > > To: Velocity Users List
> > > > Subject: Re: Form upload failure
> > > >
> > > >
> > > > Nick,
> > > >
> > > > I believe Velocity is getting called, because if I submit the
> > > > form multiple
> > > > times, but delay 2-3 seconds between submissions, I don't see a
> failure.
> > > > Also, once in a while the template gets rendered in the browser,
> > > > followed by
> > > > the (same) error message, so it seems Velocity is happy but
> > > > Apache / Tomcat
> > > > doesn't like the response.
> > > >
> > > > Thanks,
> > > > Shawn
> > > >
> > > > ----- Original Message -----
> > > > From: "Nick Temple" <ntemple@alivecity.com>
> > > > To: "Velocity Users List" <velocity-user@jakarta.apache.org>
> > > > Sent: Tuesday, July 02, 2002 2:26 PM
> > > > Subject: RE: Form upload failure
> > > >
> > > >
> > > > > Hi Shawn --
> > > > >
> > > > > I tend to agree with you.  I do know that uploaded files are a
> little
> > > > > messier to deal with, however since you aren't actually using the
> > > > paramaters
> > > > > I don't see how that could be a problem.
> > > > >
> > > > > I am curious to see where in the code it actually stops
> > > > processing.  Does
> > > > > Velocity even get called? Is the output thrown away by the
> > > > server engine?
> > > > > Anyway, I'm grasping at straws.
> > > > >
> > > > > Give me a couple of hours and I will get a version running on
apache
> > > > 1.3.26
> > > > > / tomcat 4 and see if I can reproduce it.
> > > > >
> > > > > Nick
> > > > >
> > > > > -----Original Message-----
> > > > > From:
> > velocity-user-return-8057-ntemple=alivecity.com@jakarta.apache.org
> > > > >
> > [mailto:velocity-user-return-8057-ntemple=alivecity.com@jakarta.apache.o
> > > > > rg]On Behalf Of Shawn Church
> > > > > Sent: Tuesday, July 02, 2002 2:14 PM
> > > > > To: Velocity Users List
> > > > > Subject: Re: Form upload failure
> > > > >
> > > > >
> > > > > Nick,
> > > > >
> > > > > I am using the same thing in my real code, but for the sake of the
> > > > isolation
> > > > > test I have removed it.  The problem is not related to the actual
> > upload
> > > > > code or any of the com.oreilly package, since I'm not getting that
> far
> > > > > unless I work around the problem at hand by returning a
> > > > different template
> > > > > (than the one which made the request) to Velocity.  My test code
> only
> > > > > involves the single template and the single servlet.  To rule out
> > Apache
> > > > and
> > > > > mod_jk, I may try to get it running with IIS (or with Tomcat's web
> > > > server).
> > > > >
> > > > > I added the System.err.println(e.toString()), but it logs no
> > exceptions.
> > > > >
> > > > > Shawn
> > > > >
> > > > > ----- Original Message -----
> > > > > From: "Nick Temple" <ntemple@alivecity.com>
> > > > > To: "Velocity Users List" <velocity-user@jakarta.apache.org>
> > > > > Sent: Tuesday, July 02, 2002 1:11 PM
> > > > > Subject: RE: Form upload failure
> > > > >
> > > > >
> > > > > > Here is the system I am using to handle file-uploads:
> > > > > >
> > > > > > http://www.servlets.com/cos/index.html
> > > > > >
> > > > > > However, if the system doesn't hang when POSTing to a different
> > > > > > form/servlet, I tend to think that it isn't the POST at all
rather
> > > > > > "something" in the code.
> > > > > >
> > > > > > Try writing some code in your try / except clause to see if
> > > > an error is
> > > > > > being thrown and ignored (and any places the servlet might be
> > throwing
> > > > an
> > > > > > exception).
> > > > > >
> > > > > >   try
> > > > > >   {
> > > > > >    return getTemplate(templateName);
> > > > > >   }
> > > > > >   catch (Exception e)
> > > > > >   {
> > > > > >     System.err.println(e.toString());
> > > > > >   }
> > > > > >
> > > > > > Nick
> > > > > >
> > > > > > -----Original Message-----
> > > > > > From:
> > > > velocity-user-return-8053-ntemple=alivecity.com@jakarta.apache.org
> > > > > >
> > > >
> [mailto:velocity-user-return-8053-ntemple=alivecity.com@jakarta.apache.o
> > > > > > rg]On Behalf Of Björn
> > > > > > Sent: Tuesday, July 02, 2002 12:58 PM
> > > > > > To: Velocity Users List
> > > > > > Subject: Re: Form upload failure
> > > > > >
> > > > > >
> > > > > > Do not know if this might be of any help to you...
> > > > > >
> > > > > > http://www.orionsupport.com/articles/fileupload.html
> > > > > >
> > > > > > It did help me once =)
> > > > > >
> > > > > >
> > > > > > /Björn
> > > > > > ----- Original Message -----
> > > > > > From: "Shawn Church" <shawn@boxity.com>
> > > > > > To: <velocity-user@jakarta.apache.org>
> > > > > > Sent: Tuesday, July 02, 2002 7:17 PM
> > > > > > Subject: Form upload failure
> > > > > >
> > > > > >
> > > > > > Does anyone know of any limitations or problems with Velocity
1.2
> /
> > > > Apache
> > > > > > 1.3.24 / Tomcat 3.3a, relating to multipart/form-data templates
> > > > containing
> > > > > > <INPUT TYPE=FILE> ?  Specifically in the case where I
have
> > > > this type of
> > > > > > template, whose form action is to invoke a servlet which then
does
> > > > nothing
> > > > > > except return the same template (which made the request) to
> > > > Velocity, I
> > > > am
> > > > > > getting this from Apache:
> > > > > >
> > > > > > HTTP/1.1 200 OK Date: Tue, 02 Jul 2002 16:48:35 GMT Server:
> > > > Apache/1.3.24
> > > > > > (Win32) mod_jk/1.1.0 Connection: close Transfer-Encoding:
chunked
> > > > > > Content-Type: text/html; charset=iso-8859-1
> > > > > >
> > > > > > This problem occurs if I select a file for upload, or if I do
> > > > not select
> > > > > > anything but rather just resubmit the form a few times in rapid
> > > > > succession.
> > > > > > If I do not select a file, and submit the form no more often
than
> > once
> > > > per
> > > > > > every couple of seconds, the problem does not occur.
> > > > > >
> > > > > > Here is a test template:
> > > > > >
> > > > > > <html>
> > > > > > <form action="/ec/servlet/upload" method="post"
> > > > > > enctype="multipart/form-data">
> > > > > >   Which file to upload? <INPUT TYPE=FILE NAME=file1> <BR>
> > > > > > <input type=submit>
> > > > > > </form>
> > > > > > </html>
> > > > > >
> > > > > >
> > > > > > Here's a snippet of the upload servlet, which is coded to do
> nothing
> > > > > except
> > > > > > return the same form which made the request:
> > > > > >
> > > > > > ...
> > > > > > public class upload extends VelocityServlet
> > > > > > {
> > > > > >  public Template handleRequest( HttpServletRequest _req,
> > > > > HttpServletResponse
> > > > > > _res, Context _context)
> > > > > >  {
> > > > > >   String templateName = "upload.vm";
> > > > > >
> > > > > >   // return the appropriate template
> > > > > >   try
> > > > > >   {
> > > > > >    return getTemplate(templateName);
> > > > > >     }
> > > > > >     catch (Exception e)
> > > > > >     {
> > > > > >
> > > > > >   }
> > > > > >
> > > > > >   return null;
> > > > > >  }
> > > > > > ...
> > > > > >
> > > > > > My environment is Velocity 1.2 / Apache 1.3.24 / Tomcat 3.3a,
IE
> > 6.0,
> > > > > > running on Win2k.  If my servlet returns a different template
than
> > the
> > > > one
> > > > > > which made the request, everything is fine.
> > > > > >
> > > > > > Shawn
> > > > > >
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > To unsubscribe, e-mail:
> > > > > > <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> > > > > > For additional commands, e-mail:
> > > > > > <mailto:velocity-user-help@jakarta.apache.org>
> > > > > >
> > > > > >
> > > > > >
> > > > > > --
> > > > > > To unsubscribe, e-mail:
> > > > > <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> > > > > > For additional commands, e-mail:
> > > > > <mailto:velocity-user-help@jakarta.apache.org>
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > > <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> > > > > For additional commands, e-mail:
> > > > > <mailto:velocity-user-help@jakarta.apache.org>
> > > > >
> > > > >
> > > > >
> > > > > --
> > > > > To unsubscribe, e-mail:
> > > > <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> > > > > For additional commands, e-mail:
> > > > <mailto:velocity-user-help@jakarta.apache.org>
> > > >
> > > >
> > > > --
> > > > To unsubscribe, e-mail:
> > > > <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> > > > For additional commands, e-mail:
> > > > <mailto:velocity-user-help@jakarta.apache.org>
> > >
> > >
> > > --
> > > To unsubscribe, e-mail:
> > <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> > > For additional commands, e-mail:
> > <mailto:velocity-user-help@jakarta.apache.org>
> >
> >
> > --
> > To unsubscribe, e-mail:
> <mailto:velocity-user-unsubscribe@jakarta.apache.org>
> > For additional commands, e-mail:
> <mailto:velocity-user-help@jakarta.apache.org>
>
>
> --
> To unsubscribe, e-mail:
<mailto:velocity-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:velocity-user-help@jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:velocity-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:velocity-user-help@jakarta.apache.org>


Mime
View raw message