[asterisk-dev] [Code Review] 2860: pjsip: race condition in registrar
Kevin Harwell
reviewboard at asterisk.org
Tue Sep 24 11:53:17 CDT 2013
> On Sept. 23, 2013, 9:03 a.m., Matt Jordan wrote:
> > branches/12/res/res_pjsip_registrar.c, lines 252-258
> > <https://reviewboard.asterisk.org/r/2860/diff/2/?file=46072#file46072line252>
> >
> > This may be a reference leak.
> >
> > serializer_create will create an ao2 object with a reference count of 1.
> >
> > When you ao2_link it into the serializers container, the reference count of the object goes to 2.
> >
> > This means that the container does not hold the only reference to the object - so merely destroying the container will not destroy all objects in the container - it will actually orphan them.
> >
> > On a successful ao2_link, you should drop the creation reference provided by serializer_create.
This is not a reference leak. The newly created serializer is returned and is unref'ed by the caller.
- Kevin
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/2860/#review9758
-----------------------------------------------------------
On Sept. 18, 2013, 2:04 p.m., Kevin Harwell wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/2860/
> -----------------------------------------------------------
>
> (Updated Sept. 18, 2013, 2:04 p.m.)
>
>
> Review request for Asterisk Developers, Joshua Colp and Mark Michelson.
>
>
> Bugs: AST-1213
> https://issues.asterisk.org/jira/browse/AST-1213
>
>
> Repository: Asterisk
>
>
> Description
> -------
>
> While handling a registration request a race condition could occur if/when two+ clients registered at the same time. This happened when one request obtained a copy of the current contacts for an AOR and another request did the same before the first request updated. Thus the second would update and overwrite the first (or vice-versa depending on which actually updated first). In the case of it being the same contact two "add" events would be raised.
>
> pjsip registration handling is now serialized to alleviate this issue.
>
>
> Diffs
> -----
>
> branches/12/res/res_pjsip_registrar.c 399392
>
> Diff: https://reviewboard.asterisk.org/r/2860/diff/
>
>
> Testing
> -------
>
> Had a few phones register themselves with asterisk using pjsip registration. Also ran all the pjsip registration testsuite tests and made sure they all passed.
>
>
> Thanks,
>
> Kevin Harwell
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20130924/6f69f967/attachment-0001.html>
More information about the asterisk-dev
mailing list