This repository was archived by the owner on Mar 3, 2026. It is now read-only.
Repository navigation
This repository was archived by the owner on Mar 3, 2026. It is now read-only.
Storage: lots of "socket hang up" errors #27
Copy link
Copy link
Closed
Labels
🚨This issue needs some love.This issue needs some love.api: storageIssues related to the googleapis/nodejs-storage API.Issues related to the googleapis/nodejs-storage API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.status: investigatingThe issue is under investigation, which is determined to be non-trivial.The issue is under investigation, which is determined to be non-trivial.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Description
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: googleapis/google-cloud-node#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: googleapis/google-cloud-node#2623
Reacted by Zach Bjornson, Haokang Den, Amara Thota, Emmanuel Meric de Bellefon, mike-seekwell and Peter Hagen
Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.api: storageIssues related to the googleapis/nodejs-storage API.Issues related to the googleapis/nodejs-storage API.priority: p1Important issue which blocks shipping the next release. Will be fixed prior to next release.Important issue which blocks shipping the next release. Will be fixed prior to next release.status: investigatingThe issue is under investigation, which is determined to be non-trivial.The issue is under investigation, which is determined to be non-trivial.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Activity
lukesneeringer commentedon Sep 21, 2017
From @stephenplusplus on September 21, 2017 14:10
Can you share a small gist or repo that I can use to try to reproduce?
lukesneeringer commentedon Sep 21, 2017
From @ovaris on September 21, 2017 14:57
Here's gist, hopefully it makes sense: https://gist.github.com/ovaris/c30c492db06fbe73875ed71d00dcb547
lukesneeringer commentedon Sep 21, 2017
From @stephenplusplus on September 21, 2017 15:46
It's a bit hard to go from that, since I can't tap into the firebase instance. Can you try to replicate the problem without any external dependencies?
ovaris commentedon Sep 22, 2017
Here's simple test that replicates error, if I put 1000 times, it works, but with 3000 times it starts to fail:
ovaris commentedon Sep 29, 2017
This is a stupid user error and can be closed. Of course code above will fire ALL requests at the same time
ashleyhenderson commentedon Oct 7, 2017
ovaris, what code did you use to fix this issue? I'm having a similar problem where my code is firing 1000 database uploads at a time - hence the database returns socket hang up errors because of the excessive load
stephenplusplus commentedon Oct 8, 2017
Glad to hear this was resolved!
surjikal commentedon Jan 3, 2018
Getting some
ESOCKETTIMEDOUTerrors when usingcreateWriteStream. This problem was also posted on stackoverflow:https://stackoverflow.com/questions/47328578/getting-esockettimeout-econnreset-or-socket-hang-up-with-large-file-when-stream
I am opening at most 5 streams in parallel.
stephenplusplus commentedon Jan 3, 2018
@surjikal could you try using the latest version (v1.5.2) and if the problem persists, please open a new issue with reproduction steps and I'll check it out.
surjikal commentedon Jan 3, 2018
Cool will do, thanks.
jeremymarc commentedon Mar 20, 2018
still getting this issue with the last version. Any workaround?
40 remaining items
JustinBeckwith commentedon Feb 3, 2019
@kinwa91 @stephenplusplus this one has been going on for a while now, and I'm concerned about the whole downgrading to 2.1 thing. Can y'all prioritize an investigation for this tomorrow?
fix: remove timeout rule from streaming uploads (#365)
deps: update @google-cloud/common (#596)
stephenplusplus commentedon Feb 6, 2019
This should be resolved tomorrow morning, once a new release of @google-cloud/storage goes out. If you want to test in the meantime, please install from master and let me know how it goes!
stephenplusplus commentedon Feb 6, 2019
Tomorrow came earlier than expected-- v2.4.2 is out now! Please update and report back any lingering issues.
micahwedemeyer commentedon Feb 6, 2019
With v2.4.2 I was able to stream write 6 out of 6 files to GCS. With earlier versions, at least 2-3 of those would have failed, so this is much better.
The strange thing is that I still see a socket timeout error in the logs, but it looks as though the file was successfully written to GCS, so I'm not sure what's going on there. I'll keep an eye on it and report back.
Here's the error I saw:
Error: ESOCKETTIMEDOUT at ClientRequest.<anonymous> (/srv/node_modules/request/request.js:816:19) at Object.onceWrapper (events.js:313:30) at emitNone (events.js:106:13) at ClientRequest.emit (events.js:208:7) at TLSSocket.emitTimeout (_http_client.js:721:34) at Object.onceWrapper (events.js:313:30) at emitNone (events.js:106:13) at TLSSocket.emit (events.js:208:7) at TLSSocket.Socket._onTimeout (net.js:422:8) at ontimeout (timers.js:498:11)stephenplusplus commentedon Feb 6, 2019
requestshould be eliminated from thefile.createWriteStream({resumable:false})path. Are you using{resumable: true}? In either case, feel free to share additional details if the problem keeps up. Thanks for the update!micahwedemeyer commentedon Feb 7, 2019
Ugh, so stupid. I didn't deploy after making my updates. I'll deploy and check again. Sorry for the false alarm.
micahwedemeyer commentedon Feb 7, 2019
I ran another test today with 7 files and they all successfully streamed to GCS. Great work.
stephenplusplus commentedon Feb 7, 2019
Phew, glad to hear. Thanks for the update!
fix: remove timeout rule from streaming uploads (#365)
fix: remove timeout rule from streaming uploads (#365)