XMLHttpRequest POST sometimes fails when server is using keep-aliv

  • Thread starter Thread starter Artur S
  • Start date Start date
A

Artur S

Guest
Back in 2004 there was a bug in Internet Explorer 6 which caused the body

from POST requests to go missing if the server reset the connection

(http://support.microsoft.com/kb/831167/en-us). The same bug is apparently

present in XMLHttpRequest in (at least) Internet Explorer 6, 7 and 8.



The problem can be simply reproduced by doing a POST with an XMLHttpRequest

to a server which is using a small keep-alive timeout, say 10s. If the POST

request is made right before the keep-alive timeout expires and there is a

slight network latency the web server will reset the connection and force IE

to resend the request. This time IE will "forget" to send the body but will

still send the old Content-Length header, resulting in the server waiting for

the body to arrive until a read timeout occurs.



The "right before" and "slight network latency" make it sound like this bug

is hard to reproduce but experiences have shown that this bug is not hard at

all to run in to while using a modern web application through e.g. a mobile

connection.



I have put a demo of this problem at

http://artur.virtuallypreinstalled.com/apache2-default/ie-xhr.php

The keep-alive timeout is 15s so wait 14-15s and click the button. An alert

should popup when the response arrives and the button is re-enabled. At least

for me using a mobile connection it does not take more than 2-3 attempts in

IE8 to reproduce the problem.



The only solution seems to be to turn off keep-alive on the server (or maybe

set it to more than 60s). Has anyone else run into this and are there any

other ways to solve this problem? Has this been reported/discussed here

before?







----------------

This post is a suggestion for Microsoft, and Microsoft responds to the

suggestions with the most votes. To vote for this suggestion, click the "I

Agree" button in the message pane. If you do not see the button, follow this

link to open the suggestion in the Microsoft Web-based Newsreader and then

click "I Agree" in the message pane.



http://www.microsoft.com/communitie...&dg=microsoft.public.internetexplorer.general
 
Me too!

I was very happy to finally come across this post. I have been banging my head against a problem with our web site that manifests itself only on high-latency connections (read: mobile) and only on a couple of pages that do lots of Ajax POSTs. I think I have come to the same conclusion as you.



Other suggestions than turning off Keep-Alive on the server-side would be greatly appreciated.



Thanks

Daniel









Artur S wrote:



XMLHttpRequest POST sometimes fails when server is using keep-aliv

09-Mar-10



Back in 2004 there was a bug in Internet Explorer 6 which caused the body

from POST requests to go missing if the server reset the connection

(http://support.microsoft.com/kb/831167/en-us). The same bug is apparently

present in XMLHttpRequest in (at least) Internet Explorer 6, 7 and 8.



The problem can be simply reproduced by doing a POST with an XMLHttpRequest

to a server which is using a small keep-alive timeout, say 10s. If the POST

request is made right before the keep-alive timeout expires and there is a

slight network latency the web server will reset the connection and force IE

to resend the request. This time IE will "forget" to send the body but will

still send the old Content-Length header, resulting in the server waiting for

the body to arrive until a read timeout occurs.



The "right before" and "slight network latency" make it sound like this bug

is hard to reproduce but experiences have shown that this bug is not hard at

all to run in to while using a modern web application through e.g. a mobile

connection.



I have put a demo of this problem at

http://artur.virtuallypreinstalled.com/apache2-default/ie-xhr.php

The keep-alive timeout is 15s so wait 14-15s and click the button. An alert

should popup when the response arrives and the button is re-enabled. At least

for me using a mobile connection it does not take more than 2-3 attempts in

IE8 to reproduce the problem.



The only solution seems to be to turn off keep-alive on the server (or maybe

set it to more than 60s). Has anyone else run into this and are there any

other ways to solve this problem? Has this been reported/discussed here

before?







----------------

This post is a suggestion for Microsoft, and Microsoft responds to the

suggestions with the most votes. To vote for this suggestion, click the "I

Agree" button in the message pane. If you do not see the button, follow this

link to open the suggestion in the Microsoft Web-based Newsreader and then

click "I Agree" in the message pane.



http://www.microsoft.com/communitie...&dg=microsoft.public.internetexplorer.general



Previous Posts In This Thread:





Submitted via EggHeadCafe - Software Developer Portal of Choice

SharePoint Video Library Template Available For Download

http://www.eggheadcafe.com/tutorial...05-5995f2b0ab63/sharepoint-video-library.aspx
 
Me too!

"Daniel H" wrote in message news:201031694711danielherlitz@gmail.com...

> I was very happy to finally come across this post.




Please note:

This is NOT a chat room and You are NOT posting to a forum run by

Eggheadcafe - you are actually posting to a global Usenet Newsgroup. You

will get a far better experience if you use a newsreader and subscribe to

these groups directly, rather than through Eggheadcafe.



Setting up Outlook Express/Windows Mail to access Microsoft newsgroups

http://www.michaelstevenstech.com/outlookexpressnewreader.htm



Accessing the MS newsgroups in Outlook Express/Windows Mail Newsreader

http://www.microsoft.com/windowsxp/expertzone/newsgroupsetup.mspx



If you must stay with Egghheadcafe then please follow Usenet custom by NOT

changing the subject line.



Thank you.



http://66.39.69.143/goodpost.htm
 
I just came across this, as well. Very difficult to track down until I found

this post. Note that with an HTTP proxy sniffer application such as Charles

Proxy, you can simulate increased latency via connection throttling (doesn't

resolve anything, just makes it easier to hit the test case).



Is there an official Microsoft bug related to this specific behavior in

XmlHttpRequest? I can't find one. There should be.
 
Back
Top