Skip to content

Gracefully handle already removed objects - #104

Merged
bebopagogo merged 1 commit into
USNavalResearchLaboratory:masterfrom
sleepybishop:fix-issue-81
Aug 28, 2026
Merged

Gracefully handle already removed objects#104
bebopagogo merged 1 commit into
USNavalResearchLaboratory:masterfrom
sleepybishop:fix-issue-81

Conversation

@sleepybishop

@sleepybishop sleepybishop commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #81.

Adds a safety check to NormObjectTable::Remove in the USE_PROTO_TREE implementation to verify that the object exists in the tree before attempting removal.

When a user calls NormObjectCancel on an object already aborted internally by the NORM protocol, it will now gracefully return false rather than crashing via a tree.Find assertion or risking a use-after-free.

@sleepybishop sleepybishop changed the title Fix #81: Gracefully handle already removed objects in NormObjectTable::Remove Gracefully handle already removed objects Aug 12, 2026
@sleepybishop
sleepybishop marked this pull request as ready for review August 12, 2026 03:53

@bebopagogo bebopagogo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this the root cause of the issue that was initially reported regarding the ProtoTree issue? I.e., during shutdown incomplete objects are aborted and removed which races with user API calls to Remove()? I'm trying to understand the sequence of events. For NORM_OBJECT_DATA, it may be important the API notifications work cleanly to allow for release of attached memory allocations ... I am approving this but taking a self action to review that to see if there is a race condition I need to fix above and beyond this safety measure

@bebopagogo
bebopagogo merged commit f197344 into USNavalResearchLaboratory:master Aug 28, 2026
6 checks passed
@sleepybishop

Copy link
Copy Markdown
Contributor Author

Maybe not, I may have chased the wrong rabbit. I think RX_OBJECT_NEW remained queued while Sync() internally aborted and removed it, but the event was queued and so the application later received a valid handle and called NormObjectCancel().

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.

NormObjectTable::Remove(NormObject*): Assertion `__null != tree.Find(theObject->GetId().GetValuePtr(), 8*sizeof(UINT16))' failed

2 participants