--fork behaving as single threaded#143
Open
luissantosHCIT wants to merge 2 commits intoDCMTK:masterfrom
Open
Conversation
… available. removed the need to block on each command execution if we are within the fork context. This reverts a change from 11/14/2025 (9ae75af) Signed-off-by: Luis M. Santos <lsantos@medicalmasses.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The Problem
When
--forkis invoked,storescpaccepts the associations up to the limit defined in--max-associationsand then proceeds to downloading subsequent associations one at a time as if--exec-syncor--single-processwas called.Looking into the codebase, I noticed that there is an attempt at cleaning at least one zombie process from the child list at every invocation of an external processing command. This leads to single-threaded processing of incoming associations.
The current version of
storescpalready has a mechanism checking if we are under the--max-associationcontext which can only be invoked with--fork. It also only waits for one of the children to clear up before moving forward.My Solution
My changes here are to remove the opt_forkMode option inclusion during the zombie cleanup check since we do not want to block execution. I also included the idea to wait on all
opt_maxChildrenbatch before spawning the next batch of processors.As far as I can tell, the changes were stable processing 5K+ associations in my laptop, which was less tolerant of resource exhaustion than other systems in which I have used dcmtk. I tested with and without
--max-associations. I know your team has a robust testing suite so I shall wait to see if changes here are enough and sufficient.If you believe a further tweak to the changes should be included, let me know.