Skip to content

clusterer: answer a sync request for a capability with no event callback - #4517

Open
Lt-Flash wants to merge 1 commit into
OpenSIPS:masterfrom
Lt-Flash:fix/clusterer-sync-nullcb
Open

Lt-Flash wants to merge 1 commit into
OpenSIPS:masterfrom
Lt-Flash:fix/clusterer-sync-nullcb

Conversation

@Lt-Flash

Copy link
Copy Markdown
Contributor

Summary
clusterer: answer a sync request for a capability that has no event callback, instead of crashing.

Details
A module may register a capability with a NULL event callback; tm, ratelimit, pua and dialog's profile replication do. send_sync_repl() calls cap->reg.event_cb(SYNC_REQ_RCV, ...) unconditionally, so a SYNC_REQ for such a capability crashes the node that receives it. On the requesting node, run_cb_buf_pkt() calls event_cb(SYNC_DONE, ...) unconditionally when the SYNC_END arrives, so that node crashes too once the donor survives. The node event paths in do_actions_node_ev() already check the callback; these two did not.

Solution
Call the event callback in both places only when there is one. A capability without one has nothing to sync, so the donor still sends a SYNC_END with zero chunks, which is what ends the requester's wait, and the requester marks the sync as done.

Tested with the reproduction in the issue on master (9c442ad): without the fix the donor crashes; with only the donor-side check the requester crashes; with both, both nodes stay up and log a completed empty sync.

Compatibility
No change for capabilities that have an event callback.

Closing issues
closes #4516

@Lt-Flash
Lt-Flash force-pushed the fix/clusterer-sync-nullcb branch from 8802f2d to 49a8fac Compare December 1, 2026 09:51
A capability registered without an event callback (tm, ratelimit, pua,
dialog profiles) crashed the node that received a sync request for it,
which called the missing callback; the node that asked crashed the same
way when the empty sync ended.  The request is answered with an empty
sync, and neither side calls a callback that is not there.
@Lt-Flash
Lt-Flash force-pushed the fix/clusterer-sync-nullcb branch from 49a8fac to f97ca48 Compare December 1, 2026 18:07
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.

[CRASH] clusterer: a sync request for a capability with no event callback crashes both nodes

1 participant