{"action":"created","issue":{"url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/27","repository_url":"https://api.github.com/repos/googleapis/nodejs-storage","labels_url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/27/labels{/name}","comments_url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/27/comments","events_url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/27/events","html_url":"https://github.com/googleapis/nodejs-storage/issues/27","id":259646668,"node_id":"MDU6SXNzdWUyNTk2NDY2Njg=","number":27,"title":"Storage: lots of \"socket hang up\" errors","user":{"login":"lukesneeringer","id":4346,"node_id":"MDQ6VXNlcjQzNDY=","avatar_url":"https://avatars0.githubusercontent.com/u/4346?v=4","gravatar_id":"","url":"https://api.github.com/users/lukesneeringer","html_url":"https://github.com/lukesneeringer","followers_url":"https://api.github.com/users/lukesneeringer/followers","following_url":"https://api.github.com/users/lukesneeringer/following{/other_user}","gists_url":"https://api.github.com/users/lukesneeringer/gists{/gist_id}","starred_url":"https://api.github.com/users/lukesneeringer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukesneeringer/subscriptions","organizations_url":"https://api.github.com/users/lukesneeringer/orgs","repos_url":"https://api.github.com/users/lukesneeringer/repos","events_url":"https://api.github.com/users/lukesneeringer/events{/privacy}","received_events_url":"https://api.github.com/users/lukesneeringer/received_events","type":"User","site_admin":false},"labels":[{"id":699306494,"node_id":"MDU6TGFiZWw2OTkzMDY0OTQ=","url":"https://api.github.com/repos/googleapis/nodejs-storage/labels/priority:%20p2","name":"priority: p2","color":"fef2c0","default":false}],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":11,"created_at":"2017-09-21T22:05:24Z","updated_at":"2018-07-20T23:25:37Z","closed_at":"2017-10-08T17:00:10Z","author_association":"MEMBER","body":"_From @ovaris on September 21, 2017 8:31_\n\n#### Environment details\r\n\r\n  - OS:\r\n  - Node.js version: 8.5.0\r\n  - npm version: 5.3.0\r\n  - google-cloud-node/storage version: 1.2.1\r\n\r\nI have a utlity nodejs script that checks existence of few thousands of files in cloud storage.\r\nI run script locally, so not in Cloud environment.\r\nI'm executing those checks (`bucket.file(fileName).exists()`) in batch of 20, so not all checks are fired concurrently.\r\nI'm seeing lots of these errors when trying to run script:\r\n```\r\n{ Error: socket hang up\r\n    at TLSSocket.onHangUp (_tls_wrap.js:1140:19)\r\n    at Object.onceWrapper (events.js:314:30)\r\n    at emitNone (events.js:110:20)\r\n    at TLSSocket.emit (events.js:207:7)\r\n    at endReadableNT (_stream_readable.js:1059:12)\r\n    at _combinedTickCallback (internal/process/next_tick.js:138:11)\r\n    at process._tickCallback (internal/process/next_tick.js:180:9)\r\n  code: 'ECONNRESET',\r\n  path: null,\r\n  host: 'accounts.google.com',\r\n  port: 443,\r\n  localAddress: undefined }\r\n```\r\nand these:\r\n```\r\n{ Error: read ECONNRESET\r\n    at _errnoException (util.js:1026:11)\r\n    at TLSWrap.onread (net.js:606:25) code: 'ECONNRESET', errno: 'ECONNRESET', syscall: 'read' }\r\n```\r\naaand these:\r\n```\r\n{ Error: socket hang up\r\n    at createHangUpError (_http_client.js:345:15)\r\n    at TLSSocket.socketOnEnd (_http_client.js:437:23)\r\n    at emitNone (events.js:110:20)\r\n    at TLSSocket.emit (events.js:207:7)\r\n    at endReadableNT (_stream_readable.js:1059:12)\r\n    at _combinedTickCallback (internal/process/next_tick.js:138:11)\r\n    at process._tickCallback (internal/process/next_tick.js:180:9) code: 'ECONNRESET' }\r\n```\r\nI have added this fix (suggested here: https://github.com/GoogleCloudPlatform/google-cloud-node/issues/2254):\r\n```\r\nconst gcs = storage();\r\n//https://github.com/GoogleCloudPlatform/google-cloud-node/issues/2254\r\ngcs.interceptors.push({\r\n    request: function(reqOpts) {\r\n        reqOpts.forever = false;\r\n        return reqOpts\r\n    }\r\n});\r\n```\r\n\r\nI have tried to reduce the check batch size, but it didn't have any effect. \n\n_Copied from original issue: GoogleCloudPlatform/google-cloud-node#2623_"},"comment":{"url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/comments/406750265","html_url":"https://github.com/googleapis/nodejs-storage/issues/27#issuecomment-406750265","issue_url":"https://api.github.com/repos/googleapis/nodejs-storage/issues/27","id":406750265,"node_id":"MDEyOklzc3VlQ29tbWVudDQwNjc1MDI2NQ==","user":{"login":"danielrasmuson","id":4013767,"node_id":"MDQ6VXNlcjQwMTM3Njc=","avatar_url":"https://avatars2.githubusercontent.com/u/4013767?v=4","gravatar_id":"","url":"https://api.github.com/users/danielrasmuson","html_url":"https://github.com/danielrasmuson","followers_url":"https://api.github.com/users/danielrasmuson/followers","following_url":"https://api.github.com/users/danielrasmuson/following{/other_user}","gists_url":"https://api.github.com/users/danielrasmuson/gists{/gist_id}","starred_url":"https://api.github.com/users/danielrasmuson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danielrasmuson/subscriptions","organizations_url":"https://api.github.com/users/danielrasmuson/orgs","repos_url":"https://api.github.com/users/danielrasmuson/repos","events_url":"https://api.github.com/users/danielrasmuson/events{/privacy}","received_events_url":"https://api.github.com/users/danielrasmuson/received_events","type":"User","site_admin":false},"created_at":"2018-07-20T23:25:37Z","updated_at":"2018-07-20T23:25:37Z","author_association":"NONE","body":"I can confirm I also occasionally receive this error with...\r\n\r\n```\r\nfunction uploadFile(path, fileContents) {\r\n  const file = bucket.file(path);\r\n  const stream = file.createWriteStream({});\r\n  return new Promise((resolve, reject) => {\r\n    stream.on('error', () => reject());\r\n    stream.on('finish', () => resolve());\r\n    stream.end(new Buffer(fileContents));\r\n  });\r\n}\r\n```\r\n\r\nRight now my work around it to just retry the request.\r\n\r\nInterested if anyone else knows of a better workaround."}}
{"actor":{"display_login":"danielrasmuson"}}