{"action":"created","issue":{"url":"https://api.github.com/repos/request/request/issues/1878","labels_url":"https://api.github.com/repos/request/request/issues/1878/labels{/name}","comments_url":"https://api.github.com/repos/request/request/issues/1878/comments","events_url":"https://api.github.com/repos/request/request/issues/1878/events","html_url":"https://github.com/request/request/issues/1878","id":114291915,"number":1878,"title":"FormData Stream => Random ECONNRESET","user":{"login":"sdnetwork","id":4857051,"avatar_url":"https://avatars.githubusercontent.com/u/4857051?v=3","gravatar_id":"","url":"https://api.github.com/users/sdnetwork","html_url":"https://github.com/sdnetwork","followers_url":"https://api.github.com/users/sdnetwork/followers","following_url":"https://api.github.com/users/sdnetwork/following{/other_user}","gists_url":"https://api.github.com/users/sdnetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/sdnetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdnetwork/subscriptions","organizations_url":"https://api.github.com/users/sdnetwork/orgs","repos_url":"https://api.github.com/users/sdnetwork/repos","events_url":"https://api.github.com/users/sdnetwork/events{/privacy}","received_events_url":"https://api.github.com/users/sdnetwork/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-10-30T15:27:12Z","updated_at":"2015-11-01T16:27:23Z","closed_at":null,"body":"hi,\r\n\r\ni use request to upload file and i have remarked that sometimes i get an ECONNRESET on client response.\r\n\r\nthis is a little exemple to reproduce the problem easly : \r\nCLIENT\r\n\r\n```js\r\n    var http = require('http');\r\n    var request = require('request');\r\n    var fs = require('fs');\r\n\r\n    function sendfile() {\r\n\tvar formData = {\r\n\tid: 'my_value',\r\n\tdata: fs.createReadStream('./package.json')\r\n\t}\r\n\trequest.post({url:'http://127.0.0.1:9090', formData: formData}, function optionalCallback(err, httpResponse, body) {\r\n\t\tif (err) \r\n\t\t\treturn console.error('upload failed:', err);\r\n\t\tconsole.log('good');\r\n\t});\r\n\t} \t\r\n\t\r\n    setInterval(sendfile, 1000);\r\n```\r\n\r\nSERVER\r\n\r\n```js\r\n     var http = require('http');\r\n     http.createServer(function (req, res) {        \r\n         res.writeHead(200, { 'Content-Type': 'text/plain' });\r\n         res.end();\r\n     }).listen(9090);\r\n```\r\n\r\nwith this exemple, i get often this error in client response SOCKET ERROR =>\r\n read ECONNRESET Error: read ECONNRESET.\r\nif i don't send the stream in the post request, the problem never happens.\r\n\r\nthis is the log with NODE_DEBUG=http (on client)\r\n\r\n```\r\n    HTTP 8276: sockets 127.0.0.1:9090: 1\r\n    HTTP 8276: write ret = false\r\n    HTTP 8276: write ret = false\r\n    HTTP 8276: write ret = false\r\n    HTTP 8276: write ret = false\r\n    HTTP 8276: write ret = true\r\n    HTTP 8276: write ret = true\r\n    HTTP 8276: outgoing message end.\r\n    HTTP 8276: SOCKET ERROR: read ECONNRESET Error: read ECONNRESET\r\n        at exports._errnoException (util.js:874:11)\r\n       at TCP.onread (net.js:544:26)\r\n     upload failed: { [Error: read ECONNRESET] code: 'ECONNRESET', errno: 'ECONNRESET\r\n     ', syscall: 'read' }\r\n    HTTP 8276: CLIENT socket onClose\r\n    HTTP 8276: removeSocket 127.0.0.1:9090: destroyed: true\r\n    HTTP 8276: HTTP socket close\r\n```\r\n\r\nI'm on windows, i have try with nodejs  0.12.2 4.1.0 and 4.2.1 and the last request module 2.65.0\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/request/request/issues/comments/152841758","html_url":"https://github.com/request/request/issues/1878#issuecomment-152841758","issue_url":"https://api.github.com/repos/request/request/issues/1878","id":152841758,"user":{"login":"sdnetwork","id":4857051,"avatar_url":"https://avatars.githubusercontent.com/u/4857051?v=3","gravatar_id":"","url":"https://api.github.com/users/sdnetwork","html_url":"https://github.com/sdnetwork","followers_url":"https://api.github.com/users/sdnetwork/followers","following_url":"https://api.github.com/users/sdnetwork/following{/other_user}","gists_url":"https://api.github.com/users/sdnetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/sdnetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sdnetwork/subscriptions","organizations_url":"https://api.github.com/users/sdnetwork/orgs","repos_url":"https://api.github.com/users/sdnetwork/repos","events_url":"https://api.github.com/users/sdnetwork/events{/privacy}","received_events_url":"https://api.github.com/users/sdnetwork/received_events","type":"User","site_admin":false},"created_at":"2015-11-01T16:27:23Z","updated_at":"2015-11-01T16:27:23Z","body":"@simov it is very strange that you can't reproduce the behaviour on my machine it occurs every time with this exemple (one error for 50 success), i will try tomorrow on a linux platform.\r\n\r\nhave you some tips to find where is the problem ? (node_debug ...)."}}