在HTTP_STREAM_PARSER_READ_HEADERS之后,AJAX请求被取消

时间:2016-04-03 22:52:47

标签: javascript ajax xmlhttprequest

我的XMLHttpRequests正在被取消,但似乎仍然成功运行(数据到达服务器)。另一个问题建议查看chrome事件有一个原因,它似乎在HTTP_STREAM_PARSER_READ_HEADERS

之后取消

以下是请求事件,并了解可能导致此问题的原因或我可以尝试的进一步故障排除?:

t=1125 [st= 0] +REQUEST_ALIVE [dt=250]
t=1125 [st= 0] URL_REQUEST_DELEGATE [dt=0]
t=1125 [st= 0] +URL_REQUEST_START_JOB [dt=250]
--> load_flags = 33024 (MAYBE_USER_GESTURE | VERIFY_EV_CERT)
--> method = "PUT"
--> priority = "LOW"
--> upload_id = "0"
--> url = [Redacted]
t=1125 [st= 0] +URL_REQUEST_DELEGATE [dt=1]
t=1125 [st= 0] DELEGATE_INFO [dt=1]
--> delegate_info = "extension Tampermonkey"
t=1126 [st= 1] -URL_REQUEST_DELEGATE
t=1126 [st= 1] HTTP_CACHE_GET_BACKEND [dt=0]
t=1126 [st= 1] HTTP_CACHE_OPEN_ENTRY [dt=0]
t=1126 [st= 1] HTTP_CACHE_ADD_TO_ENTRY [dt=0]
t=1126 [st= 1] HTTP_CACHE_READ_INFO [dt=0]
t=1126 [st= 1] URL_REQUEST_DELEGATE [dt=0]
t=1126 [st= 1] +HTTP_STREAM_REQUEST [dt=198]
t=1126 [st= 1] HTTP_STREAM_REQUEST_STARTED_JOB
--> source_dependency = 82675 (HTTP_STREAM_JOB)
t=1324 [st=199] HTTP_STREAM_REQUEST_BOUND_TO_JOB
--> source_dependency = 82675 (HTTP_STREAM_JOB)
t=1324 [st=199] -HTTP_STREAM_REQUEST
t=1324 [st=199] +HTTP_TRANSACTION_SEND_REQUEST [dt=0]
t=1324 [st=199] HTTP_TRANSACTION_SEND_REQUEST_HEADERS
--> PUT /users/[Redacted] HTTP/1.1
Host: [Redacted]
Connection: keep-alive
Content-Length: 4545
X-NewRelic-ID: UwUDUlFADQEGUlFb
Origin: [Redacted]
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/49.0.2623.110 Safari/537.36
Content-Type: application/json
Accept: /
X-Requested-With: XMLHttpRequest
Referer: [Redacted]
Accept-Encoding: gzip, deflate, sdch
Accept-Language: en-US,en;q=0.8
Cookie: [1850 bytes were stripped]
t=1324 [st=199] HTTP_TRANSACTION_SEND_REQUEST_BODY
--> did_merge = false
--> is_chunked = false
--> length = 4545
t=1324 [st=199] -HTTP_TRANSACTION_SEND_REQUEST
t=1324 [st=199] +HTTP_TRANSACTION_READ_HEADERS [dt=51]
t=1324 [st=199] +HTTP_STREAM_PARSER_READ_HEADERS [dt=51]
t=1374 [st=249] CANCELLED
t=1375 [st=250] -URL_REQUEST_START_JOB
--> net_error = -3 (ERR_ABORTED)
t=1375 [st=250] URL_REQUEST_DELEGATE [dt=0]
t=1375 [st=250] -REQUEST_ALIVE

3 个答案:

答案 0 :(得分:1)

我在chrome://net-internals/#events收到同样的错误。在我的例子中,AJAX请求具有以下形式: $.ajax({ ... timeout: 3000 // coming dynamically in my case ...}); 因此,所有超过3000毫秒的请求都会被自动取消。

现在,您的解决方案取决于您的应用程序是否要增加客户端的超时或改善服务器端的服务。

答案 1 :(得分:0)

我们遇到了同样的问题。最后,事实证明,AJAX请求(来自UI代码)错误地将超时设置为3秒而不是30秒。更新超时修复了问题

答案 2 :(得分:0)

在我的情况下,同一请求正在执行 TWICE (从代码中的其他位置执行)。因此,第二个请求取消了第一个请求,但是由于第二个请求成功,因此数据从服务器OK取回。嘘!