-
Notifications
You must be signed in to change notification settings - Fork 584
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
Timeout: use less resources, clean them up better and make cancellation deterministic #10254
Conversation
144abb1
to
394b2fb
Compare
394b2fb
to
0845bbe
Compare
0845bbe
to
3d3c644
Compare
3d3c644
to
77edc65
Compare
77edc65
to
2f96403
Compare
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.
Please add some documentation to the class. It now has some non-obvious details, especially regarding what happens at destruction (see #10254 (comment)).
2f96403
to
af4cceb
Compare
983307f
to
9074d78
Compare
cb3068f
to
ba63964
Compare
01f2f7e
to
bfb0303
Compare
The requested changes were addressed, so far I didn't get around to do a full review though.
@yhabteab Please could you have yet another look? After all
|
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.
Please resolve the conflicts! And please drop the Co-Authored-By:
entry from bfb0303, that's just so unnecessary!
It's not used. Also, the callback shall run completely at once. This ensures that it won't (continue to) run once another coroutine on the strand calls Timeout#Cancel().
…g on multiple threads
…&&), #operator=(const Timeout&), #operator=(Timeout&&)
bfb0303
to
8f72891
Compare
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.
Drop incoming packets on one of the masters port. $ (sudo pfctl -sr 2>/dev/null; echo "block drop in on lo0 proto tcp from any to any port = 5666") | sudo pfctl -e -f - 2>/dev/null
[2025-01-08 10:27:40 +0100] critical/ApiListener: Cannot connect to host 'localhost' on port '5666': Operation canceled [system:89 at /opt/homebrew/include/boost/asio/detail/reactive_socket_connect_op.hpp:97:37 in function 'do_complete']
[2025-01-08 10:27:45 +0100] information/ApiListener: Reconnecting to endpoint 'satellite' via host 'localhost' and port '5666'
...
[2025-01-08 10:28:00 +0100] critical/ApiListener: Timeout while reconnecting to endpoint 'satellite' via host 'localhost' and port '5666', cancelling attempt
[2025-01-08 10:28:00 +0100] critical/ApiListener: Cannot connect to host 'localhost' on port '5666': Operation canceled [system:89 at /opt/homebrew/include/boost/asio/detail/reactive_socket_connect_op.hpp:97:37 in function 'do_complete']
[2025-01-08 10:28:05 +0100] information/ApiListener: Reconnecting to endpoint 'satellite' via host 'localhost' and port '5666'
...
[2025-01-08 10:28:20 +0100] critical/ApiListener: Timeout while reconnecting to endpoint 'satellite' via host 'localhost' and port '5666', cancelling attempt
[2025-01-08 10:43:11 +0100] warning/ApiListener: Timeout while processing incoming connection from [::1]:59149
Reactivate the standard firewall rules again: $ sudo pfctl -f /etc/pf.conf
👍 Now we got unit tests!!! ❤️ 144abb1
👍 Now the destructor leads to cancellation. 21fc946
👍 Now the callback is "atomic", i.e. it doesn't yield. 32e64b6 175099c This way cancellation can't happen in a callback yield, making sure once cancelled, the callback won't (continue to) run. Also, we don't need any coroutine which has to carry around shared pointers which prevent own destruction...
closes #10250
closes #10252