Could not get response error socket hang up

Describe the bug Just updated to 7.3.2. After Postman restarted I tried the same API call I was using before the update and get the error message below: Could not get any response There was an erro...

Describe the bug
Just updated to 7.3.2. After Postman restarted I tried the same API call I was using before the update and get the error message below:

Could not get any response
There was an error connecting to .
Why this might have happened:
The server couldn't send a response:
Ensure that the backend is working properly
Self-signed SSL certificates are being blocked:
Fix this by turning off 'SSL certificate verification' in Settings > General
Proxy configured incorrectly
Ensure that proxy is configured correctly in Settings > Proxy
Request timeout:
Change request timeout in Settings > General

To Reproduce
Steps to reproduce the behavior:

  1. Update Postman from 7.2.2 to 7.3.2
  2. Attempt an API call

Expected behavior
For Postman to work like it did before the update :)

App information (please complete the following information):

  • Native Windows App
  • Postman Version 7.3.2
  • OS: Windows Server 2016

Additional context
I have other API tools on my system. All others have no problems connecting to my API.

From the renderer-requester.log file

[9496][1562709717078][requester][warn]["APIDevService~getAPIs: Failed to get APIs.",{"error":{"details":"{"fingerprint":"CsHgOUF8ITVt7Ym8AFXs#1946700#GET#/apis?workspace=f52d2657-5cc7-4b3f-ae73-93552a87361d#0#1","time":1562709716992,"blocked":true,"throttled":true,"locked":1,"waiting":true,"dna":{"762939002":true}}","message":"A previous request is still getting processed.","name":"throttleError"},"headers":{"Access-Control-Allow-Credentials":"","Access-Control-Allow-Headers":"","Access-Control-Allow-Methods":"","Access-Control-Allow-Origin":"","Access-Control-Expose-Headers":""},"status":429}]
[9496][1562709717081][requester][warn]["Failed to refresh API List",{"error":{"details":"{"fingerprint":"CsHgOUF8ITVt7Ym8AFXs#1946700#GET#/apis?workspace=f52d2657-5cc7-4b3f-ae73-93552a87361d#0#1","time":1562709716992,"blocked":true,"throttled":true,"locked":1,"waiting":true,"dna":{"762939002":true}}","message":"A previous request is still getting processed.","name":"throttleError"},"headers":{"Access-Control-Allow-Credentials":"","Access-Control-Allow-Headers":"","Access-Control-Allow-Methods":"","Access-Control-Allow-Origin":"","Access-Control-Expose-Headers":""},"status":429}]
[9496][1562709718429][requester][error]["APIDevService~getTeamForAllAPIs: apiIds are mandatory"]
[9496][1562709718436][requester][warn]["Failed to get team",{"name":"Error","message":"Something went wrong while getting team for the APIs.","stack":"Error: Something went wrong while getting team for the APIs.n    at Object.getTeamForAllAPIs (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:91302:29)n    at APIListStore.getTeam (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:683451:85)n    at __WEBPACK_IMPORTED_MODULE_3__services_APIDevService__.a.getAPIs.then.apis (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:683296:14)"}]
[9496][1562709718447][requester][error]["APIDevService~getTeamForAllAPIs: apiIds are mandatory"]
[9496][1562709718448][requester][warn]["Failed to get team",{"name":"Error","message":"Something went wrong while getting team for the APIs.","stack":"Error: Something went wrong while getting team for the APIs.n    at Object.getTeamForAllAPIs (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:91302:29)n    at APIListStore.getTeam (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:683451:85)n    at __WEBPACK_IMPORTED_MODULE_3__services_APIDevService__.a.getAPIs.then.apis (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:683313:12)"}]
[9496][1562709719121][requester][error]["APIDevService~fetchPermissions: permissionQueryObject is a mandatory property"]
[9496][1562709719122][requester][warn]["Failed to get permissions",{"name":"Error","message":"Something went wrong while fetching the API permissions.","stack":"Error: Something went wrong while fetching the API permissions.n    at Object.fetchPermissions (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:91241:29)n    at __WEBPACK_IMPORTED_MODULE_7__js_modules_controllers_CurrentUserController__.a.get.then.user (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:683428:89)"}]
[9496][1562709719130][requester][error]["APIDevService~fetchPermissions: permissionQueryObject is a mandatory property"]
[9496][1562709719131][requester][warn]["Failed to get permissions",{"name":"Error","message":"Something went wrong while fetching the API permissions.","stack":"Error: Something went wrong while fetching the API permissions.n    at Object.fetchPermissions (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:91241:29)n    at __WEBPACK_IMPORTED_MODULE_7__js_modules_controllers_CurrentUserController__.a.get.then.user (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:683428:89)"}]
[9496][1562711040830][requester][error]["APIDevService~getTeamForAllAPIs: apiIds are mandatory"]
[9496][1562711040833][requester][warn]["Failed to get team",{"name":"Error","message":"Something went wrong while getting team for the APIs.","stack":"Error: Something went wrong while getting team for the APIs.n    at Object.getTeamForAllAPIs (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:91302:29)n    at APIListStore.getTeam (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:683451:85)n    at __WEBPACK_IMPORTED_MODULE_3__services_APIDevService__.a.getAPIs.then.apis (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:683296:14)"}]
[9496][1562711040884][requester][error]["APIDevService~fetchPermissions: permissionQueryObject is a mandatory property"]
[9496][1562711040885][requester][warn]["Failed to get permissions",{"name":"Error","message":"Something went wrong while fetching the API permissions.","stack":"Error: Something went wrong while fetching the API permissions.n    at Object.fetchPermissions (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:91241:29)n    at __WEBPACK_IMPORTED_MODULE_7__js_modules_controllers_CurrentUserController__.a.get.then.user (file:///C:/Users/trey/AppData/Local/Postman/app-7.3.2/resources/app.asar/js/vendor-shared.js:683428:89)"}]

I just started using Postman. I had this error «Error: socket hang up» when I was executing a collection runner. I’ve read a few post regarding socket hang up and it mention about sending a request and there’s no response from the server side and probably timeout. How do I extend the length of time of the request in Postman Collection Runner?

16 Answers

Socket hang up, error is port related error. I am sharing my experience. When you use same port for connecting database, which port is already in use for other service, then «Socket Hang up» error comes out.

eg:- port 6455 is dedicated port for some other service or connection. You cannot use same port (6455) for making a database connection on same server.

Sometimes, this error rises when a client waits for a response for a very long time. This can be resolved using the 202 (Accepted) Http code. This basically means that you will tell the server to start the job you want it to do, and then, every some-time-period check if it has finished the job.

If you are the one who wrote the server, this is relatively easy to implement. If not, check the documentation of the server you’re using.

Postman was giving «Could not get response» «Error: socket hang up».
I solved this problem by adding the Content-Length http header to my request

Are you using nodemon, or some other file-watcher? In my case, I was generating some local files, uploading them, then sending the URL back to my user. Unfortunately nodemon would see the «changes» to the project, and trigger a restart before a response was sent. I ignored the build directories from my file-watcher and solved this issue.

Here is the Nodemon readme on ignoring files: https://github.com/remy/nodemon#ignoring-files

I have just faced the same problem and I fixed it by close my VPN. So I guess that’s a network agent problem. You can check if you have some network proxy is on.

Socket hang up error could be due to the wrong URL of the API you are trying to access in the postman. please check the URL once carefully.

I solved this problem with disconnection my vpn. you should check if there is vpn connected.

this happaned when client wait for response for long time
try to sync your API requests from postman

then make login post and your are done

If Postman doesn’t get response within a specified time it will throw the error «socket hang up».

I was doing something like below to achieve 60 minutes of delay between each scenario in a collection:

get https://postman-echo.com/delay/10
pre request script :-
setTimeout(function(){}, [50000]);

I reduced time duration to 30 seconds:

setTimeout(function(){}, [20000]);

After that I stopped getting this error.

I had the same issue: «Error: socket hang up» when sending a request to store a file and backend logs mentioned a timeout as you described. In my case I was using mongoDB and the real problem was my collection’s array capacity was full. When I cleared the documents in that collection the error was dismissed. Hope this will help someone who faces a similar scenario.

It’s possible there are 2 things, happening at the same time.

  1. The url contains a port which is not commonly used AND
  2. you are using a VPN or proxy that does not support that port.

I had this problem. My server port was 45860 and I was using pSiphon anti-filter VPN. In that condition my Postman reported «connection hang-up» only when server’s reply was an error with status codes bigger than 0. (It was fine when some text was returning from server with no error code.)

When I changed my web service port to 8080 on my server, WOW, it worked! even though pSiphon VPN was connected.

Following on Abhay’s answer: double check the scheme. A server that is secured may disconnect if you call an https endpoint with http.

This happened to me while debugging an ASP.NET Core API running on localhost using the local cert. Took me a while to figure out since it was inside a Postman environment and also it was a Monday.

«Socket Hung Up» can be on-premise issue some time’s, because, of bottle neck in %temp% folder, try to free up the «temp» folder and give a try

I fixed this issue by disabling Postman token header.screenshot

What helped for me was replacing ‘localhost’ in the url to http://127.0.0.1 or whatever other address your local machine has assigned localhost to.

Pure of heart, life is full of sweet and joy. — Leo Tolstoy

Socket hang up first appeared in a service load test and was later resolved. Recently, this problem was reported again when node.js service migrated to K8S container. After checking the cause, it was found that the container’S CPU and memory size were limited. Here is a summary of what Socket hang up is, when it happens, and how to solve it.

About the author: May Jun, Nodejs Developer, moOCs certified author, love technology, like sharing, welcome to pay attention to Nodejs technology stack and Github open source project www.nodejs.red

What is a Socket hang up

What is a Socket hang up?

Socket hang up means that the socket (link) is hung up. No matter which language you use, you should have encountered it more or less, but have you ever thought about why? For example, in Node.js, the system provides a default timeout of 2 minutes for the HTTP server. If a request exceeds this time, the HTTP server will close the request. When a client tries to return a request and finds that the socket has been «hung up», it sends a socket hang up error.

To understand a problem, or to practice more, the following is a small demo of the problem and then combine with node.js HTTP related source code to further understand Socket hang up? Also recommend that you look at the stack overflow of the universal also has a discussion on the issue above stackoverflow.com/questions/1… .

Replicating Socket hang up

The service side

To start an HTTP service, define the /timeout interface to delay the response for 3 minutes

const http = require('http');
const port = 3020;

const server = http.createServer((request, response) =  {
    console.log('request url: ', request.url);

    if (request.url === '/timeout') {
        setTimeout(function() {
            response.end('OK! ');
        }, 1000 * 60 * 3)
    }
}).listen(port);

console.log('server listening on port ', port);
Copy the code

The client

const http = require('http');
const opts = {
  hostname: '127.0.0.1'.port: 3020.path: '/timeout'.method: 'GET'}; http.get(opts, (res) = {let rawData = ' ';
  res.on('data', (chunk) = { rawData += chunk; });
  res.on('end', () =  {try {
      console.log(rawData);
    } catch (e) {
      console.error(e.message); }}); }).on('error', err = {
  console.error(err);
});
Copy the code

After starting the server and then starting the client about 2 minutes later or directly killing the server, the following error is reported. You can see the corresponding error stack

Error: socket hang up
    at connResetException (internal/errors.js:570:14)
    at Socket.socketOnEnd (_http_client.js:440:23)
    at Socket.emit (events.js:215:7)
    at endReadableNT (_stream_readable.js:1183:12)
    at processTicksAndRejections (internal/process/task_queues.js:80:21) {
  code: 'ECONNRESET'
}
Copy the code

The node.js HTTP client source code does not receive any response, so it is considered that the socket has ended. A connResetException(‘socket hang up’) error is therefore emitted at L440.

// https://github.com/nodejs/node/blob/v12.x/lib/_http_client.js#L440

function socketOnEnd() {
  const socket = this;
  const req = this._httpMessage;
  const parser = this.parser;

  if(! req.res  ! req.socket._hadError) {// If we don't have a response then we know that the socket
    // ended prematurely and we need to emit an error on the request.
    req.socket._hadError = true;
    req.emit('error', connResetException('socket hang up'));
  }
  if (parser) {
    parser.finish();
    freeParser(parser, req, socket);
  }
  socket.destroy();
}
Copy the code

Socket hang up Solution

1. Set the TIMEOUT period of the HTTP Server socket

By default, the timeout value of the server is 2 minutes. If it does, the socket will automatically destroy itself. You can use the server.setTimeout(msecs) method to set the timeout to a larger value. Passing a 0 will turn off the timeout mechanism

// https://github.com/nodejs/node/blob/v12.x/lib/_http_server.js#L348
function Server(options, requestListener) {
  // ...

  this.timeout = kDefaultHttpServerTimeout; // The default value is 2 x 60 x 1000
  this.keepAliveTimeout = 5000;
  this.maxHeadersCount = null;
  this.headersTimeout = 40 * 1000; // 40 seconds
}
Object.setPrototypeOf(Server.prototype, net.Server.prototype);
Object.setPrototypeOf(Server, net.Server);


Server.prototype.setTimeout = function setTimeout(msecs, callback) {
  this.timeout = msecs;
  if (callback)
    this.on('timeout', callback);
  return this;
};
Copy the code

The modified code looks like this:

const server = http.createServer((request, response) =  {
    console.log('request url: ', request.url);

    if (request.url === '/timeout') {
        setTimeout(function() {
            response.end('OK! ');
        }, 1000 * 60 * 3)
    }
}).listen(port);

server.setTimeout(0); // Set the timeout period
Copy the code

If you do not set setTimeout, you can also catch such errors on the HTTP client, put them in the queue and initiate retry. If the probability of such errors is high, you should check whether the corresponding service has abnormal problems such as slow processing.

ECONNRESET VS ETIMEDOUT

Note the difference between ECONNRESET and ETIMEDOUT

ECONNRESET is read timeout. {«code»:»ECONNRESET»} error occurs when the server is too slow to respond properly, such as the socket hang up example described above.

ETIMEDOUT refers to the timeout that occurs when a client initiates a connection with a remote server. Here is an example of a request from the Request module.

const request = require('request');

request({
  url: 'http://127.0.0.1:3020/timeout'.timeout: 5000,
}, (err, response, body) = {
  console.log(err, body);
});
Copy the code

In the above example, {code: ‘ETIMEDOUT’} error is reported after approximately 5 seconds, and the stack is as follows:

Error: ETIMEDOUT
    at Timeout._onTimeout (/Users/test/node_modules/request/request.js:677:15)
    at listOnTimeout (internal/timers.js:531:17)
    at processTimers (internal/timers.js:475:7) {
  code: 'ETIMEDOUT'
}
Copy the code

In this article, we will see some of the solutions to the error “socket hang up” in Docker. At Bobcares, with our Docker Hosting Support Services, we can handle your Docker Hang-up issues.

Error “Socket Hang Up” In Docker

Docker avoids repetitive, tedious config processes and is used across the development lifecycle for quick, simple, and portable app development – desktop and cloud. Its full end-to-end platform comprises UIs, CLIs, APIs, and security that are designed to operate together throughout the whole app delivery lifecycle.

It uses OS-level virtualization to deliver software in packages called containers. It is a small, stand-alone software package that contains everything needed to run an app: code, runtime, system tools, system libraries, and settings.

Here, when the user successfully built and started the Docker container, it is up and running. However, when tried to use it after removing the containers and images and rebuilding it, the following error appears:

error socket hang up docker

Other User Details

Docker File

Container Creation:

# Create Virtual Network
$ sudo docker network create network1 
# Using custom network as there are multiple containers 
# which communicate with each other

# Create Containers
$ sudo docker build -t form_ocr:latest .
$ sudo docker run -d -p 6001:5000 --net network1 --name form_ocr form_ocr


The output of netstat command:

$ netstat -nltp 
...
tcp6 0 0 :::6001 :::* LISTEN -

The output of the Docker container inspect:

$ sudo docker container inspect 

Output (docker ps output):

$ sudo docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
835e8cb11eee form_ocr "python3 app.py" 16 hours ago Up 40 seconds 0.0.0.0:6001->5000/tcp form_ocr

Multiple Solutions For The Error “Socket Hang Up” In Docker

Solution 1: Simply include the following code in main.ts, where we listen to the port.

await app.listen(6001, '0.0.0.0', ()  => console.log(`Listening on port:  6000`));

Also include the ‘0.0.0.0’, it should work.

Solution 2: Check that the app is listening on 0.0.0.0 inside the container.

Solution 3: Instead of an internet address, try localhost:6001. We can also try any of the system’s local IP addresses, which we can find by typing ifconfig or ipconfig in Linux or Windows, respectively.

[Looking for a solution to another query? We are just a click away.]

Conclusion

The article provides three solutions from our Tech team to fix the error, “socket hang up” in Docker.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

Есть два случая, когда socket hang up бросается:

Когда вы клиент

Когда вы, как клиент, отправляете запрос на удаленный сервер и не получаете своевременного ответа. Ваш сокет завершен, что вызывает эту ошибку. Вы должны поймать эту ошибку и решить, как с ней справиться: повторить ли запрос, поставить его в очередь на потом и т. д.

Когда вы сервер/прокси

Когда вы, как сервер, возможно, прокси-сервер, получаете запрос от клиента, затем начинаете действовать по нему (или ретранслируете запрос вышестоящему серверу), и до того, как вы подготовили ответ, клиент решает отменить/прервать запрос.

Эта трассировка стека показывает, что происходит, когда клиент отменяет запрос.

Trace: { [Error: socket hang up] code: 'ECONNRESET' }
    at ClientRequest.proxyError (your_server_code_error_handler.js:137:15)
    at ClientRequest.emit (events.js:117:20)
    at Socket.socketCloseListener (http.js:1526:9)
    at Socket.emit (events.js:95:17)
    at TCP.close (net.js:465:12)

линия http.js:1526:9указывает на то же самое socketCloseListener упоминается @Blender, в частности:

// This socket error fired before we started to
// receive a response. The error needs to
// fire on the request.
req.emit('error', createHangUpError());

...

function createHangUpError() {
  var error = new Error('socket hang up');
  error.code = 'ECONNRESET';
  return error;
}

Это типичный случай, если клиент является пользователем в браузере. Запрос на загрузку какого-либо ресурса/страницы занимает много времени, и пользователи просто обновляют страницу. Такое действие приводит к прерыванию предыдущего запроса, что на стороне вашего сервера вызывает эту ошибку.

Поскольку эта ошибка вызвана желанием клиента, он не ожидает получить какое-либо сообщение об ошибке. Так что не стоит считать эту ошибку критической. Просто игнорируйте это. Этому способствует тот факт, что при такой ошибке res сокет, который слушал ваш клиент, хотя и доступен для записи, но уничтожен.

console.log(res.socket.destroyed); //true

Итак, нет смысла отправлять что-либо, кроме явного закрытия объекта ответа:

res.end();

Однако то, что вы следует сделать конечно, если вы Он прокси-сервер, который уже передал запрос восходящему потоку, должен прервать ваш внутренний запрос к восходящему, указывая на ваше отсутствие интереса к ответу, что, в свою очередь, скажет вышестоящему серверу, возможно, остановить дорогостоящую операцию.

Здравствуйте, при подключение к веб сайту

client.connect('ws://gowin.me:8080/', 'echo-protocol');

Выводит в лог ошибку Error: socket hang up.. и как ее исправить?
Код стандартный, который дан на npm websocket

var WebSocketClient = require('websocket').client;
 
var client = new WebSocketClient();
 
client.on('connectFailed', function(error) {
    console.log('Connect Error: ' + error.toString());
});
 
client.on('connect', function(connection) {
    console.log('WebSocket Client Connected');
    connection.on('error', function(error) {
        console.log("Connection Error: " + error.toString());
    });
    connection.on('close', function() {
        console.log('echo-protocol Connection Closed');
    });
    connection.on('message', function(message) {
        if (message.type === 'utf8') {
            console.log("Received: '" + message.utf8Data + "'");
        }
    });
    
    function sendNumber() {
        if (connection.connected) {
            var number = Math.round(Math.random() * 0xFFFFFF);
            connection.sendUTF(number.toString());
            setTimeout(sendNumber, 1000);
        }
    }
    sendNumber();
});
 
client.connect('ws://gowin.me:8080/', 'echo-protocol');

Что делать?

Понравилась статья? Поделить с друзьями:
  • Could not complete the liquify command because of a disk error
  • Could not complete the camera raw filter command because of a program error
  • Could not clear dns cache getexitcodeprocess failed with error 1 proxifier
  • Could not boot exec format error
  • Could not bind to host ошибка банджикорд