Ticket #722 (enhancement)
Opened 1 year ago
Last modified 3 months ago
Handling bad POST retries from IE6/IE7
Status: assigned
| Reported by: | dowski | Assigned to: | dowski (accepted) |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.2 |
| Component: | wsgiserver | Keywords: | |
| Cc: |
See this KB article for the MS version of the story.
In a nutshell, if the connection is reset when IE is in the middle of a POST, it will retry the POST without confirmation, but without the message body. This causes the CP WSGI server to hand the request off to the CP WSGI application, which times out while trying to read the non-existent POST body.
Here is a diagram of the flow/state of the conversation:
Client CherryPy Server
sends POST req ---> <--- Socket idle timeout (default 10 secs) (FIN)
receives FIN <---
sends ACK --->
---> Receives ACK, socket to FIN_WAIT_2
---> Receives POST from above on closed socket
<--- sends RST
Receives RST <---
(socket is closed)
resends POST
*headers only* --->
---> Receives POST headers
FieldStorage object times
out attempting to read
non-existant message body
<--- Sends 500 response
Attachments
Change History
08/29/07 10:53:11: Modified by dowski
- status changed from new to assigned.
08/29/07 12:31:28: Modified by dowski
- attachment cptimeouttest.py added.
run this to demonstrate the problem
05/25/08 17:27:27: Modified by fumanchu
- milestone changed from 3.0 to 3.2.
I wonder if this has been fixed by #810.


Really, I don't know what exactly CP should do in this situation, if anything. The two MS workarounds (set keep-alive timeout to >60 secs or disable keep-alive) are sub-optimal. Really though, since it is a client-side issue, those are the only two ways you can really prevent the error on the server-side.
Maybe the server should "fail fast" in the POST-resend-without-body situation instead of waiting to timeout, but it seems like it would be messy at best to handle something like that.