Js-ipfs: Revenge of the `Missing peerId` and its sidekick, `already piped`

Created on 28 May 2018  路  8Comments  路  Source: ipfs/js-ipfs

  • Version: 0.28.1
  • Platform: Firefox 60.0.1
  • Subsystem: Unknown

Type: Bug

Severity: Low

Description:

This is related to #1221 and probably to the issues @shessenauer reported there a few days ago. I am opening a new issue since this is in the browser, and since I am using js-ipfs v0.28.1, which has a fix for #1221. WRONG! This version predates that fix! It looks like the fix hasn't made it to a release yet.

I am working on https://interfect.github.io/ipfstunes/

I am getting this in my browser console:

uncaught exception: AssertionError: Missing peerId. Use Peer.create(cb) to create one

And also this (with a stacktrace):

Error: already piped

It only happens when I give one node a reason to talk to another, by adding some songs in one browser and then opening the URL with fragment identifier in another browser and trying to play them.

I'm seeing the messages on both the sending and receiving browser. I'm also experiencing very slow file transfer between the browsers, and I suspect the two phenomena might be related.

Here's a stack trace for the already piped error:

Error: already piped
ipfs.js:51632:13
sink
https://interfect.github.io/ipfstunes/lib/ipfs.js:51632:13
consume
https://interfect.github.io/ipfstunes/lib/ipfs.js:76086:17
consume
https://interfect.github.io/ipfstunes/lib/ipfs.js:76086:17
consume
https://interfect.github.io/ipfstunes/lib/ipfs.js:76086:17
pull
https://interfect.github.io/ipfstunes/lib/ipfs.js:69916:7
handle
https://interfect.github.io/ipfstunes/lib/ipfs.js:204460:5
attemptMuxerUpgrade
https://interfect.github.io/ipfstunes/lib/ipfs.js:208185:7
gotWarmedUpConn
https://interfect.github.io/ipfstunes/lib/ipfs.js:208082:7
Ipfs</dial/<
https://interfect.github.io/ipfstunes/lib/ipfs.js:208068:9
Ipfs</dial/<
https://interfect.github.io/ipfstunes/lib/ipfs.js:203766:7
Ipfs</</module.exports/</<
https://interfect.github.io/ipfstunes/lib/ipfs.js:209951:24
run
https://interfect.github.io/ipfstunes/lib/ipfs.js:68437:13
runIfPresent
https://interfect.github.io/ipfstunes/lib/ipfs.js:68466:21
onGlobalMessage
https://interfect.github.io/ipfstunes/lib/ipfs.js:68506:17

Steps to reproduce the error:

  • Have two browsers
  • Open https://interfect.github.io/ipfstunes/ in one
  • Hit Browse and import some MP3 files
  • Wait for the import to finish
  • Copy the resulting URL (with fragment identifier) from the first browser to the second
  • Wait for the second browser to find the first and successfully download the song database
  • Hit Search in the second browser (to search for the empty string)
  • Click on some results in the list
  • Click the play button
  • Wait for the second browser to (slowly!) download and play the songs you selected from the first browser
  • The reported error(s) should appear from time to time in both browser consoles
diexpert kinbug

Most helpful comment

@olizilla the bug still happens. I run NodeJS 10.

I had update the package: npm i ipfs, but nodejs seems to didn't update. npm view ipfs version showed 0.31.4, but the bug still occured, and the version included was 0.30.4. I needed to remove package completely and reinstall.

Now the package is running the last version:
image

already piped

image

/Users/caffeinum/Web/swap.bot/node_modules/pull-pair/index.js:11
      throw new Error('already piped')
      ^

Error: already piped
    at sink (/Users/caffeinum/Web/swap.bot/node_modules/pull-pair/index.js:11:13)
    at consume (/Users/caffeinum/Web/swap.bot/node_modules/pull-defer/sink.js:7:17)
    at consume (/Users/caffeinum/Web/swap.bot/node_modules/pull-defer/sink.js:7:17)
    at Connection.consume (/Users/caffeinum/Web/swap.bot/node_modules/pull-defer/sink.js:7:17)
    at pull (/Users/caffeinum/Web/swap.bot/node_modules/pull-stream/pull.js:43:9)
    at Dialer.handle (/Users/caffeinum/Web/swap.bot/node_modules/multistream-select/src/dialer/index.js:47:5)
    at handleSafe (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:51:12)
    at Dialer._attemptMuxerUpgrade (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:288:5)
    at Dialer._createMuxedConnection (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:252:10)
    at waterfall (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:139:14)
    at nextTask (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:16:14)
    at next (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:23:9)
    at /Users/caffeinum/Web/swap.bot/node_modules/async/internal/onlyOnce.js:12:16
    at Dialer._createBaseConnection (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:185:14)
    at waterfall (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:135:14)
    at nextTask (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:16:14)
    at exports.default (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:26:5)
    at Dialer._establishConnection (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:132:5)
    at waterfall (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:94:14)
    at nextTask (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:16:14)
    at exports.default (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:26:5)
    at Dialer.dial (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:92:5)

