Skip to content

Avoid checkpointing null decay samples - #459

Draft
acavelan wants to merge 1 commit into
OpenMalaria-Org:mainfrom
acavelan:fix/null-decay-checkpoint
Draft

Avoid checkpointing null decay samples#459
acavelan wants to merge 1 commit into
OpenMalaria-Org:mainfrom
acavelan:fix/null-decay-checkpoint

Conversation

@acavelan

@acavelan acavelan commented Aug 4, 2026

Copy link
Copy Markdown
Collaborator

Problem

Running OpenMalaria in debug mode results in the same error for scenarios 26, 29 and 35:

/usr/include/c++/16.1.1/bits/unique_ptr.h:455: typename std::add_lvalue_reference<_Tp>::type std::unique_ptr<_Tp, _Dp>::operator*() const [with _Tp = OM::util::DecayFunction; _Dp = std::default_delete<OM::util::DecayFunction>; typename std::add_lvalue_reference<_Tp>::type = OM::util::DecayFunction&]: Assertion 'get() != pointer()' failed.

Which can be traced back to: https://github.com/acavelan/openmalaria/blob/cdba86848c6d00494dbe926236a237960b549d57/model/util/SimpleDecayingValue.h#L76

Current fix works but would result in a hidden error if a SimpleDecayValue is used in the model, outside of interventions.

SimpleDecayingValue leaves its heterogeneous decay sample null until deployment, but checkpointing dereferenced it unconditionally. Skip the empty sample so assertion-enabled builds avoid undefined behavior without changing the checkpoint layout.
@acavelan acavelan changed the title Avoid checkpointing unset decay samples Avoid checkpointing null decay samples Aug 5, 2026
@acavelan
acavelan marked this pull request as draft August 5, 2026 15:20
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.

1 participant