Skip to content
Snippets Groups Projects
  • Joshua Colp's avatar
    a676ba2a
    taskprocessor: Fix race condition between unreferencing and finding. · a676ba2a
    Joshua Colp authored
    When unreferencing a taskprocessor its reference count is checked
    to determine if it should be unlinked from the taskprocessors
    container and its listener shut down. In between the time when the
    reference count is checked and unlinking it is possible for
    another thread to jump in, find it, and get a reference to it. If
    the thread then uses the taskprocessor it may find that it is not
    in the state it expects.
    
    This change locks the taskprocessors container during almost the
    entire unreference operation to ensure that any other thread which
    may attempt to find the taskprocessor has to wait.
    
    ASTERISK-25295
    
    Change-Id: Icb842db82fe1cf238da55df92e95938a4419377c
    a676ba2a
    History
    taskprocessor: Fix race condition between unreferencing and finding.
    Joshua Colp authored
    When unreferencing a taskprocessor its reference count is checked
    to determine if it should be unlinked from the taskprocessors
    container and its listener shut down. In between the time when the
    reference count is checked and unlinking it is possible for
    another thread to jump in, find it, and get a reference to it. If
    the thread then uses the taskprocessor it may find that it is not
    in the state it expects.
    
    This change locks the taskprocessors container during almost the
    entire unreference operation to ensure that any other thread which
    may attempt to find the taskprocessor has to wait.
    
    ASTERISK-25295
    
    Change-Id: Icb842db82fe1cf238da55df92e95938a4419377c