-
Notifications
You must be signed in to change notification settings - Fork 712
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
Benph/bootstrap thread migration #3554
Conversation
Ben-PH
commented
Feb 10, 2023
•
edited
Loading
edited
- document all added functions
- try in sandbox /simulation/labnet
- unit tests on the added/changed features
- make tests compile
- make tests pass
- add logs allowing easy debugging in case the changes caused problems
- if the API has changed, update the API specification
This implementation keeps async around, but uses
These can, of course, be overcome in the Instead of checking the length of the (now removed) It still uses the select macro with these branches:
|
Issues with implementation at this point:
|
It's not better to have a vector with the handle on the thread/tasks ? |
That would require some sort of mechanism to pop the join handle from the collection automagically. The reason I went with the Arc is because there is a tight coupling between the strong count of the arc, and the number of active threads. I originally went with a plain old I'm sure there's a better way, such as a mechanism that will automagically push/pop join handles from a collection in O(1) based on their ownership. Thread-pooling comes to mind. We might end up going there on the next iteration of this task, but this seemed appropriate to begin with. |
The Arc has a (minor) added benefit of freeing up a bootstrap slot as soon as it completes/fails: let res = tokio::time::timeout(
config.bootstrap_timeout.into(),
manage_bootstrap(
&config,
&mut server,
data_execution,
version,
consensus_command_sender,
network_command_sender,
),
)
.await;
// This drop allows the server to accept new connections before having to complete the error notifications
drop(arc_counter);
let _ = controller_tx.send(BSInternalMessage::Complete).await;
match res { the It's a small and perhaps rarely needed optimisation, but it's something that works for now. The next design iterations should consider applying such optimisations automagically. My initial thinking, is to couple the count with the ...instead of inside the This would all be made redundant, though, if we were to create a dedicated thread pool for the bootstrap server, spawn the threads within that pool, and count the spawned threads. That should work in a bubble, but I don't think we want to go down that road yet... |
Credit to Modship for raising the right questions Co-authored-by: Urvoy <[email protected]>
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.
Self review
3489: Testnet 20 r=AurelienFT a=AurelienFT Merged in this testnet: - #3475 - #3549 - #3562 - #3462 - #3492 - #3502 - #3495 - #3556 - #3511 - #3498 - #3566 - #3557 - #3576 - #3579 - #3507 - #3585 - #3587 - #3580 - #3590 - #3549 - #3455 - #3601 - #3602 - #3606 - #3588 - #3603 - #3554 Co-authored-by: AurelienFT <[email protected]> Co-authored-by: Ben PHL <[email protected]> Co-authored-by: Modship <[email protected]> Co-authored-by: Ben <[email protected]> Co-authored-by: Eitu33 <[email protected]> Co-authored-by: Sydhds <[email protected]> Co-authored-by: modship <[email protected]> Co-authored-by: Moncef AOUDIA <[email protected]> Co-authored-by: Moncef AOUDIA <[email protected]>