Skip to content

Conversation

@Vovasch
Copy link

@Vovasch Vovasch commented Nov 20, 2025

  1. The destructor of the DcmBaseSCPPool class might never exit.
  2. Access violation exception thrown when the destructor of the DcmBaseSCPPool is called before all worker threads have finished and reported.

Zhyvotivskyi added 2 commits November 20, 2025 14:33
Current implementation of DcmBaseSCPPool's destructor waits for the m_runMode to be set to SHUTDOWN.
If m_runMode never set to SHUTDOWN the destructor will wait forever in the 'while' cycle.

Two cases when m_runMode is not set to SHUTDOWN:

Case 1:

The m_runMode won't be set to SHUTDOWN if DcmBaseSCPPool::listen() was never called.

Fix:

Changed default value of m_runMode from LISTEN to SHUTDOWN.
The m_runMode is set to LISTEN inside of the DcmBaseSCPPool::listen() function.

Case 2:

Call to initializeNetwork() in the DcmBaseSCPPool::listen() function might return bad condition.
In that case m_runMode won't be set to SHUTDOWN due to early return.

Fix:

Add a call to the newly added finishListening() function in case of early return.
…or of the pool was called.

There is no guarantee that all worker threads have completed their work when when m_runMode is set to SHUTDOWN.
Added an additional condition to the while loop to wait until all workers have completed their tasks and reported to the pool.
After that it's guarantied that all workers are in the m_workerIdle list and can be safely joined.
@Vovasch
Copy link
Author

Vovasch commented Nov 20, 2025

Link to the forum discussion.
https://forum.dcmtk.org/viewtopic.php?t=5488

@michaelonken
Copy link
Member

Hi Vovasch,

thank you very much for the detailed report and fixes. I merged them into the main repo and they will be visible on master during the next days.

Best regards,
Michael

@Vovasch
Copy link
Author

Vovasch commented Nov 24, 2025

Hi Michaelonken,

Thank you for your attention to this matter.

Regards,
Vova

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