简体   繁体   English

随机jQuery Ajax调用始终失败

[英]Random jQuery Ajax calls inconsistently fail

Using jQuery, I take form submissions and run them as AJAX requests instead. 使用jQuery,我采用表单提交并将其作为AJAX请求运行。 Generally, this has worked extremely well and been a robust solution. 通常,这非常有效,并且是一个可靠的解决方案。 But one of my clients seems to be having certain longer forms fail inconsistently. 但是我的一位客户似乎认为某些较长的表格会不一致地失败。

I was able to remotely connect to their computer and recreate the issue. 我能够远程连接到他们的计算机并重新创建问题。 Google Chrome shows the connection as "(failed)" after several seconds: 几秒钟后,Google Chrome将连接显示为“(失败)”:

Chrome Web检查器显示请求失败

Tracking down the IP address in the Apache log, I seem to see an error 408: 跟踪Apache日志中的IP地址,我似乎看到错误408:

x.x.x.x - - [05/Dec/2013:12:53:00 -0800] "-" 408 - "-" "-"

The form data is substantial, but not huge (~90 fields, nothing super long). 表单数据很大,但并不庞大(〜90个字段,没有什么超级长的)。

Additionally, other users at other locations do not seem to have the same issue. 此外,其他位置的其他用户似乎没有相同的问题。 I tried disabling firewalls and Kaspersky products that the client used, but the problem still occurred. 我尝试禁用客户端使用的防火墙和Kaspersky产品,但问题仍然存在。

Yet, it is inconsistent. 但是,这是不一致的。 So retrying a few times usually causes the request to succeed. 因此,重试几次通常会导致请求成功。

Any ideas what might cause certain queries to run into this issue? 有什么想法可能导致某些查询遇到此问题吗? This has me stumped. 这让我难过。

(Update) Extra detail: (更新)额外的细节:

  • The requests are SSL requests. 这些请求是SSL请求。
  • The server runs Apache 2.4, with no unusual timeout configurations (timeout is set to 45 seconds). 该服务器运行Apache 2.4,没有异常的超时配置(超时设置为45秒)。 Since the request fails after about 20 seconds, I do not think this is the limiting factor. 由于请求在20秒后失败,因此我认为这不是限制因素。

Further update: 进一步更新:

  • It turns out the 408 errors are completely unrelated. 原来408错误是完全不相关的。 They are just a result of Chrome's prefetching. 它们只是Chrome的预取结果。 It seems like the actual post data never makes it to the server, since there is no access log or error log entry corresponding with it. 似乎实际的过帐数据从未到达过服务器,因为没有与此相对应的访问日志或错误日志条目。

If is a 408 error, it means a timeout was reached. 如果是408错误,则表示已达到超时。 1. Have you tried with a different browser? 1.您是否尝试过使用其他浏览器? 2. Try finding the timeout settings for the server and increase it and see if that resolves the issue. 2.尝试查找服务器的超时设置并增加它,然后查看是否可以解决问题。 3. Use the debugger (if you can) to step through the code and see what happens with the error on the client-side 3.使用调试器(如果可以)单步执行代码,并在客户端查看错误发生了什么

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM