Skip to content

job: Avoid deadlock when adding jobs during stopping - #80

Merged
joamaki merged 1 commit into
mainfrom
pr/joamaki/hive-job-shutdown-deadlock
Aug 21, 2026
Merged

joamaki merged 1 commit into
mainfrom
pr/joamaki/hive-job-shutdown-deadlock

Conversation

@joamaki

@joamaki joamaki commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

The job registry held the registry mutex when stopping the jobs which can lead to a deadlock if a job tries to add a job during the stopping.

Fix the issue by not holding the registry mutex when stopping the lifecycle. This wasn't required for anything except checking 'started'. The lifecycle had its own mutex and when it was stopping it only grabbed the mutex to collect jobs to stop so doesn't wait for a job to stop with mutex held.

AIL:3

The job registry held the registry mutex when stopping the jobs which can
lead to a deadlock if a job tries to add a job during the stopping.

Fix the issue by not holding the registry mutex when stopping the
lifecycle. This wasn't required for anything except checking 'started'.
The lifecycle had its own mutex and when it was stopping it only grabbed
the mutex to collect jobs to stop so doesn't wait for a job to stop with
mutex held.

AIL:3
Signed-off-by: Jussi Maki <jussi.maki@isovalent.com>
@joamaki
joamaki requested a review from a team as a code owner August 21, 2026 09:05
@joamaki
joamaki requested review from pippolo84 and removed request for a team August 21, 2026 09:05

@pippolo84 pippolo84 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✔️

@joamaki
joamaki merged commit cc26f40 into main Aug 21, 2026
1 check passed
@joamaki
joamaki deleted the pr/joamaki/hive-job-shutdown-deadlock branch August 21, 2026 12:57
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