Last active
March 19, 2017 09:17
-
-
Save poga/f451e86ebbdc1f9ed45e6a059f61e7b6 to your computer and use it in GitHub Desktop.
request timeout when replicating with net.connect?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
===== | |
usually I will see this: | |
server: | |
Error: stream.push() after EOF | |
at readableAddChunk (/Users/poga/new_hc/node_modules/readable-stream/lib/_stream_readable.js:198:15) | |
at Protocol.Readable.push (/Users/poga/new_hc/node_modules/readable-stream/lib/_stream_readable.js:176:10) | |
at Protocol.ping (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:186:15) | |
at Protocol._kick (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:175:10) | |
at Timeout.kick [as _onTimeout] (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:71:10) | |
at ontimeout (timers.js:380:14) | |
at Timer.unrefdHandle (timers.js:486:5) | |
peer.js: | |
Error: Request timeout | |
at Peer.ontick (/Users/poga/new_hc/node_modules/hypercore/lib/replicate.js:151:16) | |
at Protocol._kick (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:168:26) | |
at Timeout.kick [as _onTimeout] (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:71:10) | |
at ontimeout (timers.js:380:14) | |
at Timer.unrefdHandle (timers.js:486:5) | |
=== | |
sometimes I saw this: | |
server.js: | |
events.js:163 | |
throw er; // Unhandled 'error' event | |
^ | |
Error: Only 128 feeds currently supported. Open a Github issue if you need more | |
at Protocol._tooManyFeeds (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:377:16) | |
at Protocol._onmessage (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:280:30) | |
at Protocol._parseMessage (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:334:10) | |
at Protocol._parse (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:303:37) | |
at Protocol._write (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:223:8) | |
at doWrite (/Users/poga/new_hc/node_modules/readable-stream/lib/_stream_writable.js:345:64) | |
at writeOrBuffer (/Users/poga/new_hc/node_modules/readable-stream/lib/_stream_writable.js:334:5) | |
at Protocol.Writable.write (/Users/poga/new_hc/node_modules/readable-stream/lib/_stream_writable.js:271:11) | |
at Socket.ondata (_stream_readable.js:555:20) | |
at emitOne (events.js:96:13) | |
or this: | |
Error: Remote sent invalid feed message | |
at Protocol._badFeed (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:386:16) | |
at Protocol._onmessage (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:290:24) | |
at Protocol._parseMessage (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:334:10) | |
at Protocol._parse (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:303:37) | |
at Protocol._write (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:223:8) | |
at doWrite (/Users/poga/new_hc/node_modules/readable-stream/lib/_stream_writable.js:345:64) | |
at writeOrBuffer (/Users/poga/new_hc/node_modules/readable-stream/lib/_stream_writable.js:334:5) | |
at Protocol.Writable.write (/Users/poga/new_hc/node_modules/readable-stream/lib/_stream_writable.js:271:11) | |
at Socket.ondata (_stream_readable.js:555:20) | |
at emitOne (events.js:96:13) | |
or this: | |
Error: Remote message is larger than 8MB (max allowed) | |
at Protocol._tooBig (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:381:16) | |
at Protocol._parseLength (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:359:48) | |
at Protocol._parse (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:304:23) | |
at Protocol._write (/Users/poga/new_hc/node_modules/hypercore-protocol/index.js:223:8) | |
at doWrite (/Users/poga/new_hc/node_modules/readable-stream/lib/_stream_writable.js:345:64) | |
at writeOrBuffer (/Users/poga/new_hc/node_modules/readable-stream/lib/_stream_writable.js:334:5) | |
at Protocol.Writable.write (/Users/poga/new_hc/node_modules/readable-stream/lib/_stream_writable.js:271:11) | |
at Socket.ondata (_stream_readable.js:555:20) | |
at emitOne (events.js:96:13) | |
at Socket.emit (events.js:191:7) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "new_hc", | |
"version": "1.0.0", | |
"description": "", | |
"main": "server.js", | |
"scripts": { | |
"test": "echo \"Error: no test specified\" && exit 1", | |
"start": "node server.js" | |
}, | |
"keywords": [], | |
"author": "", | |
"license": "ISC", | |
"dependencies": { | |
"hypercore": "^5.4.2", | |
"random-access-memory": "^2.3.0" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hypercore = require('hypercore') | |
var net = require('net') | |
var key = process.argv[2] | |
var feed = hypercore('./peer', key) | |
var socket = net.connect(10000) | |
socket.pipe(feed.replicate({live: true})).pipe(socket) | |
feed.on('download', (i, data) => console.log('downloaded', i, data.toString())) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var hypercore = require('hypercore') | |
var net = require('net') | |
// the error is also reproducible with random-access-memory | |
var feed = hypercore('./server') | |
// If I remove the setInterval and use an brand new hypercore, sometimes there's no error | |
setInterval(() => { | |
feed.append('hi', function () { console.log('appended') }) | |
}, 1000) | |
var server = net.createServer((socket) => { | |
socket.pipe(feed.replicate({live: true})).pipe(socket) | |
}) | |
server.listen(10000, () => { | |
console.log('listening', 10000) | |
feed.ready(() => { | |
console.log(feed.key.toString('hex')) | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment