Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ezk-sip-core v0.6: Transports::set_used panics because upgrading from a weak in MangedTransport::try_get does not succeed. #54

@Nereuxofficial

Description

@Nereuxofficial

Describe the bug

In Transports::set_used ezk_sip_core expects a TpHandle to always be returned from a MangedTransport, however this is not always the case. In this line of MangedTransport::try_get:

            let owner = weak_tx.upgrade()?;

an upgrade from a weak pointer to an Arc is attempted, which may fail if the object is already deallocated. The method in here is called when a message is received in a separate task for receiving messages.

How to reproduce

This fails when dropping the transaction before the last message arrives.
This will drop the Arc, which the weak is trying to upgrade to upon receiving the reply to the message however the receiver may still receive KeepAlive messages, causing this bug to occur.

I'm aware that this version of ezk-sip-core is outdated but just wanted to post this issue here in case anyone else runs into it.
The solution would be to make the set_used method fallible and a workaround is to drop the transaction at a later time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions