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

improve: fix thread pool shutdown #3000

Merged
merged 2 commits into from
Oct 28, 2024
Merged

Conversation

dudantas
Copy link
Member

@dudantas dudantas commented Oct 21, 2024

Description

Fixed an issue where the ThreadPool::shutdown() method would hang indefinitely due to waiting on threads without proper condition signaling.

Depuration with gdb:
image

Normal loading:
image

Behaviour

Actual

The ThreadPool shutdown process hangs indefinitely with the message "Shutting down thread pool..." without completing.

Expected

The ThreadPool should properly notify threads to complete their tasks and shut down gracefully, avoiding hanging indefinitely.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

How Has This Been Tested

The fix was tested by reproducing the shutdown scenario where the hanging issue occurred. The shutdown process now correctly notifies threads to complete, and the shutdown process finishes as expected.

  • Tested the shutdown of ThreadPool after an error in loading, confirming no indefinite hang.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I checked the PR checks reports
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings

Copy link

@dudantas dudantas merged commit 497646c into main Oct 28, 2024
35 checks passed
@dudantas dudantas deleted the dudantas/fix-thread-pool-shutdown branch October 28, 2024 17:47
@murilo09 murilo09 linked an issue Oct 31, 2024 that may be closed by this pull request
5 tasks
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.

[error] Thread pool shutdown timed out.
5 participants