{"action":"created","issue":{"url":"https://api.github.com/repos/indutny/node-spdy/issues/210","labels_url":"https://api.github.com/repos/indutny/node-spdy/issues/210/labels{/name}","comments_url":"https://api.github.com/repos/indutny/node-spdy/issues/210/comments","events_url":"https://api.github.com/repos/indutny/node-spdy/issues/210/events","html_url":"https://github.com/indutny/node-spdy/issues/210","id":95961790,"number":210,"title":"Error: write after end and TypeError: Cannot read property 'writeQueueSize' of null","user":{"login":"llambda","id":6763826,"avatar_url":"https://avatars.githubusercontent.com/u/6763826?v=3","gravatar_id":"","url":"https://api.github.com/users/llambda","html_url":"https://github.com/llambda","followers_url":"https://api.github.com/users/llambda/followers","following_url":"https://api.github.com/users/llambda/following{/other_user}","gists_url":"https://api.github.com/users/llambda/gists{/gist_id}","starred_url":"https://api.github.com/users/llambda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/llambda/subscriptions","organizations_url":"https://api.github.com/users/llambda/orgs","repos_url":"https://api.github.com/users/llambda/repos","events_url":"https://api.github.com/users/llambda/events{/privacy}","received_events_url":"https://api.github.com/users/llambda/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-07-20T00:22:54Z","updated_at":"2015-08-07T06:10:58Z","closed_at":null,"body":"Hi, I'm getting these errors with spdy-2.0.0 beta4. No erros on spdy 1.32.3.\r\n\r\nError: write after end and TypeError: Cannot read property 'writeQueueSize' of null\r\n\r\nnode v2.4.0\r\n\r\nStack trace is:\r\n\r\n```\r\nError: write after end\r\n     at writeAfterEnd (/home/u/testapp/node_modules/spdy/node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_writable.js:191:12)\r\n     at Stream.Writable.write (/home/u/testapp/node_modules/spdy/node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_writable.js:236:5)\r\n     at Handle.writeEnc (/home/u/testapp/node_modules/spdy/node_modules/handle-thing/lib/handle.js:198:18)\r\n     at Handle.writeBuffer (/home/u/testapp/node_modules/spdy/node_modules/handle-thing/lib/handle.js:226:15)\r\n     at createWriteReq (net.js:701:21)\r\n     at Socket._writeGeneric (net.js:669:11)\r\n     at Socket._write (net.js:692:8)\r\n     at doWrite (_stream_writable.js:292:12)\r\n     at clearBuffer (_stream_writable.js:396:7)\r\n     at onwrite (_stream_writable.js:331:7)\r\n     at Socket.WritableState.onwrite (_stream_writable.js:89:5)\r\n     at WriteWrap.afterWrite (net.js:770:12)\r\n     at /home/u/testapp/node_modules/spdy/node_modules/handle-thing/lib/handle.js:199:11\r\n     at afterWrite (/home/u/testapp/node_modules/spdy/node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_writable.js:380:3)\r\n     at onwrite (/home/u/testapp/node_modules/spdy/node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_writable.js:371:7)\r\n     at WritableState.onwrite (/home/u/testapp/node_modules/spdy/node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_writable.js:116:5)\r\n\r\nnet.js:679\r\n if (req.async && this._handle.writeQueueSize != 0)\r\n                              ^\r\nTypeError: Cannot read property 'writeQueueSize' of null\r\n   at Socket._writeGeneric (net.js:679:32)\r\n   at Socket._write (net.js:692:8)\r\n   at doWrite (_stream_writable.js:292:12)\r\n   at clearBuffer (_stream_writable.js:396:7)\r\n   at onwrite (_stream_writable.js:331:7)\r\n   at Socket.WritableState.onwrite (_stream_writable.js:89:5)\r\n   at WriteWrap.afterWrite (net.js:770:12)\r\n   at /home/u/testapp/node_modules/spdy/node_modules/handle-thing/lib/handle.js:199:11\r\n   at afterWrite (/home/u/testapp/node_modules/spdy/node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_writable.js:380:3)\r\n   at onwrite (/home/u/testapp/node_modules/spdy/node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_writable.js:371:7)\r\n   at WritableState.onwrite (/home/u/testapp/node_modules/spdy/node_modules/spdy-transport/node_modules/readable-stream/lib/_stream_writable.js:116:5)\r\n   at doNTCallback0 (node.js:408:9)\r\n   at process._tickCallback (node.js:337:13)\r\n```\r\n\r\nTest case is: \r\n\r\n\r\n```\r\n'use strict';\r\nconst koa = require('koa');\r\nconst app = module.exports = koa();\r\nconst spdy = require('spdy');\r\nconst fs = require('fs');\r\nconst stream = require('stream');\r\nconst _ = require('lodash');\r\n\r\nconst options = {\r\n\tservers: [{\r\n        \"host\": \"localhost\",\r\n        \"port\": 28015,\r\n        \"db\": \"test\"\r\n    }]\r\n};\r\n\r\nconst r = require('rethinkdbdash')(options);\r\n\r\nconst getMessages = function () {\r\n\tvar first = true;\r\n\tvar stringifier = new stream.Transform();\r\n\tstringifier._writableState.objectMode = true;\r\n\tstringifier._transform = function (data, encoding, done) {\r\n\t\tconsole.log(data);\r\n\t\tif (first) {\r\n\t\t\tfirst = false;\r\n\t\t\tthis.push('[');\r\n\t\t} else {\r\n\t\t\tthis.push('\\n,')\r\n\t\t}\r\n\t\tthis.push(JSON.stringify(data));\r\n\t\tdone();\r\n\t};\r\n\r\n\tstringifier._flush = function (done) {\r\n\t\tif (first) {\r\n\t\t\tthis.push('[');\r\n\t\t}\r\n\t\tthis.push(']');\r\n\t\tdone();\r\n\t};\r\n\r\n\tvar query = r.table('messages')\r\n\r\n\treturn query.toStream()\r\n\t.pipe(stringifier)\r\n};\r\n\r\n\r\napp.use(function *(next) {\r\n\tthis.response.body = getMessages();\r\n})\r\n\r\nvar credentials;\r\nvar privateKey = fs.readFileSync('server.key', 'utf8');\r\nvar certificate = fs.readFileSync('server.crt', 'utf8');\r\ncredentials = {key: privateKey, cert: certificate};\r\n\r\nvar server = spdy.createServer(credentials, app.callback());\r\n\r\nserver.listen(8443);\r\n```"},"comment":{"url":"https://api.github.com/repos/indutny/node-spdy/issues/comments/128608580","html_url":"https://github.com/indutny/node-spdy/issues/210#issuecomment-128608580","issue_url":"https://api.github.com/repos/indutny/node-spdy/issues/210","id":128608580,"user":{"login":"indutny","id":238531,"avatar_url":"https://avatars.githubusercontent.com/u/238531?v=3","gravatar_id":"","url":"https://api.github.com/users/indutny","html_url":"https://github.com/indutny","followers_url":"https://api.github.com/users/indutny/followers","following_url":"https://api.github.com/users/indutny/following{/other_user}","gists_url":"https://api.github.com/users/indutny/gists{/gist_id}","starred_url":"https://api.github.com/users/indutny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/indutny/subscriptions","organizations_url":"https://api.github.com/users/indutny/orgs","repos_url":"https://api.github.com/users/indutny/repos","events_url":"https://api.github.com/users/indutny/events{/privacy}","received_events_url":"https://api.github.com/users/indutny/received_events","type":"User","site_admin":false},"created_at":"2015-08-07T06:10:58Z","updated_at":"2015-08-07T06:10:58Z","body":"I have just started experiencing this myself on my blog. Will figure it out soon."}}