无法加载资源:净:: ERR_NETWORK_IO_SUSPENDED [英] Failed to load resource: net::ERR_NETWORK_IO_SUSPENDED

查看:7156
本文介绍了无法加载资源:净:: ERR_NETWORK_IO_SUSPENDED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我搜索堆栈溢出和谷歌在标题中的特定错误消息,但我没有发现它(在JavaScript编码,而不是浏览器设置的情况下)。我的网站上,也有被称为每10秒五大功能。这些功能做的事情,如:

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:


  1. 检查用户的收件箱中新邮件

  2. 检查用户的帐户是否有新的即时消息


但是,如果用户登录,但处于非活动状态(不使用鼠标或preSS任何键)约15分钟,我得到我检查元素使用Chrome以下错误消息:

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

在这一点上,用户的新的电子邮件数量,新的IM计数等变为空白(而此前的整数)。所有的用户所要做的就是刷新页面或转到另一个页面重新连接,所以它不是一个巨大的交易。

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.

我的黑客的解决办法是使用JavaScript计时器如果没有任何以下事件在15分钟内自动注销用户:

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:


  1. 鼠标点击

  2. 鼠标移动

  3. 重点preSS

有没有办法来prevent这个无法加载资源发生错误?

Is there a way to prevent this "Failed to load resource" error from occurring?

更新:这似乎当用户的设备睡眠/休眠,同时还登录...当用户重新启动设备发生。这时候可以在Chrome的可以看到错误消息检查元素,萤火虫等。

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.

更新2014年10月2日:我现在已经凝结五setTimeout的功能于一体的大型setTimeout函数。此外,举办了名为combinedfiletimeinput输入的修改时间的形式已被删除,我现在处理文件修改时间是不同的。

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.

下面是Chrome开发者工具的截图日志显示错误。我在的地方我的网站的名字和文件名代替实际文件名添加mysite的。我也有粉饰出来的外部JavaScript文件的名称,这一切仍然是.js文件(很抱歉,但我只是想小心:))我切断了一些截图,因此文本将是足够大阅读。

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.

推荐答案

只是总结社区问题下我的意见。

Just summarizing my comments under the question for community.

一些测试后,现在看来,该设置的阿贾克斯超时 S代表每个电话是必须的。如果没有超时,NET ::错误,比如 ERR_NETWORK_IO_SUSPENDED,ERR_INTERNET_DISCONNECTED等的会导致阿贾克斯停止执行,并且计算机醒来后会不会恢复。

After some testing, it seems, that setting Ajax timeouts for every call is a must. Without timeouts, NET:: errors such as ERR_NETWORK_IO_SUSPENDED, ERR_INTERNET_DISCONNECTED, etc will cause Ajax to stop execution, and would not resume after computer wake up.

有关jQuery的:

$.ajax({
   url: yourURL,
   timeout: 4000
});

有关 XMLHtt prequest (XHR):

 xhr.timeout = 4000;

此外,异常处理是必要的脚本捕捉连接错误,让你的JavaScript code不会中断,因为意外的行为/值了。

Moreover, an exception handler is necessary for your script to catch connection errors, so that your JavaScript code would not break down because of unexpected behavior/values.

即使超时和exeption处理程序,您的应用程序将引发NET ::错误,但他们的不可以伤害你的申请;你可以认为他们是的通知

Even with timeouts and exeption handler, your application will throw NET:: errors, but they would not harm your application; you could think of them as Notices.

这篇关于无法加载资源:净:: ERR_NETWORK_IO_SUSPENDED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