All 8 comments

Upgrading js-ipfs to commit 2e40fb8edc3d560c2f05b16df397bd4dcec3b72e seems to have resolved the Missing peerId problem. But the already piped messages persist, and data transfer still seems to be slower than it ought to be.

I'm seeing this error occur in a demo app that does nothing but create a [email protected] node and let it idle.

Uncaught Error: already piped
    at sink (index.js:10)
    at consume (sink.js:7)
    at consume (sink.js:7)
    at Connection.consume (sink.js:7)
    at pull (pull.js:43)
    at Dialer.handle (index.js:47)
    at Dialer._attemptMuxerUpgrade (dial.js:238)
    at cb (dial.js:165)
    at nextTask (waterfall.js:16)
    at ./node_modules/async/waterfall.js.exports.default (waterfall.js:26)
    at Dialer._createMuxedConnection (dial.js:163)
    at waterfall (dial.js:87)
    at nextTask (waterfall.js:16)
    at next (waterfall.js:23)
    at onlyOnce.js:12
    at Dialer._createBaseConnection (dial.js:124)
    at cb (dial.js:83)
    at nextTask (waterfall.js:16)
    at ./node_modules/async/waterfall.js.exports.default (waterfall.js:26)
    at Dialer._establishConnection (dial.js:80)
    at cb (dial.js:47)
    at nextTask (waterfall.js:16)
    at ./node_modules/async/waterfall.js.exports.default (waterfall.js:26)
    at Dialer.dial (dial.js:45)
    at Switch.dial (dial.js:394)
    at _getPeerInfo (index.js:238)
    at setImmediate (get-peer-info.js:46)
    at run (setImmediate.js:40)
    at runIfPresent (setImmediate.js:69)
    at onGlobalMessage (setImmediate.js:109)

The error happens inside pull-stream code, called from here
https://github.com/multiformats/js-multistream-select/blob/5b19358b91850b528b3f93babd60d63ddcf56a99/src/dialer/index.js#L47

This will be released with js-ipfs 0.30 as libp2p depends on libp2p-switch 0.39 currently (fix was released in 0.40.2).

This issue seems to not be fixed. I am still getting Already piped errors through my code. I use [email protected]

This fix landed in js-ipfs 0.31.0
https://github.com/ipfs/js-ipfs/issues/1458

@olizilla the bug still happens. I run NodeJS 10.

I had update the package: npm i ipfs, but nodejs seems to didn't update. npm view ipfs version showed 0.31.4, but the bug still occured, and the version included was 0.30.4. I needed to remove package completely and reinstall.

Now the package is running the last version:
image

already piped

image

/Users/caffeinum/Web/swap.bot/node_modules/pull-pair/index.js:11
      throw new Error('already piped')
      ^

Error: already piped
    at sink (/Users/caffeinum/Web/swap.bot/node_modules/pull-pair/index.js:11:13)
    at consume (/Users/caffeinum/Web/swap.bot/node_modules/pull-defer/sink.js:7:17)
    at consume (/Users/caffeinum/Web/swap.bot/node_modules/pull-defer/sink.js:7:17)
    at Connection.consume (/Users/caffeinum/Web/swap.bot/node_modules/pull-defer/sink.js:7:17)
    at pull (/Users/caffeinum/Web/swap.bot/node_modules/pull-stream/pull.js:43:9)
    at Dialer.handle (/Users/caffeinum/Web/swap.bot/node_modules/multistream-select/src/dialer/index.js:47:5)
    at handleSafe (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:51:12)
    at Dialer._attemptMuxerUpgrade (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:288:5)
    at Dialer._createMuxedConnection (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:252:10)
    at waterfall (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:139:14)
    at nextTask (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:16:14)
    at next (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:23:9)
    at /Users/caffeinum/Web/swap.bot/node_modules/async/internal/onlyOnce.js:12:16
    at Dialer._createBaseConnection (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:185:14)
    at waterfall (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:135:14)
    at nextTask (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:16:14)
    at exports.default (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:26:5)
    at Dialer._establishConnection (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:132:5)
    at waterfall (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:94:14)
    at nextTask (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:16:14)
    at exports.default (/Users/caffeinum/Web/swap.bot/node_modules/async/waterfall.js:26:5)
    at Dialer.dial (/Users/caffeinum/Web/swap.bot/node_modules/libp2p-switch/src/dial.js:92:5)

That happens in webpack examples too, when I enable pubsub-room.

image

Was this page helpful?
0 / 5 - 0 ratings