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

Deadlock in SIPServerTransactionImpl ? #78

Open
kpouer opened this issue Feb 3, 2022 · 0 comments
Open

Deadlock in SIPServerTransactionImpl ? #78

kpouer opened this issue Feb 3, 2022 · 0 comments

Comments

@kpouer
Copy link

kpouer commented Feb 3, 2022

Hi,
I have a SipDialog whose lastTransaction is a SipServerTransactionImpl

The state is Completed state (because it received a 491 on a RE-INVITE) until a timer sets it to Terminated (according to RFC3261 page 127 I think).
I am trying to send a RE-INVITE before the timer is triggered, so it is blocked in the ReInviteSender at this line
452: ((SIPServerTransaction)SIPDialog.this.lastTransaction).waitForTermination();

When the timer is triggered the state changes to _TERMINATED but if the transport is not reliable (UDP), then the this.terminationSemaphore.release(); will never be called and the ReInviteSender will remains blocked in the semaphore forever

@Override
public void setState(int newState) {
    // Set this timer for connection caching
    // of incoming connections.
    if (newState == TransactionState._TERMINATED && this.isReliable()
            && (!getSIPStack().cacheServerConnections)) {
        // Set a time after which the connection
        // is closed.
        this.collectionTime = TIMER_J;
        this.terminationSemaphore.release();
    }

    super.setState(newState);

}

In fact I'm not sure about the good thing to do in that case for now I replaced the test with

if (newState == TransactionState._TERMINATED && (!isReliable() || (this.isReliable() && (!getSIPStack().cacheServerConnections)))) {

so the release is called also on UDP transport.

kpouer pushed a commit to kpouer/jsip that referenced this issue Jan 10, 2023
…CKETS_HEADERS = true by default

(cherry picked from commit bb1a0d314833b47ceb226853658e4373bb288d12)
kpouer pushed a commit to kpouer/jsip that referenced this issue Jan 15, 2023
…CKETS_HEADERS = true by default

(cherry picked from commit bb1a0d314833b47ceb226853658e4373bb288d12)
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

No branches or pull requests

1 participant