Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Intermittent "Error: MAC Invalid" #945

Closed
mitra42 opened this issue Aug 14, 2017 · 17 comments
Closed

Intermittent "Error: MAC Invalid" #945

mitra42 opened this issue Aug 14, 2017 · 17 comments
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up

Comments

@mitra42
Copy link

mitra42 commented Aug 14, 2017

  • Version: ipfs 0.25.1 (output of npm list | grep ipfs)
  • Platform: Mac OSX 10.11.6 (i.e. not current)
  • Subsystem: Pubsub I think

Type: Bug

Severity: Medium

Description:

After starting IPFS it sometimes gives a "MAC invalid" error and stack trace - intermittent, doesn't happen every time. Stack trace below

I'm running my code in github.com/internetarchive/dweb-transport, following README.md instructions, and then opening examples/example_smartdict.html, I have seen intermittent crashes, and now that the core code is more stable I'm trying to track them down, I've seen this one a number of times, the code seems to continue running after this error.

Error: MAC Invalid: 055ff7d2adf9a03bd231bc0318f936fed536a85e1627eab874a177c1f79f258f != 0fc60dd1362a980df712e750c1c7710cae5990c310a751e18d1585d8461e6694
Stack trace:
IpfsIiifDb</</exports.createUnboxStream/</<@https://unpkg.com/ipfs-iiif-db/dist/browser.js:97503:21
nodeify/</<@https://unpkg.com/ipfs-iiif-db/dist/browser.js:13523:9
run@https://unpkg.com/ipfs-iiif-db/dist/browser.js:143880:13
runIfPresent@https://unpkg.com/ipfs-iiif-db/dist/browser.js:143909:21
onGlobalMessage@https://unpkg.com/ipfs-iiif-db/dist/browser.js:143949:17
@daviddias daviddias added kind/bug A bug in existing code (including security flaws) exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue P2 Medium: Good to have, but can wait until someone steps up labels Aug 16, 2017
@daviddias
Copy link
Member

Thanks for reporting this bug @mitra42. We've seen it a couple of times but haven't been able to reproduce it deterministically.

The error comes from secio handshake, when the crypto challenge doesn't succeed.

@mitra42
Copy link
Author

mitra42 commented Aug 16, 2017

is there something I can do to help track it down, I see it often enough that it will probably recur while I'm watching. I currently load the Node environment (used to run code tests) with

{ ipfs: 
   { repo: '/tmp/ipfs_dweb20170804',
     config: { 
        Addresses: Swarm: [ '/libp2p-webrtc-star/dns4/star-signal.cloud.ipfs.team/wss' ] ,
        Discovery:  { webRTCStar: { Enabled: true } } 
     },
     EXPERIMENTAL: { pubsub: true } },
  store: 'leveldb',
  partition: 'dweb20170804' }

And the browser environment with same except

store: 'indexeddb'

@mitra42
Copy link
Author

mitra42 commented Sep 5, 2017

Just flagging .. still seeing this "MAC Invalid" pretty regularly.

@dignifiedquire
Copy link
Member

Thanks, still not sure where this comes from, might simply be nodes with different config, or an actual issue on our side

@dryajov
Copy link
Member

dryajov commented Sep 5, 2017

@dignifiedquire I have a hunch that it might be VPN related? @mitra42 are you on a VPN when getting this error, I believe @whyrusleeping got the same error recently and he is on a VPN.

@mitra42
Copy link
Author

mitra42 commented Sep 6, 2017

No - not on a VPN either at home or at Internet Archive. I'll try and note next time I see it what the network config is. Is there anything you'd like me to check at that point?

@dryajov
Copy link
Member

dryajov commented Sep 7, 2017

Nothing in particular, just a few things that come to mind:

  • Are you using any IP masquerading software?
  • Anything relevant in your system logs?

@daviddias
Copy link
Member

@dryajov this is not MAC as in MAC addresses, it is as in Message Authentication Code :)

It comes from https://github.com/libp2p/js-libp2p-secio/blob/master/src/etm.js#L54-L56, which is a Buffer comparison.

Another error that sometimes is seen is "Stream ended prematurely" which comes from the same module https://github.com/libp2p/js-libp2p-secio/blob/master/src/handshake/index.js#L19-L25

@dryajov
Copy link
Member

dryajov commented Sep 7, 2017

ah, lol! Feeling pretty dumb right now 😁 . The fact its coming from secio should have been a giveaway.

@daviddias daviddias added the status/ready Ready to be worked label Sep 13, 2017
@mitra42
Copy link
Author

mitra42 commented Oct 20, 2017

Note - I'm still seeing this, (not necessarily a problem)

@sivachaitanya
Copy link

Happening for me too, I'm following the example https://github.com/ipfs/js-ipfs/blob/master/examples/browser-browserify/src/index.js

@daviddias
Copy link
Member

daviddias commented Oct 24, 2017

Hi all, this is a known issue although very hard to replicate. If you get a script that makes it happen 100% of the time it would help us a ton.

What is happening is that the SECIO (our crypto channel) protocol fails and IPFS aborts dialing to that peer. It is a non-destructive error as it is isolated to that specific connection.

@mitra42
Copy link
Author

mitra42 commented Oct 24, 2017 via email

@daviddias
Copy link
Member

@jacobheun @olizilla this has been officially fixed, correct?

@jacobheun
Copy link
Contributor

I'll verify, but this should be resolved in newer versions of libp2p-switch so that valid connection failures aren't being thrown.

@mitra42
Copy link
Author

mitra42 commented Aug 15, 2018

I haven't seen this in a while, maybe time to close ?

@daviddias
Copy link
Member

Let's close and reopen if necessary :) Thanks @mitra42

@ghost ghost removed the status/ready Ready to be worked label Aug 15, 2018
MicrowaveDev pushed a commit to galtproject/js-ipfs that referenced this issue May 22, 2020
License: MIT
Signed-off-by: Alan Shaw <alan.shaw@protocol.ai>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
exp/expert Having worked on the specific codebase is important help wanted Seeking public contribution on this issue kind/bug A bug in existing code (including security flaws) P2 Medium: Good to have, but can wait until someone steps up
Projects
None yet
Development

No branches or pull requests

6 participants