I read all the related issues in SO and GitHub about this error, and none of them seem to address this situation.
When I run the following code:
response = await axios.get('http://localhost:8082/panda, { httpAgent: new http.Agent({ keepAlive: true, keepAliveMsecs: 10000 }) });
I get the following error:
{ 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...
There is no stack trace behind the onread call, so it is unclear how I can get additional information for the ECONNRESET error ECONNRESET (-54) passed to the onread method in net.js
This problem occurs with every request - it is not intermittent.
A few observations:
- when executing the same request from chrome or the postman, the request DOES NOT EXIT
- attempting to play a successful request from Chrome using the same headers fails.
- setting the accept header to use "gzip", etc. Does not help. I tried all the recommendations, including some weird ones, like setting the length of the content and adding the body to the request, even though it is a GET request
- the error always appears in net.js, but it happens both with request libraries and with axioms.
Here's the interesting part - I can only reproduce this problem reliably when I host the server locally . I can contact the dev instance or start the server in the rover, through the docker container, without any problems.
I am running macOS Sierra 10.12.6 if that matters. The server is written in Java and uses the Spring framework. Here is the RestTemplate configuration that I use for HTTP calls:
@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); }
I tried communicating with these settings without any luck.
Any ideas?
Jordan
source share