Timed-out search tasks can continue running after Qui marks them complete #2326
Unanswered
mrsJedi
asked this question in
Issue Triage
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Description
Summary
I found a cancellation-lifecycle defect in Qui v1.25.0’s shared search scheduler.
executeTaskstartstask.exec(...)in a goroutine, then waits for either its result or context expiry. If the context expires first, Qui records the task as finished and removes it from the scheduler’s in-flight state without waiting for thetask.execgoroutine to exit.A downstream operation that does not return promptly after cancellation can therefore continue running after Qui considers the task complete, potentially retaining goroutines, connections, or file descriptors.
The scheduled cross-seed path reaches this scheduler through
jackettService.Recent.What happened?
All times below are CDT.
Before the rise, Qui had approximately:
Before restart, it reached:
After restarting Qui, it returned to approximately:
What did I expect?
A timed-out task can report its timeout to the caller immediately, but Qui should retain ownership of that task until its execution goroutine has actually exited. It should not remove the task from
inFlightor treat it as fully complete while its work is still running.What actually happened?
The scheduler treated the task as complete immediately after context expiry, even though its execution goroutine could still be running.
I reproduced this against v1.25.0 with an isolated test using a short-lived context and a deliberately blocked
task.execfunction. When the deadline expired:context deadline exceeded.executeTaskreturned.Steps to reproduce
context.WithTimeout.task.execsignal that it started, then block without returning.executeTask.context deadline exceededand returns beforetask.exechas exited.Environment
Relevant logs
Checklist
All reactions