-
Notifications
You must be signed in to change notification settings - Fork 18
fix: catch uncaught exceptions from pull in dialer.handle #44
Conversation
I'm still not sure what the root cause here is. My thought is that it is likely do to flapping connections, since the errors seem to come in waves when they happen. The dialer is trying to perform the multistream handshake and attempts to read while it's getting hung up on. I can look at getting some test suites added around this later, but this should get people unblocked from crashing nodes. |
With debugging turned on locally I was able to get it to trigger: Browser
Node
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clearly not the root of the problem but until it can be solved the code change LGTM and will hopefully prevent some daemon crashes.
) | ||
} catch (err) { | ||
this.log.error(err) | ||
callback(err) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't this callback be called twice this way?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The callback is already wrapped by once to protect against this.
Additionally the handshake would need to have already succeeded or errored, instead of throwing, for the callback to have been called. I don't believe it will happen, but either way once should protect against the case that it is called multiple times.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
This should prevent ipfs/js-ipfs#1446 from crashing ipfs nodes. Uncaught errors like
Already piped
will be caught and logged as errors.