https://bz.apache.org/bugzilla/show_bug.cgi?id=58458

            Bug ID: 58458
           Summary: Change in Expect100Continue behaviour in Tomcat is
                    breaking existing clients with HTTP 40x results
           Product: Tomcat 7
           Version: 7.0.64
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: oliver.w...@pdv.de

Created attachment 33142
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=33142&action=edit
Testcase

This issue is similar to bug #57324

In the version of Tomcat 7.0.50, the behavior of Coyote handler is modified to
handle "Expect: 100-continue" clients.

We use .net http clients to run multiple web service equests. The uri is
protected with spring security (kerberos / spnego) and uses requests to post
xml files and attachements to the server. Starting with tomcat 7.0.50 about 1%
to 10% of the requests fail with connection reset errors.

The problem is reproducable with a small powershell script that do 10000 small
post requests with the header "Expect: 100-continue" with an uri that does not
exists in tomcat (no webapp). The expected result are 10000 http 404 errors.
The problem is not reproducable when the header "Expect: 100-continue" is not
used.
The problem is not reproducable with tomcat versions 7.0.42.

No error is logged at tomcat level. The access log shows http 404 when a
request fails, but the response is not recognized by the client.


error message:
"The underlying connection was closed: An unexpected error occurred on a
receive."

additional infos:
1) .NET defaults to Expect 100 behaviour
2) .NET clients optimize the keepalive connections and do not send credentials
with every request going out on keepalive connections

Reproducable with:
7.0.64 APR Windows
7.0.64 BIO Windows
8.0.26 NIO Windows
8.0.26 APR Windows
8.0.26 NIO Linux
8.0.26 NIO2 Linux 
8.0.26 APR Windows
8.0.26 NIO2Windows
7.0.63 APR Windows
7.0.57 APR Windows
7.0.57 BIO Windows
7.0.50 APR Windows

Not reproducable with:
7.0.47 APR Windows
7.0.42 APR Windows
7.0.57 APR Linux   !
8.0.26 BIO Windows !

Windows = Windows 7 with Oracle Server JRE 8 Update 51
Linux = Oracle Linux 7 with java-1.8.0-openjdk-1.8.0.51-1.b16.el7_1.x86_64

possible workaround:
- setting expect100Continue to false at application or system level
-
http://blogs.msdn.com/b/fiddler/archive/2011/11/05/http-expect-continue-delays-transmitting-post-bodies-by-up-to-350-milliseconds.aspx
-
https://msdn.microsoft.com/en-us/library/system.net.servicepointmanager.expect100continue%28v=vs.110%29.aspx

Testcase:
- running on windows 7 (.net framework required)
- start tomcat 7.0.64 on port 8080 
- cmd.exe
-  Powershell.exe -executionpolicy remotesigned -File TomcatExpectTest.ps1

Expect100Continue set to True
Querying http://localhost:8080/myUri(number)
09/25/2015 19:42:25 request 257 - Exception Message: Exception calling
"GetResponse" with "0" argument(s): "The underlying connection was closed: An
unexpected error occurred on a receive."
...
--- RESULTS
Requests   :  10000
HTTP 404   :  9871
RST-Error  :  129    <--
OTHER Error:  0
--- END

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to