[Home]

Summary:ASTERISK-25094: PBX core: Investigate thread safety issues
Reporter:Corey Farrell (coreyfarrell)Labels:
Date Opened:2015-05-15 08:03:50Date Closed:2015-06-09 06:59:31
Priority:MajorRegression?
Status:Closed/CompleteComponents:Core/PBX
Versions:SVN 11.17.1 13.3.2 Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:While working on ASTERISK-25085 I found that {{ast_context_find}} and {{ast_context_find_or_create}} are not thread safe. They both return an ast_context, but as soon as these functions run {{ast_unlock_contexts}} it's possible for another thread to cause the context to be freed.

Any function that works with ast_context pointers (input or output) and runs it's own locking is likely unsafe for the same reason.

I think we need a _nolock versions of many functions, where the caller would run them with a lock.  For master maybe it would be better for ast_context to become an AO2 object?  This way we could avoid destroying contexts during merge operations, we would just copy references of original contexts that we still need, then unreference everything from the original list when we swap out.
Comments: