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

Rate limit #778

Merged
merged 8 commits into from
Dec 10, 2020
Merged

Rate limit #778

merged 8 commits into from
Dec 10, 2020

Conversation

nikkolasg
Copy link
Collaborator

No description provided.

// in a routine cause we don't want to block the processing of the DKG
// as well - that's ok since we are only expecting to send 3 packets out
// at the very least.
go b.dispatcher.broadcastDirect(proto)
Copy link
Member

Choose a reason for hiding this comment

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

having these off in go-routines seems potentially like it could end up with some weird memory leak / build-up of pending writes. I'd prefer a channel and single sending thread for these as well in parallel to the non-bypassing ones.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not saying I dont want to do it but I want to highlight that DKG only outputs 1 deal packet, 1 resp packet and up to 1 justification packet.

Copy link
Member

Choose a reason for hiding this comment

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

my worry is cases where the sending blocks - e.g. because dns resolution has decided on a bad time to time out for a minute.
In the mean-time, everything can get torn down and a new reshare could start, and then some random packet from this previous thread could still get sent out.
Having it in the same place makes it easier to trust it's going to get torn down properly and not get left dangling.

Copy link
Collaborator Author

@nikkolasg nikkolasg Dec 9, 2020

Choose a reason for hiding this comment

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

Mhhh but in this specific failure scenario , this can already happen with the current code right ?(Because we're using channels, and we simply close them, but the "pending" messages in the channel are still present and will be sent I believe.)
I think what we need to prevent against that is using context, so when we stop the broadcaster, we stop all context and thus no further messages get sent. Does that seem right ?
And if so, can I or you do that in a subsequent PR ?

@nikkolasg nikkolasg marked this pull request as ready for review December 9, 2020 18:48
@willscott
Copy link
Member

can we disable this large test in CI since it seems to fail the limits there?

@willscott
Copy link
Member

sorry for spamming with circle failures when i hit the ci a few times before believing it's a legit failure.

it looks like what's going on is the Deny test where packets are blocked or failed to some peer is operating by acting like the call to send to a denied peer is going to just block forever: https://github.com/drand/drand/blob/master/core/util_test.go#L466

The right answer is to have a context there, so it blocks until the context cancels and we can have a concept of timeout.

@nikkolasg
Copy link
Collaborator Author

I simply saw that it wasn't worth block-ing on the thread so now it simply returns an error and the test pass.

@willscott willscott merged commit ba36514 into master Dec 10, 2020
@willscott willscott deleted the fix/ratelimite branch December 10, 2020 15:12
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.

None yet

2 participants