core: guard null central particle in bond breakage angle branch (bug-sweep #26)#5360
Draft
RudolfWeeber wants to merge 1 commit into
Draft
Conversation
…sweep #26) The REVERT_BIND_AT_POINT_OF_COLLISION angle-bond branch of actions_for_breakage guarded only the two partner particles (if (p1 and p2)) and then dereferenced vs->is_virtual() without checking vs != nullptr. The global breakage queue is broadcast to every MPI rank, so each rank runs actions_for_breakage for every entry, including entries whose central virtual-site particle is not local/ghost on this rank. On a rank where both partners resolve but the central particle does not, get_local_particle(e.particle_id) returns nullptr and vs->is_virtual() is a null dereference (SIGSEGV). Fix: guard with if (vs and p1 and p2), mirroring the pair branch which already guards its central particle. Absence-on-rank is a legitimate locality condition, so the branch returns an empty action set rather than throwing. To make the function unit-testable, de-static actions_for_breakage and declare it in bond_breakage.hpp (the Action/ActionSet aliases move to actions.hpp). Adds a regression test that reproduces the locality condition on a single rank (partners present, central absent). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
I think this is legit, although it is not obvious to me, how to trigger it from Python. |
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 REVERT_BIND_AT_POINT_OF_COLLISION angle-bond branch of
actions_for_breakage guarded only the two partner particles
(if (p1 and p2)) and then dereferenced vs->is_virtual() without
checking vs != nullptr. The global breakage queue is broadcast to
every MPI rank, so each rank runs actions_for_breakage for every
entry, including entries whose central virtual-site particle is not
local/ghost on this rank. On a rank where both partners resolve but
the central particle does not, get_local_particle(e.particle_id)
returns nullptr and vs->is_virtual() is a null dereference (SIGSEGV).
Fix: guard with if (vs and p1 and p2), mirroring the pair branch which
already guards its central particle. Absence-on-rank is a legitimate
locality condition, so the branch returns an empty action set rather
than throwing.
To make the function unit-testable, de-static actions_for_breakage and
declare it in bond_breakage.hpp (the Action/ActionSet aliases move to
actions.hpp). Adds a regression test that reproduces the locality
condition on a single rank (partners present, central absent).
Co-Authored-By: Claude Opus 4.8 noreply@anthropic.com
🤖 Generated with Claude Code