Skip to content

fix: don't sleep/block if ticks are outstanding#650

Open
dryajov wants to merge 2 commits into
status-im:masterfrom
durability-labs:fix/dont-sleep-with-ticks
Open

fix: don't sleep/block if ticks are outstanding#650
dryajov wants to merge 2 commits into
status-im:masterfrom
durability-labs:fix/dont-sleep-with-ticks

Conversation

@dryajov

@dryajov dryajov commented May 22, 2026

Copy link
Copy Markdown
Contributor

Prevent poll() from blocking when internal ticks are outstanding.

When cancelSoon() fails to deliver cancellation on the first try, it installs a tick callback. However, poll() ignores ticks when calculating the current timeout. If a long timeout is scheduled, poll() can block until that timeout expires or IO wakes up the loop.

Treat tick callbacks as outstanding work when calculating the current poll() timeout.

Comment thread tests/testtime.nim Outdated
@arnetheduck

arnetheduck commented May 30, 2026

Copy link
Copy Markdown
Member

hm, that's a lot of test failures .. almost looks like it was going into a busy loop sometimes

@dryajov

dryajov commented Jun 5, 2026

Copy link
Copy Markdown
Contributor Author

Interesting, I'll take a look

Co-authored-by: Jacek Sieka <arnetheduck@gmail.com>
@arnetheduck

Copy link
Copy Markdown
Member

related: #655

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.

2 participants