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

Increase announcer's receiver buffer to 512 #3423

Merged
merged 2 commits into from
Nov 29, 2022

Conversation

pdyraga
Copy link
Member

@pdyraga pdyraga commented Nov 29, 2022

Closes #3419
Depends on #3422

During the tests of the code orchestrating tECDSA signing in, we noticed the announcer's buffer sometimes gets full and the messages are dropped with the famous "message handler is too slow" warning. It turns out that the problem lies in the size of the buffer used by the announcer. Before a message in which the announcer is not interested is dropped, it is buffered in this channel. This also includes retransmissions from the previous signing protocols because the retransmission cache filter is scoped to the given Recv handler:

func WithRetransmissionSupport(delegate func(m net.Message)) func(m net.Message) {
  mutex := &sync.Mutex{}
  cache := make(map[string]bool)
  // (...)
}

The announcer's buffer size has been increased to 512 elements, just like the buffer of the asynchronous state machine, and the problem seems to be gone based on local machine tests.

During the tests of the code orchestrating tECDSA signing in, we noticed the
announcer's buffer sometimes gets full and the messages are dropped with the
famous "message handler is too slow" warning. It turns out that the problem lies
in the size of the buffer used by the announcer. Before a message in which the
announcer is not interested is dropped, it is buffered in this channel. This
also includes retransmissions from the previous signing protocols because the
retransmission cache filter is scoped to the given `Recv` handler:
```
func WithRetransmissionSupport(delegate func(m net.Message)) func(m net.Message) {
  mutex := &sync.Mutex{}
  cache := make(map[string]bool)
  // (...)
}
```

The announcer's buffer size has been increased to 512 elements, just like the
buffer of the asynchronous state machine, and the problem seems to be gone based
on local machine tests.
@pdyraga
Copy link
Member Author

pdyraga commented Nov 29, 2022

I was testing this change along with the one from #3422 locally, using the same configuration as for the tests of #3404 where the problems were noticed. I've observed no single "message handler is too slow" warning. 7x10 signatures were produced in the first attempt.

@pdyraga pdyraga self-assigned this Nov 29, 2022
@pdyraga pdyraga added this to the v2.0.0-m2 milestone Nov 29, 2022
In the previous commit the code of the announcer was modified to use a
buffer of a fixed size for the broadcast channel receiver. The group
size does no longer need to be passed to the announcer.
Base automatically changed from message-handler-is-not-too-slow to main November 29, 2022 11:50
@lukasz-zimnoch lukasz-zimnoch marked this pull request as ready for review November 29, 2022 11:52
@lukasz-zimnoch lukasz-zimnoch merged commit 5f047b8 into main Nov 29, 2022
@lukasz-zimnoch lukasz-zimnoch deleted the message-handler-is-not-too-slow-2 branch November 29, 2022 12:06
@pdyraga pdyraga removed their assignment Jan 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Message handler is too slow; dropping message during tECDSA signing
2 participants