Skip to content

Restore dependent reload list when an evaluation is rolled back - #704

Merged
xdelaruelle merged 1 commit into
envmodules:mainfrom
xdelaruelle:depre-restore-settings
Sep 21, 2026
Merged

xdelaruelle merged 1 commit into
envmodules:mainfrom
xdelaruelle:depre-restore-settings

Conversation

@xdelaruelle

Copy link
Copy Markdown
Collaborator

When the unload of a module triggers the unload phase of several dependent modules and one of them fails, the evaluation is rolled back but the dependent reload list keeps the modules queued before the failure. Their properties were never saved as the unload phase stopped before reaching them. If the sequence then continues, like a switch with switch_unload absent from abort_on_error, the reload phase looks up these missing properties and raises an internal Tcl error:

ERROR: can't read "::g_savedPropsOfReloadMod(modA)": no such element in array

Save the dependent reload list and the saved properties of reloading modules along with the other settings pushed before an evaluation, so a rollback restores them to their state prior the failed evaluation. Dependents restored in the loaded environment by this rollback are thus not reloaded anymore, consistently with what already happens when a single dependent fails to unload.

Fix authored by Adrien Cotte. A new test case in 616-abort_on_error-switch.exp reproduces the error without the fix, and a NEWS entry is added.

@xdelaruelle
xdelaruelle force-pushed the depre-restore-settings branch from a396bd7 to 4e72f16 Compare September 20, 2026 13:21
When the unload of a module triggers the unload phase of several
dependent modules and one of them fails, the evaluation is rolled back
but the dependent reload list keeps the modules queued before the
failure. Their properties were never saved as the unload phase stopped
before reaching them. If the sequence then continues, like a switch
with switch_unload absent from abort_on_error, the reload phase looks up
these missing properties and raises an internal Tcl error.

Save the dependent reload list and the saved properties of reloading
modules along with the other settings pushed before an evaluation, so a
rollback restores them to their state prior the failed evaluation.
Dependents restored in the loaded environment by this rollback are thus
not reloaded anymore.

Assisted-by: Claude:claude-fable-5-1
Signed-off-by: Adrien Cotte <adrien.cotte@asplus.fr>
Signed-off-by: Xavier Delaruelle <xavier.delaruelle@cea.fr>
@xdelaruelle
xdelaruelle merged commit f1bb32a into envmodules:main Sep 21, 2026
22 checks passed
@xdelaruelle
xdelaruelle deleted the depre-restore-settings branch September 21, 2026 07:45
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