You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "verlag.preisser@t-online.de" <ve...@t-online.de> on 2011/09/14 18:53:20 UTC

Tomcat 7.0.21: BufferOverflowException in AjpAprProcessor.output()

Hi,

I'm using Tomcat 7.0.21 with Native 1.1.22 and AJP-APR connector on Windows Server 2008 (32 bit) with Java 1.7.0, using ISAPI Connector 1.2.32 for IIS 7.

When I looked into the log today, I found two occurrencies of a BufferOverflowException:

Sep 14, 2011 1:55:20 PM org.apache.coyote.ajp.AjpAprProcessor process
Schwerwiegend: Error processing request
java.nio.BufferOverflowException
	at java.nio.DirectByteBuffer.put(DirectByteBuffer.java:343)
	at org.apache.coyote.ajp.AjpAprProcessor.output(AjpAprProcessor.java:273)
	at org.apache.coyote.ajp.AbstractAjpProcessor$SocketOutputBuffer.doWrite(AbstractAjpProcessor.java:1082)
	at org.apache.coyote.Response.doWrite(Response.java:533)
	at org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:368)
	at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:437)
	at org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:321)
	at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:276)
	at org.apache.catalina.connector.Response.finishResponse(Response.java:502)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:432)
	at org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:185)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
	at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1773)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:722)

I've never seen those before.
What do these exceptions mean? (Why would Tomcat write over the limit of an ByteBuffer?)


Regards,

Konstantin Preißer



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Tomcat 7.0.21: BufferOverflowException in AjpAprProcessor.output()

Posted by Konstantin Preißer <ve...@t-online.de>.
Hi Chris,

> -----Original Message-----
> From: Christopher Schultz [mailto:chris@christopherschultz.net]
> Sent: Friday, September 16, 2011 10:56 PM
> To: Tomcat Users List
> Subject: Re: Tomcat 7.0.21: BufferOverflowException in
> AjpAprProcessor.output()
> 
> Does that mean that the client never sees an error? That would be
> good, as it makes the problem slightly less urgent :)

Yes, it seems that the error only occurred when the client aborted the connection.

 
> I can't think of what the problem may be, but it sounds like either
> some rare edge case or a regression. There has been a lot of work on
> merging code between all the various connectors wherever possible, and
> maybe some particular case wasn't merged properly.
> 
> Would you be able to test with either/or the NIO or BIO AJP
> connector(s) and see if the same behavior occurs? Do you have a way to
> force the exception to occur? I wonder if it could be scripted.

Unfortunately, the time when I wrote my initial mail was the only time I ever saw that Exception. I also can't reproduce it any more (I can force the connection to be terminated with 995 error in the ISAPI log on the server side, but I can't get Tomcat to throw the exception again). :(
I might try it with the other connectors (nio/bio), but I'm not sure when I have time for it.

But thanks for your suggestions.


Regards,

Konstantin Preißer


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.21: BufferOverflowException in AjpAprProcessor.output()

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Konstantin,

On 9/15/2011 1:02 PM, verlag.preisser@t-online.de wrote:
> I would like to add that the Exceptions seems to have occured when
>  the client aborted the connection, because at the same time of the
>  exception, in the ISAPI log was the following:
> 
> [Wed Sep 14 13:55:20.645 2011] [736:7288] [error]
> iis_write::jk_isapi_plugin.c (1337): Vector write of chunk encoded
> response failed with 995 (0x000003e3)
> 
> However it's still a bit strange, and I didn't see this Exception
> in previous versions of Tomcat, when a 995 error appeared in the
> ISAPI log.

Does that mean that the client never sees an error? That would be
good, as it makes the problem slightly less urgent :)

>> Are you using unusually large requests, possibly including chains
>> of client certs?
> 
> If you mean SSL certificates: I don't have any SSL certificate /
> HTTPS connection on Tomcat. I just use a normal AJP-APR connector
> and clients connect to IIS through HTTP. Sometimes I send large
> requests, but I wouldn't expect such an Exception to occur.

Ok.

>> If you have a lot of info that needs to be forwarded from the
>> proxy to Tomcat, you can exceed the max packet size of the
>> connector, and it's possible you could get this exception
>> (instead of a nicer error message). The default is 8k, so if you
>> have large amounts of requests data, you could be overflowing
>> this packet size.
>> 
>> Have you set "packetSize" on your <Connector>? Have you set 
>> max_packet_size on any of your workers? If so, the 
>> worker.max_packet_size and <Connector packetSize="..."> must
>> agree.
> 
> I don't have set any of these attributes.

Okay, it looks like you have a fairly vanilla setup (which is good!).

I can't think of what the problem may be, but it sounds like either
some rare edge case or a regression. There has been a lot of work on
merging code between all the various connectors wherever possible, and
maybe some particular case wasn't merged properly.

Would you be able to test with either/or the NIO or BIO AJP
connector(s) and see if the same behavior occurs? Do you have a way to
force the exception to occur? I wonder if it could be scripted.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5zt/YACgkQ9CaO5/Lv0PB60gCfaI3e5YNOvV+zku1p5cam0F92
lJUAn1kvxZNhpoX5vt0QgZuO7qzULtyV
=dR/i
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.21: BufferOverflowException in AjpAprProcessor.output()

