-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scrub response errors #320
Conversation
eec9302
to
fb86ecc
Compare
Co-authored-by: Rod Vagg <rod@vagg.org>
0af7110
to
d194251
Compare
_, isPaused := err.(hooks.ErrPaused) | ||
if isPaused { | ||
return err | ||
} | ||
|
||
if err == ErrNetworkError || ipldutil.IsContextCancelErr(err) { | ||
rt.ResponseStream.ClearRequest() | ||
return 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.
What are the implications of moving these outside of a "transaction"? There's a similar change in responsemanager/server.go that moves the initial error & state checking outside of the Transaction()
call. Are we losing anything by doing this?
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.
not really. The whole idea of Transaction is to make sure a series of operations go out in the same libp2p message over the wire (for example, a block + a pause message that got generated running hooks on the block). ClearRequest doesn't actually send anything over the wire. I have no idea why it was in transaction in the first place :)
if rs.isClosed() { | ||
return | ||
} |
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.
So I think this (and the isClosed()
4 lines down) are the key to the "don't keep on queuing messages on an errored connection" part of the problem, is that correct? Basically making each new Transaction()
on one of these errored connections a noop.
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.
Yep! That's the whole idea :)
size := uint64(0) | ||
for _, op := range operations { | ||
size += op.size() | ||
} |
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.
this block could be moved down below the isClosed()
block
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.
you're right. :)
requestID: requestID, | ||
linkTracker: ra.GetProcess(p).(*peerLinkTracker), | ||
requestID: rs.requestID, | ||
linkTracker: rs.linkTrackers.GetProcess(rs.p).(*peerLinkTracker), | ||
} | ||
err := transaction(rb) |
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.
Do we need to run this if rs.isClosed() == true
? Could we also be short-circuiting in this method as well?
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.
possibly... but I'm a little worried we still have logic unrelated to whats going over the wire happening inside the transaction, and I don't want to short circuit that.
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.
Unfortunately there's too much complexity and too many changes to give much more than a rubber stamp on this one. I don't see obvious problems, although the move of the error case checking outside of the Transaction()
calls seems like not an insignificant change, as mentioned.
Worth trying out live to see if it solves this particular problem.
Goals
resolve #314
Implementation
Oy, so, this is tricky.