Hi Alex

Ack. Legacy tested

Thanks
Lennart

> -----Original Message-----
> From: Alex Jones [mailto:ajo...@genband.com]
> Sent: den 6 april 2017 20:26
> To: reddy.neelaka...@oracle.com; Lennart Lund
> <lennart.l...@ericsson.com>; Rafael Odzakow
> <rafael.odza...@ericsson.com>
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: [PATCH 1 of 1] smfd: fix race condition when detecting async failures
> [#2413]
> 
>  src/smf/smfd/SmfCampaignThread.cc |  16 ++++++++++------
>  1 files changed, 10 insertions(+), 6 deletions(-)
> 
> 
> smfd core dumps during commit of campaign.
> 
> If an AMF SU under maintenance fails right as the campaign commit is done,
> there
> is a race condition present. Before SMF clears the suMaintenaceCampaign
> attribute of the SU, if the SU fails, it will send a notification. Meanwhile,
> the commit deletes upgrade campaign pointer inside smfd. If the deletion of
> the
> campaign pointer inside smfd occurs before it receives the NTF event a crash
> will occur because the campaign pointer is gone.
> 
> Solution is to always process NTF events before processing the termination
> of
> the campaign. The campaign termination code sets "m_running" to false, and
> deletes the pointer. This should always be last in the poll loop so that the
> loop will exit immediately without processing any NTF events (or other
> future
> events.)
> 
> diff --git a/src/smf/smfd/SmfCampaignThread.cc
> b/src/smf/smfd/SmfCampaignThread.cc
> --- a/src/smf/smfd/SmfCampaignThread.cc
> +++ b/src/smf/smfd/SmfCampaignThread.cc
> @@ -907,12 +907,10 @@ int SmfCampaignThread::handleEvents(void
>                       break;
>               }
> 
> -                /* Process the Mail box events */
> -             if (fds[0].revents & POLLIN) {
> -                     /* dispatch MBX events */
> -                     processEvt();
> -             }
> -
> +    /*
> +     * Handle NTF events first because processEvt may delete and terminate
> the
> +     * campaign thread.
> +     */
>               if (fds[1].revents & POLLIN) {
>                       // dispatch NTF events
>                       rc = saNtfDispatch(m_ntfHandle, SA_DISPATCH_ALL);
> @@ -922,6 +920,12 @@ int SmfCampaignThread::handleEvents(void
>                       }
>               }
> 
> +                /* Process the Mail box events */
> +             if (fds[0].revents & POLLIN) {
> +                     /* dispatch MBX events */
> +                     processEvt();
> +             }
> +
>               m_campaign->updateElapsedTime();
>       }
>       TRACE_LEAVE();


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to