[pjsip] Callbacks still called back after pjmedia_port_destroy

Benny Prijono bennylp at pjsip.org
Tue Feb 12 05:38:51 EST 2008


On 2/11/08, Norman Franke <norman at myasd.com> wrote:
>
> I don't get a crash, but it could be one in the same. I'm definitely getting
> a call back after it was destroyed. Sounds like the main thread should just
> mark it as closed and clean it up some other way. Or perhaps destroy can
> remove the port (so it won't get call backs), unlock, then re-lock and
> destroy?

That was the intention, i.e. destroy should detach the port from the
transport's callback so it won't get called. But unfortunately this
wouldn't help if the transport is already waiting in the stream's
mutex.

I've looked at various ways to add flags to synchronize these, but so
far there don't seem to be any way (and not to mention that having
flags for synchronization is quite ugly).

So the solution for this may lay deep in the ioqueue. Currently the
ioqueue releases the handle's lock before calling the callback to
allow parallel callback execution (for scalability purpose), and this
what causes the problem. If we have an option to disable this, then
possibly we can have some way to synchronize between callback and
detach operation.

This is the approach that I'm heading to right now, I just need to
verify that it won't introduce deadlocks. Stay tuned.

cheers,
 -benny




More information about the pjsip mailing list