Is it a common occurrence for AJAX applications utilizing POST requests to encounter issues in Internet Explorer?

After some investigation, I have come across a bug in Internet Explorer that is causing intermittent failures for users running my application. This bug exists within the HTTP stack of IE and impacts all applications utilizing POST requests from this browser. The issue manifests as a request hanging for approximately 5 minutes before ultimately failing on the server's end. Subsequently, the browser application gives up on the post request after the server halts responding. Below, I will delve into further detail about this IE bug.

It appears that any application using XMLHttpRequest to send POST requests could face this problem if the timing of the request transmission is incorrect. To experiment with this behavior, I created a sample program that continually sends POSTs to the server at the exact moment when the server closes the connections. The interval for sending these POSTs aligns with the Keep-Alive header transmitted by the server.

When testing this setup from IE to a server featuring latency (e.g., not located on the same LAN), issues occur after only a few POST requests. During these incidents, IE freezes to such an extent that it necessitates forceful closure. The presence of a ticking clock signifies that the browser remains somewhat responsive.

To experience this firsthand, visit: . Please exercise caution and refrain from having important unsaved data in any ongoing IE sessions while trying this out, as it has the potential to crash IE.

Access the complete source code at: . You can execute this on any server equipped with php and configured for persistent connections.

My queries are:

  1. What experiences have others had regarding this problem?

  2. Are there known workarounds for addressing this issue apart from switching to another browser?

  3. Does Microsoft offer more insights into this matter than what I found in the provided article (see below)?

The predicament lies in browsers and servers defaulting to utilize persistent connections as outlined in RFC 2616 section 8.1 (refer to ). While crucial for performance—particularly in AJAX applications—this feature should remain enabled. Nonetheless, a slight timing discrepancy may arise where the browser initiates a POST on a prior connection just as the server decides the connection is idle and opts to close it. Consequently, the browser reports an HTTP stack error due to utilizing a closed socket. As per RFC 2616 section 8.1.4, "clients, servers, and proxies MUST be able to recover from asynchronous close events. Client software SHOULD reopen the transport connection and retransmit the aborted sequence of requests without user interaction."

Although Internet Explorer does resend the POST upon encountering this scenario, it mishandles the request by transmitting the POST headers (including the Content-Length) but omitting the actual data payload. This unconventional request triggers the server to wait indefinitely for the anticipated data before eventually failing the request with an error. Using a C program simulating an HTTP server closing the socket of an incoming POST request sans response, I validated this flaw consistently.

Microsoft seems to acknowledge this glitch in http://support.microsoft.com/kb/895954, noting its impact on IE versions 6 through 9. A hotfix was issued but comes with drawbacks:

  1. Activating the hotfix requires adding a registry key named FEATURE_SKIP_POST_RETRY_ON_INTERNETWRITEFILE_KB895954 via regedit. This task seems overly burdensome for end-users.

  2. The hotfix does not rectify the broken POST mechanism; instead, if the socket closes as predicted by the RFC, it generates an immediate error without attempting to resend the POST. Even with the hotfix, the application fails, albeit at an earlier stage.

Presented below is a standalone php script illustrating this bug, aiming to send continuous POSTs to the server during those critical moments when the server severs connections.

Answer №1

Dealing with this issue in Internet Explorer is something we encounter frequently. Finding a proper solution can be tricky, but one surefire way to address it is by ensuring that the web server's keepalive timeout is set higher than the browser's keepalive timeout (which is usually 60s for IE). Failing to do so can lead to connection rejections and TCP RST errors when IE tries to reuse connections that have been closed. By having a longer keepalive timeout on the server side, IE's connection reuse prevents sockets from being closed. However, bear in mind that keeping idle connections open for longer periods means occupying server sockets, potentially causing strain on the server if there are too many inactive connections.

It's essential to note that according to RFC section 8.1.4, clients, servers, and proxies must be able to recover from asynchronous close events. Client software should reopen the transport connection and resend aborted requests without user intervention, as long as the requests are idempotent. Non-idempotent methods or sequences should not be automatically retried, although user agents may provide the option for manual retry. Automatic retries should not continue if the second sequence of requests fails.

Keep in mind that an HTTP POST is considered non-idempotent as per section 9.1.2 of the RFC. Therefore, the behavior resulting from the registry hack technically aligns with the RFC guidelines.

Answer №2

While there may be occasional issues with POST requests in IE, it's not typically a major problem that warrants a lengthy discussion.

If you want to ensure consistency across different browsers when making a POST ajax request, using jquery is recommended.

It's important to remember that Internet Explorer is still widely used and should be accounted for, except for outdated versions like IE6.

So, although POST should work in IE, utilizing jquery can help mitigate any unexpected glitches and provide peace of mind.

Answer №3

I have never come across this particular issue before. Interestingly, a large majority of our clients tend to use IE6.

My suspicion is that the problem may lie in the length of your keep-alive timer. It is common practice to set it for less than 1 second in order to optimize page loading speed rather than servicing Ajax calls.

If the keep-alive timer is set too long, you could encounter more serious issues than just IE crashing - such as your server running out of file descriptors to open sockets!

*Please take note: Deliberately keeping connections open with HTTP servers without closing them is a known DOS attack method aimed at overwhelming the server's maximum open socket capacity. This is why many server administrators also set connection timeouts to prevent sockets from remaining open for extended periods of time.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Issue with Vue.js: routes are not found upon page refresh

