Repository navigation
Conversation
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.
Summary
Initialize the poll event fields after reconnecting an RTPengine control socket, preventing spurious reply timeouts when the cached socket was unavailable on entry.
Details
In
send_rtpe_command(), the input-draining block initializesfds[0]only when a cached socket exists.If the cached socket is -1, that block is skipped. A successful reconnect then sets
fds[0].fd, but leaveseventsuninitialized. Consequently,poll()may not report an available reply, and OpenSIPS can incorrectly time out and disable a responsive node.This can occur when an RTPengine hostname cannot be resolved at startup but becomes resolvable later.
Related: #3532 updated the descriptor after reconnecting, but did not initialize the event fields on this path.
Solution
After a successful reconnect, also set:
fds[0].events = POLLINfds[0].revents = 0Validated using a real OpenSIPS build and a mock RTPengine control endpoint, with the hostname initially unresolvable and made resolvable after startup:
The patched version recovered promptly once the name became resolvable. The original version experienced additional timeouts despite replies arriving; its behavior depends on uninitialized stack contents.
Testing was performed on Linux ARM64 using a hosts-file change. AMD64, IPv6 and real DNS-cache behavior were not tested.
Compatibility
No configuration changes are required. Existing socket lifecycle, retry counts and node-disabling policy are unchanged.
This patch only initializes polling state. It does not introduce DNS refresh or cached-socket invalidation.
Closing issues
None.