Help! On a production system that's been rock-solid for 18 months, Tomcat is
suddenly hanging on a daily basis!

Before the server hangs, we're logging runtime exceptions from
SocketInputStream.readHeader: the log records ArrayIndexOutOfBounds
exceptions every second for a few hours, then the server responds to every
subsequent request with a 400 "Bad Header" response, ie. hangs.

The same/similar problem was reported a year ago, see
http://www.mail-archive.com/[EMAIL PROTECTED]/msg85861.html

Can anyone shed light on what is happening? Or suggest a workaround/fix?

Thanks, 

Chris 

Sample stack trace:
--------------------

2004-02-04 22:20:06 HttpProcessor[8080][14] process.parse
java.lang.ArrayIndexOutOfBoundsException
    at 
org.apache.catalina.connector.http.SocketInputStream.readHeader(SocketInputS
tream.java:487)
    at 
org.apache.catalina.connector.http.HttpProcessor.parseHeaders(HttpProcessor.
java:579)
    at 
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
977)
    at 
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
)
    at java.lang.Thread.run(Thread.java:491)


-------------------------------
SocketInputStream.java line 487:
-------------------------------
while (!eol) {
  // if the buffer is full, extend it
  if (readCount >= maxRead) {
    if ((2 * maxRead) <= HttpHeader.MAX_VALUE_SIZE) {
      char[] newBuffer = new char[2 * maxRead];
      System.arraycopy(header.value, 0, newBuffer, 0,
               maxRead);
      header.value = newBuffer;
      maxRead = header.value.length;
    } else {
      throw new IOException
        (sm.getString("requestStream.readline.toolong"));
    }
  }
  // We're at the end of the internal buffer
  if (pos >= count) {
    // Copying part (or all) of the internal buffer to the line
    // buffer
    int val = read();
    if (val == -1)
      throw new IOException
        (sm.getString("requestStream.readline.error"));
    pos = 0;
    readStart = 0;
  }
  if (buf[pos] == CR) {
  } else if (buf[pos] == LF) {
    eol = true;
  } else {
    // FIXME : Check if binary conversion is working fine
    int ch = buf[pos] & 0xff;
    header.value[readCount] = (char) ch; // <--- LINE 487
    readCount++;
  }
  pos++;
}


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to