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

Change DICOM storage stop behavior to soft stop #684

Merged
merged 4 commits into from
Feb 28, 2024

Conversation

Enet4
Copy link
Collaborator

@Enet4 Enet4 commented Jan 26, 2024

#664 introduced a mechanism which stops the DICOM storage service's indexer worker thread when the service is stopped by request. An unwanted side-effect of this is that stopping the storage service will halt any pending requests to index files already in storage, leaving them in the state of stored but not indexed.

Summary

  • let the index queue worker thread finish processing all items in queue before exiting
  • do not interrupt ongoing indexing tasks

- let the index queue worker thread
  finish processing all items in queue before exiting
- do not interrupt ongoing indexing tasks
@Enet4 Enet4 requested a review from bastiao January 26, 2024 17:26
@Enet4 Enet4 self-assigned this Jan 26, 2024
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.

LGTM

@Enet4 Enet4 marked this pull request as draft January 30, 2024 11:14
@Enet4
Copy link
Collaborator Author

Enet4 commented Jan 30, 2024

Putting this on hold because an index worker thread already waiting on take will not be awaken when the service is stopped.

- periodically poll from priority queue
  instead of take,
  giving the thread an opportunity to exit
  after DICOM storage was stopped
@Enet4 Enet4 marked this pull request as ready for review February 5, 2024 10:30
@Enet4 Enet4 requested a review from bastiao February 5, 2024 10:30
@Enet4
Copy link
Collaborator Author

Enet4 commented Feb 5, 2024

Mostly replaced take by poll, which can take a timeout. It might introduce some teeny trace work while waiting for items to index, but it's much better than leaking the thread.

There is also room for implementing a hard stop in the future, should we ever want that.

@bastiao
Copy link
Member

bastiao commented Feb 6, 2024

after discussion, we decided to reuse the thread.

- move IndexQueueWorker to a dedicated class
- start index worker thread when needed
- do not halt index worker thread when service is stopped
@tiberio-baptista
Copy link
Collaborator

I can say that this is working as intended now. Indexing continues to work for a TCP connection, even if the storage service is stopped midway.

Subsequent TCP connections are not possible, as expected.

Copy link
Collaborator

@tiberio-baptista tiberio-baptista left a comment

Choose a reason for hiding this comment

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

The PR works as intended.

I ran a traffic generator that sends DICOM files over CSTORE, and studies are no longer interrupted if they are mid-transfer. Subsequent transfers cannot be performed, as intended.

LGTM!

@Enet4 Enet4 merged commit d145455 into dev Feb 28, 2024
2 checks passed
@Enet4 Enet4 deleted the bug/dicom-storage-soft-stop branch February 28, 2024 11:21
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.

3 participants