Using `ScheduledExecutorService` for timeouts
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by locating the timeout operation and the runtime or scope lifecycle that would own scheduling. Compare the current sleeping-thread race with ScheduledExecutorService and the linked Netty IdleStateHandler approach; the issue does not define acceptance criteria for performance, cancellation, or runtime ownership.
Written by the indexing model from the issue text.
Description
Currently, the timeout operation is implemented by racing given operation with a sleeping thread (BTW a similar approach is used in Cats Effect).
I was wondering if we could leverage a ScheduledExecutorService instead. It operates on a single threaded, which schedules and starts actual tasks. Netty uses this mechanism for timeouts in its IdleStateHandler. A scheduled task starts, emits an event and ends immediately. Then, Netty's internals handle the event in order to abort communication if a timeout occured.
In case of Ox, a scheduled task would start on a virtual thread (see hints in this Stack Overflow discussion). It would then call cancelation of the fork that's wrapped with timeout.
I don't know if such a solution will be more performant than racing with a sleeping thread, but I'm leaving this idea here for consideration. One certain issue is that the single-threaded pool for scheduling doesn't sound like something we want to create for each scope, but rather like a "runtime" that needs passing around.
- Dominant language
- Scala
- Stars
- 524
- Forks
- 36
- Avg merge
- 40m
- Merged PRs (30d)
- 15
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from softwaremill/ox
-
Difficulty 5/5 Over a week Newbie friendliness 45/100
softwaremill/ox#469 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
softwaremill/ox#366 · 7 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
softwaremill/ox#311 · 2 comments ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 30/100
softwaremill/ox#201 ·
Maintainers usually reply within 1 day
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
softwaremill/ox#147 · 1 reaction ·
Maintainers usually reply within 1 day
Similar issues
-
scope:security type:aquasec
Difficulty 1/5 Under an hour Newbie friendliness 90/100
AbsaOSS/StatusBoard#69 ·
-
Difficulty 1/5 Under an hour Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
A-consensus C-question
Difficulty 1/5 Under an hour Newbie friendliness 74/100
ergoplatform/ergo#2624 ·
Maintainers usually reply within 3 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
[Rust][Flaky Test] multiple_deadlines_fire_in_order asserts a wall-clock gap instead of firing orderOpenCI/CD ⚒️ Flaky-tests 🐦
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
valkey-io/valkey-glide#7255 ·
Maintainers usually reply within 3 days