Skip to content
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

respect contexts while reading messages in dht #2826

Merged
merged 1 commit into from
Jun 9, 2016

Conversation

whyrusleeping
Copy link
Member

If something weird happens during a dht request and the remote peer does not reply to our request, and also does not close the underlying connection, this has the possibility to hang.

That said, I think that the issue i noticed was caused by utp hanging up under the hood (the stack trace showed a few utp event loops running)

License: MIT
Signed-off-by: Jeromy why@ipfs.io

@@ -227,3 +228,23 @@ func (ms *messageSender) SendRequest(ctx context.Context, pmes *pb.Message) (*pb

return mes, nil
}

func (ms *messageSender) ctxReadMsg(ctx context.Context, mes *pb.Message) error {
t := time.NewTimer(time.Second * 30)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should collect all of those timeouts (and create a one that would be standard), this way if we need to make IPFS work over higher latency for some reason it will be much easier.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I honestly think we could get away without the timeout here and just stick to respecting the context and fixing utp.

What do you think?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What do you mean by fixing utp?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

theres a bug in utp that surfaces occasionally that will cause it to hang. Theres nothing we can do to avoid this other than fix utp, or not use utp. The hang that i wrote this PR to 'solve' was caused by this utp bug.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, let's pull it but we should remember to fix it properly in future.

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
@whyrusleeping whyrusleeping merged commit b731c79 into master Jun 9, 2016
@whyrusleeping whyrusleeping deleted the fix/dht-ctx-respect branch June 9, 2016 23:31
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this pull request Oct 23, 2021
respect contexts while reading messages in dht
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants