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 indexer queue worker thread handling #664

Merged
merged 3 commits into from
Aug 25, 2023
Merged

Conversation

Enet4
Copy link
Collaborator

@Enet4 Enet4 commented Aug 17, 2023

This PR resolves some known issues with the DICOM storage indexer worker thread, most importantly:

  • The indexer thread is taken down when DICOM storage is stopped (resolves Indexer thread leaks when disabling DICOM storage #663).
  • If the indexer thread dies, the incident is logged and the DICOM storage service is stopped to prevent further damage. We do expect IT to intervene at this stage. An alternative would be terminating the whole archive.

Summary

  • The indexer thread was given the name indexer-queue-worker
  • Define indexer thread with a Runnable instead of a Thread subclass
  • Add logic to take down the old indexer worker thread when DICOM storage is stopped.
    • if DICOM storage service is stopped, flip workerShouldExit flag and interrupt thread
  • Add exception handler to indexer queue worker for damage control. DICOM storage service is disabled automatically, which prevents the archive from accepting files that will never be indexed.

- define indexer thread with a Runnable
- name indexer thread to indexer-queue-worker
- add logic to take down old indexer worker thread
   - if DICOM storage service is stopped,
     flip `workerShouldExit` flag and interrupt thread
- for damage control,
  DICOM storage service is disabled automatically,
  which prevents the archive from accepting files
  that will not be indexed
- reduce Interrupted log line to warning level
- tweak messages
Copy link
Member

@bastiao bastiao left a comment

Choose a reason for hiding this comment

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

Verified with a few stop/start of DICOM Storage service while keep working with different indexers, and no issues founds.

@bastiao bastiao merged commit 74e3b9f into dev Aug 25, 2023
2 checks passed
@bastiao bastiao deleted the bug/indexer-thread-leak branch August 25, 2023 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Indexer thread leaks when disabling DICOM storage
2 participants