Skip to content

Assertion of pending transport when retransmission timer fires #4037

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

Merged
merged 1 commit into from
Aug 16, 2024

Conversation

nanangizz
Copy link
Member

Reported that this assertion is raised:

/* Must not be triggered while transport is pending. */ 
pj_assert((tsx->transport_flag & TSX_HAS_PENDING_TRANSPORT) == 0);

with call stack:

tsx_on_state_proceeding_uas + 2168
tsx_timer_callback + 868
pj_timer_heap_poll + 764

Normally when a transport is pending (due to async resolve/connect/send), TSX_HAS_PENDING_TRANSPORT will be set and transaction will not start the retransmission timer. It will just set transport flag TSX_HAS_PENDING_RESCHED so the retransmission timer will be started later after the operation is done. So TSX_HAS_PENDING_TRANSPORT should never be set when the retransmission timer fires (hence the assertion check is there).

However, tsx_retransmit() seems to restart the retransmission timer before performing the send operation, so there may be a condition that the sending is async (TSX_HAS_PENDING_TRANSPORT is set) and the retransmission timer is started. Note that normally the order should be the other way around (i.e: send first, start the timer when transport is not pending), code comment says something about loop transport, but I don't really understand it, so I don't want to change it.

Also note that retransmission interval is usually much longer than delay in async operation, hence the assertion should be rarely raised. But on IP change scenario, recreating & reconnecting transport may take longer than retransmission interval.

@nanangizz nanangizz merged commit 5d7e274 into master Aug 16, 2024
36 checks passed
@nanangizz nanangizz deleted the tsx-retransmit-assert branch August 16, 2024 03:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants