0

I'm the author of a PHP web application that provides a dashboard and control panel for its users' environments.

For context, the architecture is roughly as follows:

  • apache webserver w/ PHP 5.4 handling user interface requests
  • MYSQL 5.5 (percona) storing data about user environments
  • SOAP service hosted by a separate system that allows Northbound Interface (NBI) requests to affect user environments
  • a separate parsing system that interprets changes to users' environments and updates the database according to changes detected.

When a user logs into the web application, their environment is loaded up from the database and displayed. The user interface is kept up-2-date with AJAX polling requests to the PHP server. I have rigged up these requests to not "stack" by keeping the connection state stored in a JS boolean so that whenever the poll interval is triggered, subsequent requests do not "stack up." i.e. The subsequent requests are skipped until the active request completes.

In addition to polling to keep the interface up to date, the SOAP service can be utilized via AJAX request to the PHP server, triggering a synchronous SOAPClient request to the NBI from the server, to perform operations that affect the users' environments. When a change is made over these requests, the parsing system eventually picks up the change, and updates the database, causing the polling mechanism to update the interface, completing the operation from the point of view of the user.

The user-initiated AJAX requests that perform NBI calls can last a substantial amount of time, sometimes even more than a minute before the SOAP request is released, and the status of the SOAP-requested operation is returned to the AJAX request that triggered it.

In the user's GUI, I'm locking down other AJAX requests (including the polls), while one of these operations is ongoing, ensuring only a single AJAX request is active at a time.

Here's the problem: If this request is CANCELLED by xhr.abort(), the server side request to the NBI call remains open until completion. While the completion is pending, if the user attempts to navigate elsewhere or perform another operation (or poll), the request is held up until the server completes the original cancelled request.

To be clear: The hold up seems to be SERVER-SIDE, as there is no ongoing concurrent AJAX or otherwise request limit being hit in the browser.

Until the server finishes its SOAP client request triggered by the aborted AJAX request, further requests from the same browser are held up, it seems, at the server.

I understand that killing the AJAX request mid stream does not kill the request at the server, but why is the server holding up further requests until after the AJAX request that triggered the NBI call is aborted?

Rimer
  • 2,054
  • 6
  • 28
  • 43
  • might by interesting for you: http://stackoverflow.com/questions/11627916/connection-aborted-does-not-work-on-ajax-calls – bitWorking Feb 03 '14 at 18:17
  • That would be useful if PHP could somehow send output while the SOAPClient is active, but it can't. Why is the subsequent request "queued" up at the server until the aborted request finishes? – Rimer Feb 04 '14 at 15:30
  • I'm running into the same or similar issue I think. See my ticket here... http://stackoverflow.com/questions/31328471/cancel-pending-ajax-requests – Adam Youngers Jul 09 '15 at 22:59

0 Answers0