Posted by "verlag.preisser@t-online.de" <ve...@t-online.de>.
Hi Christopher,

thanks for your reply.

I would like to add that the Exceptions seems to have occured when the client aborted the connection, because at the same time of the exception, in the ISAPI log was the following: 

[Wed Sep 14 13:55:20.645 2011] [736:7288] [error] iis_write::jk_isapi_plugin.c (1337): Vector write of chunk encoded response failed with 995 (0x000003e3)

However it's still a bit strange, and I didn't see this Exception in previous versions of Tomcat, when a 995 error appeared in the ISAPI log.


-----Original-Nachricht-----
> Von: Christopher Schultz <ch...@christopherschultz.net>
> An: Tomcat Users List <us...@tomcat.apache.org>
> Betreff: Re: Tomcat 7.0.21: BufferOverflowException in
> AjpAprProcessor.output()
> Datum: Wed, 14 Sep 2011 23:57:45 +0200

> Are you using unusually large requests, possibly including chains of
> client certs?

If you mean SSL certificates: I don't have any SSL certificate / HTTPS connection on Tomcat. I just use a normal AJP-APR connector and clients connect to IIS through HTTP.
Sometimes I send large requests, but I wouldn't expect such an Exception to occur.

> 
> If you have a lot of info that needs to be forwarded from the proxy to
> Tomcat, you can exceed the max packet size of the connector, and it's
> possible you could get this exception (instead of a nicer error
> message). The default is 8k, so if you have large amounts of requests
> data, you could be overflowing this packet size.
> 
> Have you set "packetSize" on your <Connector>? Have you set
> max_packet_size on any of your workers? If so, the
> worker.max_packet_size and <Connector packetSize="..."> must agree.

I don't have set any of these attributes; I just use the default settings (besides the port). My <Connector> element is this:
    <Connector port="8019"
    protocol="AJP/1.3"
    redirectPort="8743"
    URIEncoding="UTF-8" />

My workers.properties from the ISAPI redirector contains this:

  # Define 1 real worker using ajp13
  worker.list=worker1
  # Set properties for worker1 (ajp13)
  worker.worker1.type=ajp13
  worker.worker1.host=localhost
  worker.worker1.port=8019



Thanks,

Konstantin Preißer



---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Tomcat 7.0.21: BufferOverflowException in AjpAprProcessor.output()

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Konstantin,

On 9/14/2011 12:53 PM, verlag.preisser@t-online.de wrote:
> I'm using Tomcat 7.0.21 with Native 1.1.22 and AJP-APR connector on
> Windows Server 2008 (32 bit) with Java 1.7.0, using ISAPI Connector
> 1.2.32 for IIS 7.
> 
> When I looked into the log today, I found two occurrencies of a
> BufferOverflowException:
> 
> Sep 14, 2011 1:55:20 PM org.apache.coyote.ajp.AjpAprProcessor
> process Schwerwiegend: Error processing request 
> java.nio.BufferOverflowException at
> java.nio.DirectByteBuffer.put(DirectByteBuffer.java:343) at
> org.apache.coyote.ajp.AjpAprProcessor.output(AjpAprProcessor.java:273)
>
> 
at
org.apache.coyote.ajp.AbstractAjpProcessor$SocketOutputBuffer.doWrite(AbstractAjpProcessor.java:1082)
> at org.apache.coyote.Response.doWrite(Response.java:533) at
> org.apache.catalina.connector.OutputBuffer.realWriteBytes(OutputBuffer.java:368)
>
> 
at org.apache.tomcat.util.buf.ByteChunk.flushBuffer(ByteChunk.java:437)
> at
> org.apache.catalina.connector.OutputBuffer.doFlush(OutputBuffer.java:321)
>
> 
at org.apache.catalina.connector.OutputBuffer.close(OutputBuffer.java:276)
> at
> org.apache.catalina.connector.Response.finishResponse(Response.java:502)
>
> 
at
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:432)
> at
> org.apache.coyote.ajp.AjpAprProcessor.process(AjpAprProcessor.java:185)
>
> 
at
org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:515)
> at
> org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.run(AprEndpoint.java:1773)
>
> 
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
>
> 
at java.lang.Thread.run(Thread.java:722)
> 
> I've never seen those before. What do these exceptions mean? (Why
> would Tomcat write over the limit of an ByteBuffer?)

Are you using unusually large requests, possibly including chains of
client certs?

If you have a lot of info that needs to be forwarded from the proxy to
Tomcat, you can exceed the max packet size of the connector, and it's
possible you could get this exception (instead of a nicer error
message). The default is 8k, so if you have large amounts of requests
data, you could be overflowing this packet size.

Have you set "packetSize" on your <Connector>? Have you set
max_packet_size on any of your workers? If so, the
worker.max_packet_size and <Connector packetSize="..."> must agree.

Hope that helps,
- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk5xI1kACgkQ9CaO5/Lv0PDj8gCgua6OVYMwNUHbQ63uqXgo99so
yyUAn1eOnZSos7qZJbjaWgf7P0WEoGh/
=crZV
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org