Skip to content

fix(call): fast-path offer and line delivery to unblock push-answer mutation queue deadlock#1234

Merged
SERDUN merged 1 commit intodevelopfrom
fix/push-answer-mutation-queue-deadlock
Apr 30, 2026
Merged

fix(call): fast-path offer and line delivery to unblock push-answer mutation queue deadlock#1234
SERDUN merged 1 commit intodevelopfrom
fix/push-answer-mutation-queue-deadlock

Conversation

@SERDUN
Copy link
Copy Markdown
Member

@SERDUN SERDUN commented Apr 29, 2026

Problem

When answering an incoming push call (kill-on-background enabled), the call gets stuck in preparing state and drops after ~10 seconds.

Root cause: __onMutationPerformAnswer holds the sequential mutation queue slot while awaiting stream.firstWhere(incomingOffer != null). __onMutationSignalingIncoming (which stores the offer in state) is queued behind it — deadlock that ends in a 10 s timeout.

Fix

__onCallSignalingEventIncoming runs in the independent _CallSignalingEvent queue. When an offer arrives for a call that is already in incomingFromPush, incomingSubmittedAnswer, or incomingPerformingStarted with no offer yet, emit both incomingOffer and line directly to BLoC state. This unblocks stream.firstWhere immediately without waiting for the mutation queue.

__onMutationSignalingIncoming still runs afterwards and re-sets the same values (harmless). The canPerformAnswer guard drops any duplicate CallControlEvent.answered safely.

Related

…utation queue deadlock

__onMutationPerformAnswer (sequential mutation queue) awaits
stream.firstWhere(incomingOffer != null) while holding the queue slot.
__onMutationSignalingIncoming — which stores the offer and line in state —
is queued behind it and cannot run: deadlock, resolved only by 10 s timeout.

Fix: in __onCallSignalingEventIncoming (_CallSignalingEvent queue,
independent of the mutation queue), emit offer and line directly to BLoC
state when the call is in a push-answer waiting status and has no offer yet.
This immediately satisfies stream.firstWhere without touching the mutation
queue and ensures AcceptRequest is sent with the correct SIP line.
@SERDUN SERDUN force-pushed the fix/push-answer-mutation-queue-deadlock branch from e93643e to f115b3a Compare April 29, 2026 16:56
@SERDUN SERDUN marked this pull request as ready for review April 29, 2026 16:59
@SERDUN SERDUN requested a review from digiboridev April 29, 2026 16:59
@SERDUN SERDUN merged commit 0b15a7a into develop Apr 30, 2026
2 checks passed
@SERDUN SERDUN deleted the fix/push-answer-mutation-queue-deadlock branch April 30, 2026 06:52
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.

2 participants