Jor*_*dan 10 javascript java spring node.js axios
我已经阅读了SO和GitHub上有关此错误的所有相关问题,但它们似乎都没有解决这种情况.
当我运行以下代码时:
response = await axios.get('http://localhost:8082/panda, {
httpAgent: new http.Agent({ keepAlive: true, keepAliveMsecs: 10000 })
});
Run Code Online (Sandbox Code Playgroud)
我收到以下错误:
{ Error: socket hang up
at createHangUpError (_http_client.js:345:15)
at Socket.socketOnEnd (_http_client.js:437:23)
at emitNone (events.js:110:20)
at Socket.emit (events.js:207:7)
at endReadableNT (_stream_readable.js:1059:12)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9) code: 'ECONNRESET' }
{ Error: read ECONNRESET
at _errnoException (util.js:1019:11)
at TCP.onread (net.js:608:25)
code: 'ECONNRESET',
errno: 'ECONNRESET',
syscall: 'read',
etc...
Run Code Online (Sandbox Code Playgroud)
除了onread调用之外没有堆栈跟踪所以我不清楚如何获得除了ECONNRESET传递给onreadnet.js中的方法的错误代码(-54)之外的任何其他信息
每个请求都会出现此问题 - 它不是间歇性的.
一些观察:
这是有趣的部分 - 当我在本地托管服务器时,我似乎只能可靠地重现这个问题.我能够通过docker容器到达dev实例或在vagrant中运行服务器,没有问题.
如果这有任何区别,我正在运行macOS Sierra 10.12.6.服务器是用Java编写的,并使用Spring框架.这是RestTemplate我用于HTTP调用的配置:
@Bean
public RestTemplate restTemplate() {
//request timeout
int timeout = 5000;
//Connection Pooling factory with timeouts to prevent disastrous request responses
HttpComponentsClientHttpRequestFactory cf = new HttpComponentsClientHttpRequestFactory();
cf.setReadTimeout(timeout);
cf.setConnectTimeout(timeout);
cf.setConnectionRequestTimeout(timeout);
return new RestTemplate(cf);
}
Run Code Online (Sandbox Code Playgroud)
我已经尝试过乱搞这些设置而没有运气.
有任何想法吗?
| 归档时间: |
|
| 查看次数: |
6989 次 |
| 最近记录: |