简体   繁体   中英

Random jQuery Ajax calls inconsistently fail

Using jQuery, I take form submissions and run them as AJAX requests instead. 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:

Chrome Web检查器显示请求失败

Tracking down the IP address in the Apache log, I seem to see an error 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).

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.

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.
  • The server runs Apache 2.4, with no unusual timeout configurations (timeout is set to 45 seconds). Since the request fails after about 20 seconds, I do not think this is the limiting factor.

Further update:

  • It turns out the 408 errors are completely unrelated. They are just a result of Chrome's prefetching. 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. 1. Have you tried with a different browser? 2. Try finding the timeout settings for the server and increase it and see if that resolves the issue. 3. Use the debugger (if you can) to step through the code and see what happens with the error on the client-side

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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