Bug 50224 - Http11NioProtocol closes connection if headers are sent in different TCP segments
Summary: Http11NioProtocol closes connection if headers are sent in different TCP segm...
Status: RESOLVED DUPLICATE of bug 50072
Alias: None
Product: Tomcat 6
Classification: Unclassified
Component: Connectors (show other bugs)
Version: 6.0.29
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: default
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-11-05 13:54 UTC by Nils O. Sel
Modified: 2010-11-05 14:04 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nils O. Sel 2010-11-05 13:54:20 UTC
Ive tested an installation that was configured with Http11NioProtocol. When sent a HEAD request, the connection just gets closed. With the default HTTP/1.1 connector the HEAD requests gets a proper response. (I'm doing a HEAD / on a default installation, so it's the default tomcat / page that gets served, not a custom servlet). I have not checked how this behaves with ordinary GET/POST requests.

The part of the default server.xml that I altered:

      <Connector port="8080" protocol="org.apache.coyote.http11.Http11NioProtocol"
               connectionTimeout="20000"
               compression="on"
               compressionMinSize="8912"
               noCompressionUserAgents="gozilla, traviata"
               compressableMimeType="text/html,text/xml,text/plain"
               redirectPort="8443" />


This seems to happen when the request headers get sent in several IP packets. e.g. the HTTP request was:

HEAD / HTTP/1.0\r\n
Host: web01.example.com\r\n
User-Agent: go http package\r\n
\r\n

This request got sent in 4 different packets(tcp segments) - discovered with Wireshark

1. packet: HEAD / HTTP/1.0\r\n
2. packet: Host: web01.myserver.internal\r\n
3. packet: User-Agent: go http package\r\n
4. packet: \r\n

The HTTP/1.1 connector seems to handle the above case fine, responds with 200 OK and a proper response. When the Http11NioProtocol is used, there's no response, the TCP connection just gets closed from the Tomcat side.

This happens specifically when using the go http library(http://golang.org/) run on Fedora 14, below is the simple test case written in go - but I'd guess there's no guarantee the packets always gets sent in different segments (then again maybe the go http library disables the Nagle algorithm)

If anyone want to try to reproduce this using go(http://golang.org/) the simple test was this program:

package main
import (
    "http"
)
func main() {
    resp, err := http.Head("http://web01.myserver.internal/")
    println("after")
    if err != nil {
        print("Error::")
        println(err.String())
    } else {
        println(resp.Status)
    }
}
Comment 1 Mark Thomas 2010-11-05 14:04:35 UTC

*** This bug has been marked as a duplicate of bug 50072 ***