You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Martin Grigorov <mg...@apache.org> on 2014/03/17 10:06:08 UTC
Hanging write to the client when the response is too big
Hi,
A user of Apache Wicket has reported a problem where Tomcat hangs when
writing the response to the browser -
https://issues.apache.org/jira/browse/WICKET-5530
The application tries to upload a file (with Ajax) with bigger size than
the allowed one. Then in the Ajax response it tries to write 16K+ bytes and
Tomcat hangs with tracktrace like:
Thread [qtp263823398-19] (Suspended)
owns: ByteArrayOutputStream2 (id=69)
owns: AbstractHttpConnection$OutputWriter (id=70)
SocketOutputStream.socketWrite0(FileDescriptor, byte[], int, int)
line: not available [native method]
SocketOutputStream.socketWrite(byte[], int, int) line: 113
SocketOutputStream.write(byte[], int, int) line: 159
ByteArrayBuffer.writeTo(OutputStream) line: 375
SocketConnector$ConnectorEndPoint(StreamEndPoint).flush(Buffer) line: 164
HttpGenerator.flushBuffer() line: 850
HttpGenerator(AbstractGenerator).blockForOutput(long) line: 507
AbstractHttpConnection$Output(HttpOutput).write(Buffer) line: 170
AbstractHttpConnection$Output(HttpOutput).write(byte[], int, int) line: 107
ByteArrayOutputStream2(ByteArrayOutputStream).writeTo(OutputStream) line: 154
AbstractHttpConnection$OutputWriter(HttpWriter).write(char[], int,
int) line: 288
AbstractHttpConnection$OutputWriter(HttpWriter).write(String, int,
int) line: 112
AbstractHttpConnection$OutputWriter(HttpWriter).write(String, int,
int) line: 101
AbstractHttpConnection$1(PrintWriter).write(String, int, int) line: 456
....
There is a demo app attached to the ticket and an attachment with the
full stacktrace.
I personally wasn't able to reproduce it but two users have been able
to do it with Tomcat 7.0.47 on Windows.
Any help/hints are welcome!
Martin Grigorov
Wicket Training and Consulting
Re: Hanging write to the client when the response is too big
Posted by Mark Thomas <ma...@apache.org>.
On 17/03/2014 09:52, Martin Grigorov wrote:
> On Mon, Mar 17, 2014 at 11:29 AM, Mark Thomas <ma...@apache.org> wrote:
>
>> On 17/03/2014 09:06, Martin Grigorov wrote:
>>> Hi,
>>>
>>> A user of Apache Wicket has reported a problem where Tomcat hangs when
>>> writing the response to the browser -
>>> https://issues.apache.org/jira/browse/WICKET-5530
>>>
>>> The application tries to upload a file (with Ajax) with bigger size than
>>> the allowed one. Then in the Ajax response it tries to write 16K+ bytes
>> and
>>> Tomcat hangs with tracktrace like:
>>>
>>> Thread [qtp263823398-19] (Suspended)
>>> owns: ByteArrayOutputStream2 (id=69)
>>> owns: AbstractHttpConnection$OutputWriter (id=70)
>>> SocketOutputStream.socketWrite0(FileDescriptor, byte[], int, int)
>>> line: not available [native method]
>>> SocketOutputStream.socketWrite(byte[], int, int) line: 113
>>> SocketOutputStream.write(byte[], int, int) line: 159
>>> ByteArrayBuffer.writeTo(OutputStream) line: 375
>>> SocketConnector$ConnectorEndPoint(StreamEndPoint).flush(Buffer)
>> line: 164
>>> HttpGenerator.flushBuffer() line: 850
>>> HttpGenerator(AbstractGenerator).blockForOutput(long) line: 507
>>> AbstractHttpConnection$Output(HttpOutput).write(Buffer) line: 170
>>> AbstractHttpConnection$Output(HttpOutput).write(byte[], int, int)
>> line: 107
>>>
>> ByteArrayOutputStream2(ByteArrayOutputStream).writeTo(OutputStream) line:
>> 154
>>> AbstractHttpConnection$OutputWriter(HttpWriter).write(char[], int,
>>> int) line: 288
>>> AbstractHttpConnection$OutputWriter(HttpWriter).write(String, int,
>>> int) line: 112
>>> AbstractHttpConnection$OutputWriter(HttpWriter).write(String, int,
>>> int) line: 101
>>> AbstractHttpConnection$1(PrintWriter).write(String, int, int)
>> line: 456
>>>
>>> ....
>>>
>>>
>>>
>>> There is a demo app attached to the ticket and an attachment with the
>>> full stacktrace.
>>>
>>> I personally wasn't able to reproduce it but two users have been able
>>> to do it with Tomcat 7.0.47 on Windows.
>>>
>>>
>>> Any help/hints are welcome!
>>
>> Best guess, the client isn't reading the response because it hasn't
>> fully written the request. Tomcat isn't going to close the connection as
>> that would prevent it writing a response. Tomcat writes the response but
>> because it is bigger than the various network buffers, Tomcat hangs
>> writing the response.
>>
>> I assume something times out eventually and closes the connection.
>>
>> Mark
>>
>
> Thanks for the answer!
>
> What is the current default behavior of Tomcat 7/8 about swallowing the
> file upload input in case its size is bigger than the configured max size?
> I've found discussion [1] but it doesn't say whether the behavior has
> changed in later versions of Tomcat.
>
> 1. http://markmail.org/message/c4qo4g2wc4sm7g53
http://tomcat.apache.org/tomcat-8.0-doc/config/context.html
http://tomcat.apache.org/tomcat-7.0-doc/config/context.html
Look for swallowAbortedUploads
However, all of this is moot if it is the application reading the
request body via getInputStream() rather than Tomcat. In that case it is
up to the application to handle this case.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Hanging write to the client when the response is too big
Posted by Martin Grigorov <mg...@apache.org>.
On Mon, Mar 17, 2014 at 11:29 AM, Mark Thomas <ma...@apache.org> wrote:
> On 17/03/2014 09:06, Martin Grigorov wrote:
> > Hi,
> >
> > A user of Apache Wicket has reported a problem where Tomcat hangs when
> > writing the response to the browser -
> > https://issues.apache.org/jira/browse/WICKET-5530
> >
> > The application tries to upload a file (with Ajax) with bigger size than
> > the allowed one. Then in the Ajax response it tries to write 16K+ bytes
> and
> > Tomcat hangs with tracktrace like:
> >
> > Thread [qtp263823398-19] (Suspended)
> > owns: ByteArrayOutputStream2 (id=69)
> > owns: AbstractHttpConnection$OutputWriter (id=70)
> > SocketOutputStream.socketWrite0(FileDescriptor, byte[], int, int)
> > line: not available [native method]
> > SocketOutputStream.socketWrite(byte[], int, int) line: 113
> > SocketOutputStream.write(byte[], int, int) line: 159
> > ByteArrayBuffer.writeTo(OutputStream) line: 375
> > SocketConnector$ConnectorEndPoint(StreamEndPoint).flush(Buffer)
> line: 164
> > HttpGenerator.flushBuffer() line: 850
> > HttpGenerator(AbstractGenerator).blockForOutput(long) line: 507
> > AbstractHttpConnection$Output(HttpOutput).write(Buffer) line: 170
> > AbstractHttpConnection$Output(HttpOutput).write(byte[], int, int)
> line: 107
> >
> ByteArrayOutputStream2(ByteArrayOutputStream).writeTo(OutputStream) line:
> 154
> > AbstractHttpConnection$OutputWriter(HttpWriter).write(char[], int,
> > int) line: 288
> > AbstractHttpConnection$OutputWriter(HttpWriter).write(String, int,
> > int) line: 112
> > AbstractHttpConnection$OutputWriter(HttpWriter).write(String, int,
> > int) line: 101
> > AbstractHttpConnection$1(PrintWriter).write(String, int, int)
> line: 456
> >
> > ....
> >
> >
> >
> > There is a demo app attached to the ticket and an attachment with the
> > full stacktrace.
> >
> > I personally wasn't able to reproduce it but two users have been able
> > to do it with Tomcat 7.0.47 on Windows.
> >
> >
> > Any help/hints are welcome!
>
> Best guess, the client isn't reading the response because it hasn't
> fully written the request. Tomcat isn't going to close the connection as
> that would prevent it writing a response. Tomcat writes the response but
> because it is bigger than the various network buffers, Tomcat hangs
> writing the response.
>
> I assume something times out eventually and closes the connection.
>
> Mark
>
Thanks for the answer!
What is the current default behavior of Tomcat 7/8 about swallowing the
file upload input in case its size is bigger than the configured max size?
I've found discussion [1] but it doesn't say whether the behavior has
changed in later versions of Tomcat.
1. http://markmail.org/message/c4qo4g2wc4sm7g53
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
Re: Hanging write to the client when the response is too big
Posted by Mark Thomas <ma...@apache.org>.
On 17/03/2014 09:06, Martin Grigorov wrote:
> Hi,
>
> A user of Apache Wicket has reported a problem where Tomcat hangs when
> writing the response to the browser -
> https://issues.apache.org/jira/browse/WICKET-5530
>
> The application tries to upload a file (with Ajax) with bigger size than
> the allowed one. Then in the Ajax response it tries to write 16K+ bytes and
> Tomcat hangs with tracktrace like:
>
> Thread [qtp263823398-19] (Suspended)
> owns: ByteArrayOutputStream2 (id=69)
> owns: AbstractHttpConnection$OutputWriter (id=70)
> SocketOutputStream.socketWrite0(FileDescriptor, byte[], int, int)
> line: not available [native method]
> SocketOutputStream.socketWrite(byte[], int, int) line: 113
> SocketOutputStream.write(byte[], int, int) line: 159
> ByteArrayBuffer.writeTo(OutputStream) line: 375
> SocketConnector$ConnectorEndPoint(StreamEndPoint).flush(Buffer) line: 164
> HttpGenerator.flushBuffer() line: 850
> HttpGenerator(AbstractGenerator).blockForOutput(long) line: 507
> AbstractHttpConnection$Output(HttpOutput).write(Buffer) line: 170
> AbstractHttpConnection$Output(HttpOutput).write(byte[], int, int) line: 107
> ByteArrayOutputStream2(ByteArrayOutputStream).writeTo(OutputStream) line: 154
> AbstractHttpConnection$OutputWriter(HttpWriter).write(char[], int,
> int) line: 288
> AbstractHttpConnection$OutputWriter(HttpWriter).write(String, int,
> int) line: 112
> AbstractHttpConnection$OutputWriter(HttpWriter).write(String, int,
> int) line: 101
> AbstractHttpConnection$1(PrintWriter).write(String, int, int) line: 456
>
> ....
>
>
>
> There is a demo app attached to the ticket and an attachment with the
> full stacktrace.
>
> I personally wasn't able to reproduce it but two users have been able
> to do it with Tomcat 7.0.47 on Windows.
>
>
> Any help/hints are welcome!
Best guess, the client isn't reading the response because it hasn't
fully written the request. Tomcat isn't going to close the connection as
that would prevent it writing a response. Tomcat writes the response but
because it is bigger than the various network buffers, Tomcat hangs
writing the response.
I assume something times out eventually and closes the connection.
Mark
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org