Skip to content

Fix dependency-stall detection that aborted geometry/material builds on progress#156

Merged
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/108-dependency-stall-check
Jun 13, 2026
Merged

Fix dependency-stall detection that aborted geometry/material builds on progress#156
maureeungaro merged 1 commit into
gemc:mainfrom
zhaozhiwen:fix/108-dependency-stall-check

Conversation

@zhaozhiwen

Copy link
Copy Markdown
Collaborator

Both the volume and material build loops in g4world.cc aborted with ERR_G4DEPENDENCIESNOTSOLVED exactly when the build was making progress. Two defects: (1) the remaining-count tracker was updated only in the else branch, so after iteration 1 it froze; (2) the comparison previous >= current is true whenever the count stays the same or decreases — i.e. it fires on progress, not on a stall.

Any geometry/material set needing more than one resolution pass (a child built after its mother — the normal multi-pass case) leaves fewer remaining items on the next iteration, which is the success path, and aborted.

Track the previous iteration's count in a dedicated variable updated every iteration, and error only when the count fails to strictly decrease (current >= previous) while the previous count was nonzero. Applied identically to both loops.

Validation: rebuilt gemc and ran the b1 (sqlite) and cherenkov (optical) examples in the Geant4 11.4.1 dev container — both build all volumes and materials and run to completion with no spurious dependency error.

Fixes #108

Both the volume and material build loops aborted with
ERR_G4DEPENDENCIESNOTSOLVED exactly when the build was making progress.
Two defects: (1) the remaining-count tracker was updated only in the else
branch, so after iteration 1 it froze; (2) the comparison
`previous >= current` fires whenever the count stays the same OR
decreases — i.e. on progress, not on a stall.

Any geometry/material set needing more than one resolution pass (a child
built after its mother, the normal multi-pass case) leaves fewer
remaining items on the next iteration — the success path — and aborted.

Track the previous iteration's count in a dedicated variable updated every
iteration, and error only when the count fails to strictly decrease
(`current >= previous`) while the previous count was nonzero. Applied
identically to both loops.

Verified: b1 (sqlite) and cherenkov (optical) examples build all volumes
and materials and run to completion with no spurious dependency error
(Geant4 11.4.1 dev container).

Fixes gemc#108

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@maureeungaro maureeungaro merged commit 60a1fdf into gemc:main Jun 13, 2026
30 checks passed
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.

[High] Inverted dependency-stall check aborts geometry/material build when progress is made

2 participants