Hello,

I'm having a nagging problem with a lingering (not in the TCP terminology way) HTTP socket connection after using a slightly customized HttpInvoker component to send a message to a slightly modified HttpConnector component, running on port 4900. The symptom is, that after about a minute when the HTTP exchange is complete, I get the following debug output on the console:

DEBUG - JCLLoggerAdapter.debug(155) | EXCEPTION
java.net.SocketTimeoutException: Read timed out
       at java.net.SocketInputStream.socketRead0(Native Method)
       at java.net.SocketInputStream.read(SocketInputStream.java:129)
       at org.mortbay.io.bio.StreamEndPoint.fill(StreamEndPoint.java:99)
at org.mortbay.jetty.bio.SocketConnector$Connection.fill(SocketConnector.java:141)
       at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:255)
       at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:190)
       at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:298)
at org.mortbay.jetty.bio.SocketConnector$Connection.run(SocketConnector.java:153) at org.mortbay.thread.BoundedThreadPool$PoolThread.run(BoundedThreadPool.java:412)
DEBUG - JCLLoggerAdapter.debug(121) | EOF

After this exchange, but prior to the above exception, I see:

netstat -a -p |grep 4900
tcp6 0 0 localhost.localdom:4900 *:* LISTEN 15130/java tcp6 0 0 localhost.localdo:32956 localhost.localdom:4900 ESTABLISHED15130/java tcp6 0 0 localhost.localdom:4900 localhost.localdo:32956 ESTABLISHED15130/java

After the exception I see:

netstat -a -p |grep 4900
tcp6 0 0 localhost.localdom:4900 *:* LISTEN 15130/java tcp6 1 0 localhost.localdo:32956 localhost.localdom:4900 CLOSE_WAIT 15130/java tcp6 0 0 localhost.localdom:4900 localhost.localdo:32956 FIN_WAIT2 -

And eventually the connection goes away entirely. My HttpConnector consists of a copy of the ServiceMix HttpConnector and is essentially modified to "eat" the message - it's an HTTP /dev/null .

On each request, it's executing this:

public void processInOut(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, JBIException
   {
log.debug("Processing HTTP request from " + request.getRemoteAddr());
       BufferedReader reader = request.getReader();
       String s;
       while (null != (s = reader.readLine()))
       {
           log.debug(s);
       }
       reader.close();
       response.setStatus(HttpServletResponse.SC_OK);
       response.setHeader("X-CJIS-HTTP-Server-Debug", "done");
       response.setContentLength(0);
   }

Everything *appears* to work correctly - I can see the on-the-wire trace output with the correct data flowing in each direction. The sender sees an SC_OK response code and is happy. The Sender makes sure to close the connection by calling org.apache.commons.httpclient.methods.PostMethod.releaseConnection() just like the stock HttpInvoker does.

Adding a bit of confusion to this is that I have another, unmodified HttpConnector in defaultInOut=false mode running on another port, and being sent HTTP messages from an external test client, not another Component. This seems to work fine, but in that case the test client terminates after sending a single message, so perhaps that test is irrelevant.

This *seems* like a Jetty issue of some sort. I upgraded to 6.0.0 beta12 but it didn't change anything. From looking at the Jetty source, it simply appears that Jetty thinks there's more to read on the HTTP connection, but why this would be I don't understand, especially given the fact that the response has already been sent.

Thoughts, suggestions anyone?

Thanks,
Eric

Reply via email to