< Previous by Date Date Index Next by Date >
  Thread Index Next in Thread >

[reSIProcate] resiprocate crash or dead lock when first subscribe has expires set to 0


Hi,
We are using resiprocate library 1.8.11-1 from fedora 19 updates to build an rls server.
We have set callbacks for:
-  resip::ServerSubscriptionHandler::onNewSubscription
-  resip::ServerSubscriptionHandler::onTerminated
-  resip::ServerSubscriptionHandler::onExpiredByClient
and so on.

I have noticed that if the first subscribe has expires set to 0 the server enter in a dead lock or even
crashes.
I have investigated this problem and it seems that if in onNewSubscription callback we send
the full notify message after we are sending the 202 message, onTerminated callback is called before onExpiredByClient callback.

The problem is that in ServerSubscription::send is:
       DialogUsage::send(msg);
      if (mSubscriptionState == Terminated)
      {
         handler->onTerminated(getHandle());
         delete this;
      }

So resip::ServerSubscriptionHandle is deleted at this moment and later on, when is passed to
onExpiredByClient callback it dead lock or even crashes the application because it points to invalid memory.

My hack to avoid the crash was to change onNewSubscription callback to not send the notify message if the subscribe had expires set to 0.

Do you know about this problem? Is this fixed in a new resiprocate version?

Thank you!
Ionut