BlackBerry OS6 WebWorks 将ajax 请求限制为10,是否存在连接泄漏?
我正在使用phonegap 和jquerymobile 开发一个webworks 应用程序。我使用soapclient.js 向后端服务器创建soap 请求。我们面临超时问题,在详细调查过程中,我们注意到第 11 个 ajax 请求始终没有得到响应。为了将事情放在正确的位置,我们使用相同的调用重复重复测试,以便我们知道特定的请求有效。
我们使用低端自行创建的 xmlhttprequest 对象,直到调用 send() 为止都没有错误。第 11 次调用时不会调用 onreadystate 更改侦听器。
有时,当我们等待足够长的时间时,第 11 个电话确实会在大约 5 分钟左右的时间内得到响应,这让我相信 BlackBerry 浏览器字段中存在连接泄漏。
我怀疑可以建立 10 个连接(非并行)的限制。一段时间后,当 BB 垃圾清理触发时,它会清除一些旧连接,并执行队列中等待的新连接。
更多信息
- 我已从服务器日志中验证,在此等待期间, 服务器没有收到请求
- 我已经验证了这一点 无论我使用 Wi-Fi 还是 GPRS,
- 应用程序都会再次开始工作,如果我关闭并重新打开它,但仅直到 前 10 个请求,
如果请求超过了超时期限,我会尝试通过调用 abort() 并将其设置为 null 来中止该请求。但即便如此,如果我不等待一段时间,我也无法提出第 11 个请求。
如果这种行为是随机的,我会相信任何其他原因,例如 javascript 等待 UI 线程等。但在第 11 个请求上,它的重现性为 99%,并且我已多次重新检查代码,看看是否有从应用程序通知的任何变量或计数。警报在 .send 之前工作正常,但不会调用回调。
我现在正在尝试创建一个非常简单的应用程序,它会进行 ajax 调用,以查看此行为是否特定于我的应用程序,或者是否是平台限制,但如果有人有任何此类以前的经验,请分享。
I am developing a webworks application using phonegap and jquerymobile. I use soapclient.js to create soap requests to my backend server. We were facing a timeout issue and during detailed investigation we noticed that consistently the 11th ajax request gets a no response. To put things on right place we repeated the test with same calls repeat so that we know that the particular request works.
we use the low end self created xmlhttprequest object and till the send() call there are no errors. The onreadystate change listener doesn't get called for the 11th call.
Occasionally when we waited long enough this 11th call did get honoured in approx 5 mins or so, making me believe that there is a connection leakage in BlackBerry browserfield.
I suspect that there is a limit of 10 connection (non parallel) which can be made. After sometime when BB garbage clean up triggers in, it clears out few old connection the new connection waiting in queue gets executed.
More info
- I have verified from server logs that during this waiting period,
server didn't received the request - I have verified that this
happens irrespective of whether I use Wi-Fi or GPRS - The application starts working again, if I close and reopens it but only till the
first 10 requests
I have tried to abort the request if it passes my timeout period by calling abort() and setting it to null. But even then I cannot make the 11th request if I don't wait for some time.
I would have believed any other reasons like javascript waiting for UI thread etc, if this behavior would have been random. But it is 99% reproducible on the 11th request and I have rechecked the code multiple times to see if there is any variable or count being informed from the app. The alert works fine till .send but the callback is not called.
I am now trying to create a very plain app which makes ajax calls to see if this behavior is specific to my app or is it a platform constraint, but if anybody has any such previous experience please share.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
最终经过一天的奋斗,我们发现这是由于将 javascript 函数分配给硬件按键而发生的。由于我们在不同的 jQuery 页面下使用不同的菜单项,因此菜单按钮在各种活动上绑定到不同的 javascript 函数,这导致 BB WebWorks 应用程序中出现内存泄漏。当我们用全局变量绑定菜单硬件按钮并继续替换其分配而不是一次又一次地调用绑定时,我们解决了这个问题。
Finally after a day of struggle, we found that it was happening due to assigning javascript functions to hardware keys. Since we were using different menu items under different jQuery page, the menu button is bound to different javascript functions on various activities, which was resulting in memory leakage in BB WebWorks application. We got it resolved when we bound the menu hardware button with a global variable and kept on replacing its assignment instead of recalling bind again and again.