I searched Stack Overflow and Google for the specific error message in the title, but I did not find it (in the context of JavaScript coding, not browser settings). On my site, there are five functions that are called every 10 seconds. These functions do things such as:
- Check the user's inbox for new emails
- Check the user's account for new instant messages
- etc.
However, if the user is logged in, but is INACTIVE (does not use the mouse or press any keys) for about 15 minutes, I get the following error message when I "Inspect Element" with Chrome:
Failed to load resource: net::ERR_NETWORK_IO_SUSPENDED // (x 5)
Uncaught Type Error: Cannot read property 'combinedfiletimeinput' of undefined //one of my previously defined form values is now not defined
At this point, the user's new email count, new IM count, etc. go blank (whereas they were integers before). All the user has to do is refresh the page or go to another page to reconnect, so it's not a huge deal.
My hack solution is to use a JavaScript timer to automatically logout the user if there is not any of the following events in a 15 minute period:
- Mouse click
- Mouse movement
- Key press
Is there a way to prevent this "Failed to load resource" error from occurring?
UPDATE: This seems to occur when the user's device sleeps/hibernates while still logged on...when the user restarts the device. This is when the error message can be seen on Chrome's Inspect Element, Firebug, etc.
UPDATE 10/02/2014: I have now condensed the five setTimeout functions into one large setTimeout function. In addition, the form that held the modify times in an input called "combinedfiletimeinput" has been removed and I now handle the file modify times differently.
Here is a screenshot of the Chrome Developer Tools log showing the error. I have added "mysite" in place of my site's name and "filename" in place of the actual filename. I have also whited out the name of the external JavaScript file, and all that remains is .js (sorry, but I'm just trying to be careful :) ) I cut off some of the screenshot, so the text would be large enough to read.
As you can see by the screenshot, the request processes OK for the first three requests. Then I "sleep"ed my device and then turned my device back on. That's where the next two requests are errors (in red). After these first two errors, the requests begin to process normally again (rows with black text, after rows with red text). The console clearly shows the error message.
ERR_NETWORK_IO_SUSPENDED
, but it will cause some kind of error. I'm curious to know how anERR_NETWORK_IO_SUSPENDED
differs from a normal sudden disconnection, from the point of view of the JavaScript code. If there is no different, simply wait a few seconds and try the request again. – apsillers