Hi Praveen

NTF server also accepts initialize request (and here it comes from 
reinitializeClient() after headless) if NTF server has not initialized 
with CLM.
So after headless, this situation will most likely happen. The recovery 
would succeeds, but after that what if NTF server notifies the agent it 
is not longer a member, could a subscriber be waiting for notification 
while agent is not a member anymore?

Thanks,
Minh

On 11/04/16 15:46, praveen.malv...@oracle.com wrote:
>   osaf/libs/agents/saf/ntfa/ntfa_api.c |  28 ++++++++++++++++++----------
>   1 files changed, 18 insertions(+), 10 deletions(-)
>
>
> During headless state, OpenSAF may get stopped on payload with NTF app 
> running.
> Since OpenSAF is not running on the payload, any A.01.02 NTF client should 
> not be served on
> this node and this client should not be recovered. After first controller 
> comes up, A.01.02
> client will not be recovered and application will get SA_AIS_ERR_UNAVAILABLE 
> upon which an
> app can call saNtfFinalize() for freeing the resources.
>
> diff --git a/osaf/libs/agents/saf/ntfa/ntfa_api.c 
> b/osaf/libs/agents/saf/ntfa/ntfa_api.c
> --- a/osaf/libs/agents/saf/ntfa/ntfa_api.c
> +++ b/osaf/libs/agents/saf/ntfa/ntfa_api.c
> @@ -966,7 +966,8 @@ SaAisErrorT reinitializeClient(ntfa_clie
>       }
>       if ((rc = o_msg->info.api_resp_info.rc) != SA_AIS_OK) {
>               TRACE("info.api_resp_info.rc:%u", o_msg->info.api_resp_info.rc);
> -             rc = SA_AIS_ERR_BAD_HANDLE;
> +             if (rc != SA_AIS_ERR_UNAVAILABLE)
> +                     rc = SA_AIS_ERR_BAD_HANDLE;
>               goto done;
>       }
>   
> @@ -1033,7 +1034,8 @@ SaAisErrorT recoverReader(ntfa_client_hd
>       osafassert(o_msg != NULL);
>       if ((rc = o_msg->info.api_resp_info.rc) != SA_AIS_OK) {
>               TRACE("o_msg->info.api_resp_info.rc:%u", 
> o_msg->info.api_resp_info.rc);
> -             rc = SA_AIS_ERR_BAD_HANDLE;
> +             if (rc != SA_AIS_ERR_UNAVAILABLE)
> +                     rc = SA_AIS_ERR_BAD_HANDLE;
>               goto done;
>       }
>   
> @@ -1108,7 +1110,8 @@ SaAisErrorT recoverSubscriber(ntfa_clien
>   
>       if ((rc = o_msg->info.api_resp_info.rc) != SA_AIS_OK) {
>               TRACE("o_msg->info.api_resp_info.rc:%u", 
> o_msg->info.api_resp_info.rc);
> -             rc = SA_AIS_ERR_BAD_HANDLE;
> +             if (rc != SA_AIS_ERR_UNAVAILABLE)
> +                     rc = SA_AIS_ERR_BAD_HANDLE;
>               goto done;
>       }
>   
> @@ -1437,7 +1440,7 @@ SaAisErrorT saNtfDispatch(SaNtfHandleT n
>       if (!hdl_rec->valid) {
>               /* recovery */
>               if ((rc = recoverClient(hdl_rec)) != SA_AIS_OK) {
> -                     if ((rc == SA_AIS_ERR_BAD_HANDLE) || (rc == 
> SA_AIS_ERR_UNAVAILABLE)) {
> +                     if (rc == SA_AIS_ERR_BAD_HANDLE) {
>                               ncshm_give_hdl(ntfHandle);
>                               osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) 
> == 0);
>                               ntfa_hdl_rec_force_del(&ntfa_cb.client_list, 
> hdl_rec);
> @@ -1445,6 +1448,11 @@ SaAisErrorT saNtfDispatch(SaNtfHandleT n
>                               ntfa_shutdown(false);
>                               goto done;
>                       }
> +                     if (rc == SA_AIS_ERR_UNAVAILABLE) {
> +                             TRACE("Node not CLM member or stale client");
> +                             ncshm_give_hdl(ntfHandle);
> +                             goto done;
> +                     }
>               }
>       }
>   
> @@ -1807,7 +1815,7 @@ SaAisErrorT saNtfNotificationSend(SaNtfN
>               if ((rc = recoverClient(client_rec)) != SA_AIS_OK) {
>                       ncshm_give_hdl(client_handle);
>                       ncshm_give_hdl(notificationHandle);
> -                     if ((rc == SA_AIS_ERR_BAD_HANDLE) || (rc == 
> SA_AIS_ERR_UNAVAILABLE)) {
> +                     if (rc == SA_AIS_ERR_BAD_HANDLE) {
>                               osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) 
> == 0);
>                               ntfa_hdl_rec_force_del(&ntfa_cb.client_list, 
> client_rec);
>                               
> osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
> @@ -2153,7 +2161,7 @@ SaAisErrorT saNtfNotificationSubscribe(c
>               if (notificationFilterHandles->alarmFilterHandle)
>                       
> ncshm_give_hdl(notificationFilterHandles->alarmFilterHandle);
>       }
> -     if (recovery_failed && ((rc == SA_AIS_ERR_BAD_HANDLE) || (rc == 
> SA_AIS_ERR_UNAVAILABLE))) {
> +     if (recovery_failed && (rc == SA_AIS_ERR_BAD_HANDLE)) {
>               osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
>               ntfa_hdl_rec_force_del(&ntfa_cb.client_list, client_hdl_rec);
>               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
> @@ -3355,7 +3363,7 @@ SaAisErrorT saNtfNotificationUnsubscribe
>   
>       if (!client_hdl_rec->valid && getServerState() == NTFA_NTFSV_UP) {
>               if ((rc = recoverClient(client_hdl_rec)) != SA_AIS_OK) {
> -                     if ((rc == SA_AIS_ERR_BAD_HANDLE) || (rc == 
> SA_AIS_ERR_UNAVAILABLE)) {
> +                     if (rc == SA_AIS_ERR_BAD_HANDLE) {
>                               ncshm_give_hdl(ntfHandle);
>                               osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) 
> == 0);
>                               ntfa_hdl_rec_force_del(&ntfa_cb.client_list, 
> client_hdl_rec);
> @@ -3517,7 +3525,7 @@ done_give_client_hdl:
>       }
>   
>       ncshm_give_hdl(notificationFilterHandles->alarmFilterHandle);
> -     if (recovery_failed && ((rc == SA_AIS_ERR_BAD_HANDLE) || (rc == 
> SA_AIS_ERR_UNAVAILABLE))) {
> +     if (recovery_failed && (rc == SA_AIS_ERR_BAD_HANDLE)) {
>               osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) == 0);
>               ntfa_hdl_rec_force_del(&ntfa_cb.client_list, client_hdl_rec);
>               osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
> @@ -3621,7 +3629,7 @@ SaAisErrorT saNtfNotificationReadFinaliz
>   
>       if (!client_hdl_rec->valid && getServerState() == NTFA_NTFSV_UP) {
>               if ((rc = recoverClient(client_hdl_rec)) != SA_AIS_OK) {
> -                     if ((rc == SA_AIS_ERR_BAD_HANDLE) || (rc == 
> SA_AIS_ERR_UNAVAILABLE)) {
> +                     if (rc == SA_AIS_ERR_BAD_HANDLE) {
>                               ncshm_give_hdl(client_hdl_rec->local_hdl);
>                               ncshm_give_hdl(readhandle);
>                               osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) 
> == 0);
> @@ -3699,7 +3707,7 @@ SaAisErrorT saNtfNotificationReadNext(Sa
>               if ((rc = recoverClient(client_hdl_rec)) != SA_AIS_OK) {
>                       ncshm_give_hdl(client_hdl_rec->local_hdl);
>                       ncshm_give_hdl(readHandle);
> -                     if ((rc == SA_AIS_ERR_BAD_HANDLE) || (rc == 
> SA_AIS_ERR_UNAVAILABLE)) {
> +                     if (rc == SA_AIS_ERR_BAD_HANDLE) {
>                               osafassert(pthread_mutex_lock(&ntfa_cb.cb_lock) 
> == 0);
>                               ntfa_hdl_rec_force_del(&ntfa_cb.client_list, 
> client_hdl_rec);
>                               
> osafassert(pthread_mutex_unlock(&ntfa_cb.cb_lock) == 0);
>


------------------------------------------------------------------------------
Find and fix application performance issues faster with Applications Manager
Applications Manager provides deep performance insights into multiple tiers of
your business applications. It resolves application problems quickly and
reduces your MTTR. Get your free trial!
https://ad.doubleclick.net/ddm/clk/302982198;130105516;z
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to