Title: Change the timing to emit 'msg' event to consume a buffer in advance by shinichy · Pull Request #32 · msgpack/msgpack-node · GitHub
Open Graph Title: Change the timing to emit 'msg' event to consume a buffer in advance by shinichy · Pull Request #32 · msgpack/msgpack-node
X Title: Change the timing to emit 'msg' event to consume a buffer in advance by shinichy · Pull Request #32 · msgpack/msgpack-node
Description: When I work with msgpack.Stream + deasync(https://github.com/abbr/deasync), the following program causes stack overflow. This issue is caused because msgpack.Stream emits 'msg' event before it consumes a buffer and deasync allows processing io events before finishing 'msg' event callbacks. I know this doesn't usually happen but it's better to emit 'msg' after consuming a buffer to handle this kind of case. 'use strict' var net = require('net'); var path = '/tmp/deasync.sock'; var msgpack = require('msgpack'); var server = net.createServer(function(c) { c.on('data', function() { c.write(msgpack.pack('foo')); }); c.on('end', function() { console.log('end') server.close() }) c.write(msgpack.pack('hello')); }); server.listen(path); var done = false; var client = net.createConnection(path) var stream = new msgpack.Stream(client) stream.on('msg', function(msg) { console.log('msg: ' + msg) if (msg === 'hello') { client.write(msgpack.pack('foo')); require('deasync').loopWhile(() => !done); console.log('done'); client.end() } else if (msg === 'foo') { done = true; } }); Output msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello msg: hello :0 RangeError: Maximum call stack size exceeded
Open Graph Description: When I work with msgpack.Stream + deasync(https://github.com/abbr/deasync), the following program causes stack overflow. This issue is caused because msgpack.Stream emits 'msg' event before...
X Description: When I work with msgpack.Stream + deasync(https://github.com/abbr/deasync), the following program causes stack overflow. This issue is caused because msgpack.Stream emits 'msg' even...
Opengraph URL: https://github.com/msgpack/msgpack-node/pull/32
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/files(.:format) |
| route-controller | pull_requests |
| route-action | files |
| fetch-nonce | v2:2935a44a-307d-bc63-41fd-84be81c796a7 |
| current-catalog-service-hash | ae870bc5e265a340912cde392f23dad3671a0a881730ffdadd82f2f57d81641b |
| request-id | CD3E:147859:120CBC:185255:698F5ADA |
| html-safe-nonce | 1d807881231b73ced613d7637a5e308de002c0d358aec3600507949f392d4039 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDRDNFOjE0Nzg1OToxMjBDQkM6MTg1MjU1OjY5OEY1QURBIiwidmlzaXRvcl9pZCI6IjI5MjE0Nzg4MTI4Mjk5NjUwMTgiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 9070cced02bfb8d992843d0cb0e7015e25d863ef2e3f00363887d2edcab93f7d |
| hovercard-subject-tag | pull_request:52077370 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/msgpack/msgpack-node/pull/32/files |
| twitter:image | https://avatars.githubusercontent.com/u/900172?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/900172?s=400&v=4 |
| og:image:alt | When I work with msgpack.Stream + deasync(https://github.com/abbr/deasync), the following program causes stack overflow. This issue is caused because msgpack.Stream emits 'msg' event before... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 974b952535e389ab3b5c0ef3f15bde9af29b6b38f7486069c43d99e51de0e563 |
| turbo-cache-control | no-preview |
| diff-view | unified |
| go-import | github.com/msgpack/msgpack-node git https://github.com/msgpack/msgpack-node.git |
| octolytics-dimension-user_id | 198264 |
| octolytics-dimension-user_login | msgpack |
| octolytics-dimension-repository_id | 7430783 |
| octolytics-dimension-repository_nwo | msgpack/msgpack-node |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 7430783 |
| octolytics-dimension-repository_network_root_nwo | msgpack/msgpack-node |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | true |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | b8e9d6dae5817b2dbe0a3d6d920ff8d3db837168 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width