HTTP请求 - 缺少响应 - net_error = -3(ERR_ABORTED)

时间:2016-02-23 15:15:35

标签: javascript ajax google-chrome ssl xmlhttprequest

我正在使用 RESTful API CORS 。有时(无法重现何时/为什么会发生)AJAX-Request被客户端中止并且没有响应。这不仅发生在chrome中,也影响其他浏览器。我尝试了很多调试并搜索了很多解决方案,但我现在没有找到。所有请求都由服务器处理得很好,只有响应阻止 客户端

以下是基于请求的chrome://net-internals/#events,该请求被错误net_error = -3 (ERR_ABORTED)中止。大多数情况下,使用SSL时会出现此问题,但SSL未在使用中。

2681: URL_REQUEST
http://solid-rm-api/api/role/create
Start Time: 2016-02-23 15:55:16.152

t=97023 [st=   0] +REQUEST_ALIVE  [dt=1930]
t=97023 [st=   0]    URL_REQUEST_DELEGATE  [dt=0]
t=97023 [st=   0]   +URL_REQUEST_START_JOB  [dt=1930]
--> load_flags = 34626 (BYPASS_CACHE | DO_NOT_SAVE_COOKIES | DO_NOT_SEND_AUTH_DATA | DO_NOT_SEND_COOKIES | MAYBE_USER_GESTURE | VERIFY_EV_CERT)
--> method = "POST"
--> priority = "LOW"
--> upload_id = "0"
--> url = "http://solid-rm-api/api/role/create"
t=97023 [st=   0]      URL_REQUEST_DELEGATE  [dt=0]
t=97023 [st=   0]      HTTP_CACHE_GET_BACKEND  [dt=0]
t=97023 [st=   0]      URL_REQUEST_DELEGATE  [dt=0]
t=97023 [st=   0]     +HTTP_STREAM_REQUEST  [dt=1]
t=97023 [st=   0]        HTTP_STREAM_REQUEST_STARTED_JOB
--> source_dependency = 2683 (HTTP_STREAM_JOB)
t=97024 [st=   1]        HTTP_STREAM_REQUEST_BOUND_TO_JOB
--> source_dependency = 2683 (HTTP_STREAM_JOB)
t=97024 [st=   1]     -HTTP_STREAM_REQUEST
t=97024 [st=   1]     +HTTP_TRANSACTION_SEND_REQUEST  [dt=0]
t=97024 [st=   1]        HTTP_TRANSACTION_SEND_REQUEST_HEADERS
--> POST /api/role/create HTTP/1.1
                             Host: solid-rm-api
                             Connection: keep-alive
                             Content-Length: 404
                             Pragma: no-cache
                             Cache-Control: no-cache
                             Origin: http://127.0.0.1:8080
                             User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/48.0.2564.116 Safari/537.36
                             App-Token: ABC
                             Content-Type: application/x-www-form-urlencoded;charset=UTF-8
                             Accept: application/json, text/plain, */*
                             Token: 123123123123123123123123
                             Referer: http://127.0.0.1:8080/src/
                             Accept-Encoding: gzip, deflate
                             Accept-Language: de-DE,de;q=0.8,en-US;q=0.6,en;q=0.4
t=97024 [st=   1]        HTTP_TRANSACTION_SEND_REQUEST_BODY
                         --> did_merge = true
                         --> is_chunked = false
                         --> length = 404
t=97024 [st=   1]     -HTTP_TRANSACTION_SEND_REQUEST
t=97024 [st=   1]     +HTTP_TRANSACTION_READ_HEADERS  [dt=1929]
t=97024 [st=   1]       +HTTP_STREAM_PARSER_READ_HEADERS  [dt=1929]
t=98953 [st=1930]          CANCELLED
t=98953 [st=1930]   -URL_REQUEST_START_JOB
                     --> net_error = -3 (ERR_ABORTED)
t=98953 [st=1930]    URL_REQUEST_DELEGATE  [dt=0]
t=98953 [st=1930] -REQUEST_ALIVE

如果您需要更多信息,请与我们联系。

1 个答案:

答案 0 :(得分:1)

几个月后回到这里。事实证明,net_error = -3 (ERR_ABORTED) 总是由应用程序本身触发的超时中止状态。在我们的例子中,XHR-Timeout被第三方库全局覆盖。它被此库设置为2000ms。以这种方式,我们的一些花费超过2000毫秒的请求被客户端中止。结果是net_error = -3 (ERR_ABORTED)

如果您遇到同样的问题。检查代码并确保根据需要配置应用程序中设置的超时。