I'm running a tomcat 8.5.23 instance on ubuntu 16.04 (spring boot
application with embedded tomcat) configured with 2 connectors:
Http11NioProtocol and AjpNioProtocol.
The AJP one is accessed through an apache2 instance configured with
mod_jk.It all works well in the normal use case.

The application has code to look for the EOFExceptions during read e.g. the
client aborts the request which works well with HTTP but not AJP.
In my test I'm simulating this by closing the connection half way through
(some headers have been sent but no body)

The problem I'm seeing is an inconsistent behaviour for
CoyoteInputStream.read()
The HTTP connector throws an EOFException in this case while the AJP one
just returns -1.

The relevant call stack is this
      at
org.apache.coyote.ajp.AjpProcessor.refillReadBuffer(AjpProcessor.java:684)
      at
org.apache.coyote.ajp.AjpProcessor$SocketInputBuffer.doRead(AjpProcessor.java:1433)
      at org.apache.coyote.Request.doRead(Request.java:581)
      at
org.apache.catalina.connector.InputBuffer.realReadBytes(InputBuffer.java:326)
      at
org.apache.catalina.connector.InputBuffer.checkByteBufferEof(InputBuffer.java:642)
      at
org.apache.catalina.connector.InputBuffer.readByte(InputBuffer.java:337)
      at
org.apache.catalina.connector.CoyoteInputStream.read(CoyoteInputStream.java:93)

Now based on this old and unrelated thread
https://mail-archives.apache.org/mod_mbox/tomcat-users/201312.mbox/%3c15ff6f04-b4c9-4d9b-b1b3-5c10ca955...@360works.com%3E
I understand that the AJP connector is perfectly capable of raising an
EOFException but it's just not doing that for me.

The documentation https://tomcat.apache.org/tomcat-8.0-doc/config/ajp.html
does not suggest I need to do anything special.

I guess it's possible that this has something to do with the way apache2
talks to the AJP connector. Any help is appreciated.

Regards,
George

Reply via email to