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

Timeout: use less resources, clean them up better and make cancellation deterministic #10254

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

Al2Klimov
Copy link
Member

@Al2Klimov Al2Klimov commented Nov 26, 2024

👍 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

@Al2Klimov Al2Klimov added the core/quality Improve code, libraries, algorithms, inline docs label Nov 26, 2024
@cla-bot cla-bot bot added the cla/signed label Nov 26, 2024
lib/base/io-engine.hpp Outdated Show resolved Hide resolved
lib/base/io-engine.hpp Outdated Show resolved Hide resolved
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().
test/base-io-engine.cpp Outdated Show resolved Hide resolved
yhabteab
yhabteab previously approved these changes Nov 28, 2024
Copy link
Contributor

@julianbrost julianbrost left a 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)).

lib/remote/jsonrpcconnection.cpp Outdated Show resolved Hide resolved
test/base-io-engine.cpp Show resolved Hide resolved
lib/base/io-engine.hpp Outdated Show resolved Hide resolved
lib/base/io-engine.hpp Outdated Show resolved Hide resolved
lib/base/io-engine.hpp Outdated Show resolved Hide resolved
lib/base/io-engine.hpp Outdated Show resolved Hide resolved
@Al2Klimov Al2Klimov force-pushed the Timeout-Cancel branch 2 times, most recently from 983307f to 9074d78 Compare November 29, 2024 13:18
@Al2Klimov Al2Klimov requested a review from yhabteab November 29, 2024 13:21
@Al2Klimov Al2Klimov force-pushed the Timeout-Cancel branch 2 times, most recently from cb3068f to ba63964 Compare November 29, 2024 15:25
yhabteab
yhabteab previously approved these changes Nov 29, 2024
@Al2Klimov Al2Klimov assigned julianbrost and unassigned Al2Klimov and yhabteab Dec 2, 2024
lib/base/io-engine.hpp Outdated Show resolved Hide resolved
lib/base/io-engine.hpp Show resolved Hide resolved
test/base-io-engine.cpp Show resolved Hide resolved
lib/base/io-engine.hpp Outdated Show resolved Hide resolved
Al2Klimov and others added 2 commits December 2, 2024 17:00
…meout&&), Timeout#operator=(const Timeout&), Timeout#operator=(Timeout&&)
Co-authored-by: ChatGPT <[email protected]>
@julianbrost julianbrost dismissed their stale review December 4, 2024 17:30

The requested changes were addressed, so far I didn't get around to do a full review though.

@Al2Klimov
Copy link
Member Author

@yhabteab Please could you have yet another look? After all

  1. I've force-pushed this since Timeout: use less resources, clean them up better and make cancellation deterministic #10254 (review)
  2. We need this if you don't want do exactly copy this PR in JsonRpcConnection: Don't drop client from cache prematurely #10210 (review)

Copy link
Member

@yhabteab yhabteab left a 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla/signed core/quality Improve code, libraries, algorithms, inline docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants