Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't send an ACK to a 500 until *after* the callbacks #3255

Closed
wants to merge 1 commit into from

Conversation

jes
Copy link
Contributor

@jes jes commented Nov 24, 2023

Summary

We had an issue where HEP traces would show the ACK to a 500 being sent out before the 500 was received.

Details

This is confusing because it makes it look like OpenSIPS is preemptively ACK'ing a 500 it hasn't yet received.

Solution

This PR delays the sending of the ACK until after the callbacks for the 500 have run, which allows the HEP for the 500 response to be transmitted before the ACK and its HEP are transmitted.

Compatibility

I don't imagine this breaks any other scenarios, but it is conceivable that it does. I don't know enough.

Closing issues

Copy link

Any updates here? No progress has been made in the last 30 days, marking as stale.

@github-actions github-actions bot added the stale label Dec 25, 2023
@jes
Copy link
Contributor Author

jes commented Dec 25, 2023

No updates here.

@stale stale bot removed the stale label Dec 25, 2023
Copy link

Any updates here? No progress has been made in the last 30 days, marking as stale.

@github-actions github-actions bot added the stale label Jan 25, 2024
@jes
Copy link
Contributor Author

jes commented Jan 25, 2024

No updates here.

@stale stale bot removed the stale label Jan 25, 2024
@bogdan-iancu
Copy link
Member

Hi @jes , there is a very important comment, just on top of the code you moved:

/* acknowledge negative INVITE replies (do it before detailed
	 * on_reply processing, which may take very long, like if it
	 * is attempted to establish a TCP connection to a fail-over dst */

The idea here is to be able to send back the ACK (as confirmation for the negative reply) and stop any potential retransmission from the callee side - any extra processing here (like reply related callbacks) may delay the sending of the ACK and increase the chances of useless negative reply retransmissions.

Still, I agree with you on the bogus tracing behavior (like tracing first the ACK and then the reply) - it is a know issue and there is an outstanding bug report on that. Nevertheless, we do not have a solution here to make everybody happy :)

@bogdan-iancu bogdan-iancu self-assigned this Feb 13, 2024
liviuchircu added a commit that referenced this pull request May 8, 2024
Commit aaa6b68 mitigated the effects of a poor HEP connection
affecting the OpenSIPS's responsiveness by delaying the reply callbacks
until after the hop-by-hop ACK is sent out.  However, a side-effect in
doing so is that the reply/ACK HEP packets on un-established calls
became swapped.  This patch aims to address the issue.

Related to #3255
@liviuchircu
Copy link
Member

liviuchircu commented May 8, 2024

Some additional context: the issue with the swapped "negative-reply" and ACK HEP packets is a side-effect of commit aaa6b68 which, as @bogdan-iancu mentioned, improves the SIP server's responsiveness and helps reduce UDP retransmission traffic.

The issue is easily reproducible, which is helpful. And as a solution to make both ends meet (fix the HEP without compromising on performance), I pushed a patch to master which delays running the negative ACK callbacks until after the 200 OK callbacks are run, effectively reverting to the same callback ordering prior to aaa6b68, while retaining the performance boost.

If you could give some feedback on the patch as well before we backport it, @jes, that would be great! Thanks in advance!

@liviuchircu liviuchircu self-assigned this May 8, 2024
@liviuchircu liviuchircu added this to the 3.2.19 milestone May 8, 2024
liviuchircu added a commit that referenced this pull request Jul 25, 2024
Commit aaa6b68 mitigated the effects of a poor HEP connection
affecting the OpenSIPS's responsiveness by delaying the reply callbacks
until after the hop-by-hop ACK is sent out.  However, a side-effect in
doing so is that the reply/ACK HEP packets on un-established calls
became swapped.  This patch aims to address the issue.

Related to #3255

(cherry picked from commit 43477da)
@liviuchircu
Copy link
Member

Enough time has passed here for testing the fix on 3.5 beta - now also backported to 3.4. Closing as "Fixed" until further notice.

@jes
Copy link
Contributor Author

jes commented Jul 26, 2024

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants