question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Storage: lots of "socket hang up" errors

See original GitHub issue

From @ovaris on September 21, 2017 8:31

Environment details

  • OS:
  • Node.js version: 8.5.0
  • npm version: 5.3.0
  • google-cloud-node/storage version: 1.2.1

I have a utlity nodejs script that checks existence of few thousands of files in cloud storage. I run script locally, so not in Cloud environment. I’m executing those checks (bucket.file(fileName).exists()) in batch of 20, so not all checks are fired concurrently. I’m seeing lots of these errors when trying to run script:

{ Error: socket hang up
    at TLSSocket.onHangUp (_tls_wrap.js:1140:19)
    at Object.onceWrapper (events.js:314:30)
    at emitNone (events.js:110:20)
    at TLSSocket.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',
  path: null,
  host: 'accounts.google.com',
  port: 443,
  localAddress: undefined }

and these:

{ Error: read ECONNRESET
    at _errnoException (util.js:1026:11)
    at TLSWrap.onread (net.js:606:25) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }

aaand these:

{ Error: socket hang up
    at createHangUpError (_http_client.js:345:15)
    at TLSSocket.socketOnEnd (_http_client.js:437:23)
    at emitNone (events.js:110:20)
    at TLSSocket.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' }

I have added this fix (suggested here: https://github.com/GoogleCloudPlatform/google-cloud-node/issues/2254):

const gcs = storage();
//https://github.com/GoogleCloudPlatform/google-cloud-node/issues/2254
gcs.interceptors.push({
    request: function(reqOpts) {
        reqOpts.forever = false;
        return reqOpts
    }
});

I have tried to reduce the check batch size, but it didn’t have any effect.

Copied from original issue: GoogleCloudPlatform/google-cloud-node#2623

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:42 (18 by maintainers)

github_iconTop GitHub Comments

22reactions
jeremymarccommented, Mar 20, 2018

still getting this issue with the last version. Any workaround?

5reactions
micahwedemeyercommented, Dec 18, 2018

Just updating anyone else still waiting: v2.3.3 still suffers from the FetchError: network timeout bug that I mentioned above. v2.1.0 is the latest version that even has a chance of working. v2.1.0 fails for me about 30% of the time, but the later versions fail 100% of the time.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storage: lots of "socket hang up" errors #2623 - GitHub
I have a utlity nodejs script that checks existence of few thousands of files in cloud storage. I run script locally, so not...
Read more >
NodeJS - What does "socket hang up" actually mean?
It means that socket does not send connection end event within the timeout period. If you are getting the request for cheerio via...
Read more >
How to handle a socket hang up error in Node.js usually - Quora
Socket hang up error are usually errors when requests coming to your server are more than it can handle.
Read more >
Socket hang up problems - Google Groups
Hi, I've been getting this issue every now and then on a long poll request. It doesn't happen consistently so I'm finding it...
Read more >
502 Bad Gateway - Socket hang up | Apigee Edge
The error code [socket hang up][ECONNRESET] indicates that the target server has closed the connection with Edge Microgateway. This can be searched in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found