Here is a basic vue-routing example: const Foo = { template: '<div>foo</div>' } const Bar = { template: '<div>bar</div>' } const routes = [ { path: '/foo', component: Foo }, { path: '/ba ...

Is there an AJAX message box available in ASP.NET Web Control that is not a model dialog?

Searching for a popup message / reminder similar to examples found in this and that, specifically in a readily available control within ASP.NET. Note: Due to constraints, I am unable to include any JavaScript and can only utilize Web Controls. ...

Tips for concealing scrollbars across various browsers without compromising functionality

Is there a way to hide the scrollbar functionality on a horizontal scrollbar without using "overflow: hidden"? I need to maintain JS functionality and ensure compatibility with all modern browsers. $j = jQuery.noConflict(); var $panels = $j('#primar ...

Steps for generating an HTML form in a fresh window

I am currently working with this function: // open a new window. Create and submit form function createSubmitForm(response) { var external = window.open('about:blank', 'external'); var doc = external.document; var body = $( ...

The initialization of a static member in a JS class occurs prior to the loading of the cdn

After declaring this class member, I encountered the issue stating that MenuItem is not defined. It appears that the class initialization occurs before React or Material-UI finishes loading (I am currently loading them from their CDN using straight < ...

Renew Firebase Token

Currently, my email and password authentication flow in web Firebase JavaScript involves generating a token that I then verify on my node.js backend using firebase-admin. To make things easier, I store this generated token in the browser's local/sessi ...

Ways to update the content of a NodeList

When I execute this code in the console: document.querySelectorAll("a.pointer[title='Average']") It fetches a collection of Averages, each with displayed text on the page: <a class="pointer" title="Average" onclick="showScoretab(this)"> ...

Encountered an issue when attempting to save data to the database using an AJAX request in Symfony 3

i need to input text in a form and store it in my database as well as display it on my view using jQuery. here is the input form: <div class="panel rounded shadow"> <form method="post"> <textarea id="txt" class="form-control in ...

Troubleshooting an issue with jQuery remote validation in Internet Explorer, specifically related to PHP MySQL query results matching form entries

Encountering unusual behavior on Internet Explorer while working with a form and adding a remote rule in jQuery for username validation using "check_username.php". The code snippet below includes requiring a view.php script that implements jQuery scripts a ...

What is the Best Way to Send JavaScript Variables to MYSQL Database with PHP?

I am having trouble sending my variable to a MySQL database. The database only displays the variable when using the HTML input tag. The error message I received was "Undefined index: rate & amount." Seeking assistance to resolve this issue. Thank you! ...

Steps for performing a 'back' action within a div element using jQuery

Within my HTML, I have a div element containing a link. When the user clicks this link, I use AJAX to load new content into the div area. This new content includes a 'back' link that, when clicked, should revert back to the previous content. Cur ...

The functionality of dragging and dropping list items with jQuery via AJAX is not functioning properly

After discovering that jquery drag and drop functionality cannot be applied to select dropdowns, I decided to create a dropdown using <ul> <li> elements. However, when I try dragging a list item, I want to display the corresponding highchart th ...

Executing follow-up tasks using multiple partial views in MVC3 on ASP.NET

Although this question may have been asked before, I am seeking guidance on how to approach implementing a specific scenario. In my ASP.NET MVC3 controller, I need to create a view that includes multiple partial views, each interacting with the database fo ...

Retrieving Data from Outside Source using AngularJS

Is there a way to retrieve JSON-Text-Stream data from a specific URL (e.g. SOMEURL/ean.php?id=4001513007704)? The returned result typically appears as follows: { "product": { "ean_id": "4001513007704", "title": "Gerolsteiner Mineralw ...

Background image fixed with scrolling effect

I've been struggling with a parallax effect on my website. After seeing it work smoothly on other websites, I tried to implement it myself but couldn't quite get it right. The background image keeps moving when I scroll the page and I want it to ...

The system is unable to retrieve the value of the property which is set as null

I'm trying to figure out how to store the input value of name_enter into the variable userName. However, every time I attempt this, I encounter the following console error: Uncaught TypeError: Cannot read property 'value' of null function ...

Obtain all the selection choices in a dropdown list using Selenium

Although I have come across similar questions, this one is distinct in its simplicity. Unlike other queries that involve iterating over options in a loop, my question revolves around the usage of the getOptions() method mentioned in Selenium documentation. ...

Step-by-step guide on incorporating CSS box-shadow with the .style JavaScript property

I have a JavaScript code snippet that looks like this: document.getElementById("imgA").style.box-shadow = "0 0 5px #999999"; The hyphen in box-shadow is causing an invalid assignment exception to be thrown by the JavaScript engine (specifically in Firefo ...

What is the best way to create titles with a background?

My goal is to have a title overlay an image with specific width and the text displayed in blocks. To better illustrate, here's an example: I prefer to achieve this effect using CSS; however, I am open to utilizing Javascript if needed. ...

Utilize the Material UI SelectField component as a reference for handling onChange events

I'm facing a challenge with my form that contains over 15 SelectField components. I want to avoid creating multiple change handler functions, but I can't figure out how to identify the specific select field that triggered the change event in orde ...