2

I'm maintaining an old CodeIgniter web app.

Lately, when certain forms are saved, the browser shows a permanent "Pending" for the status of the request. The request never completes (unless I reboot the web server in which case it errors out immediately).

There aren't any client-side errors in Dev Tools.

There aren't any server-side errors in the logs.

This happens in different browsers.

It happens in a Chrome incognito window with no extensions loaded.

All I have to go on is, the submit button it hit, the browser says "waiting for <servername>" and nothing else happens.

Does this look like a network problem? There was no problem loading any of the application's other pages, all of which came out of the same database and web server.

How do I debug a "pending" HTTP request in a browser, when neither the client or the server shows an error?

TIA

AmbroseChapel
  • 11,957
  • 7
  • 46
  • 68

1 Answers1

1

You can rule out a network problem because the other sites are working. If the same site sometimes works and sometimes won't there could be a network problem but this isn't very likely.

The fact that the request is pending and there aren't any errors means that the server accepted the request and is handling it. When there is no error the server handles it until either an error appears or the response is returned by the php processor.

This brings me to the assumption that the problem is an endless loop or a long running function in your serverside code.

error detection procedure

First check that the error reporting is enabled in index.php.

Now you could wait wait till the code runs in a timeout and throws an error

and/or

you could go to the config/routes.php and check which controller and function handles the request and break down the functions and test which one takes this long.

If you need further help please paste some code.

berkyl
  • 431
  • 4
  • 20
  • Thank you. That got me far enough to solve the problem. The database server was busy with some long-running queries, it turns out. Not unavailable, crucially, but unable to respond or process the query. What can I do to make CodeIgniter fail gracefully when it encounters this situation? – AmbroseChapel Jun 24 '15 at 08:42
  • @AmbroseChapel You could [do this](http://stackoverflow.com/questions/4794747/mysql-can-i-limit-the-maximum-time-allowed-for-a-query-to-run) but I advise not to do so. Isn't the right question: why is the query not fullfilled in time? Are there some configuration errors in mysql? Or is the query buggy? – berkyl Jun 24 '15 at 12:28