Hi Praveen,

When app do saNtfInitialize(), the ntfa will send initialized message with
normal priority (MDS_SEND_PRIORITY_MEDIUM = 2) to NTFS. NTFS pick this
message up in mds callback and put  to mbx with same priority . if app is
dead suddenly after initializing, NTFS will receive both initialized message
and MDS_DOWN  event message and NTFS will process which messages have higher
priority firstly. When you change the priority of MDS_DOWN  event message to
high, the MDS_DOWN event message will be process before initialized message.
This cause the new ntf client for app is created in NTFS while app was dead.

Regards,
Canh

-----Original Message-----
From: praveen.malv...@oracle.com [mailto:praveen.malv...@oracle.com] 
Sent: Monday, November 28, 2016 4:16 PM
To: minh.c...@dektech.com.au; canh.v.tru...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: [PATCH 1 of 1] ntfd: process NTFA down event with high
priority[#2206]

 osaf/services/saf/ntfsv/ntfs/NtfAdmin.cc        |  2 +-
 osaf/services/saf/ntfsv/ntfs/NtfClient.cc       |  2 ++
 osaf/services/saf/ntfsv/ntfs/NtfSubscription.cc |  7 +++++++
osaf/services/saf/ntfsv/ntfs/NtfSubscription.hh |  1 +
 osaf/services/saf/ntfsv/ntfs/ntfs_com.c         |  3 ++-
 osaf/services/saf/ntfsv/ntfs/ntfs_mds.c         |  4 ++--
 6 files changed, 15 insertions(+), 4 deletions(-)


syslog gets flooded with following messages:
Nov 24 12:38:00 SC-1 osafntfd[11771]: ER ntfs_mds_msg_send FAILED Nov 24
12:38:00 SC-1 osafntfd[11771]: ER ntfs_mds_msg_send to ntfa failed rc: 2 Nov
24 12:38:00 SC-1 osafntfd[11771]: ER ntfs_mds_msg_send FAILED

In reported problem, an application like ntfsend is continuously sending
notifications. Other subscriber application like ntfsubscribe with matching
filter criteria is receiving those notifications. When subscriber suddenly
exits, NTFS receives MDS_DOWN event for it. At the same time MDS is
continuously delievering notifications sent by the sender app to the NTFS.
NTFS posts internal events for both notification messages and NTFA down
messages with HIGH and NORMAL priority respectively.
Since priority of NTFA down event is NORMAL, NTFS processes down event
relatively late compare to notificatin send messages. So notification send
messages are processed before NTFA down events. While sending these
notification to the subscriber, ncsmds_api returns failure because MDS has
already cleared subscriber data like mds_dest.

With this patch, NTFS will process NTFA down event with HIGH priority.
Also LOG_ER is converted to LOG_WA or trace at some places.

diff --git a/osaf/services/saf/ntfsv/ntfs/NtfAdmin.cc
b/osaf/services/saf/ntfsv/ntfs/NtfAdmin.cc
--- a/osaf/services/saf/ntfsv/ntfs/NtfAdmin.cc
+++ b/osaf/services/saf/ntfsv/ntfs/NtfAdmin.cc
@@ -540,7 +540,7 @@ void NtfAdmin::discardedAdd(unsigned int
   }
   else
   {
-    LOG_ER("client %u not found", clientId);
+    LOG_WA("client %u not found", clientId);
   }
 }
 
diff --git a/osaf/services/saf/ntfsv/ntfs/NtfClient.cc
b/osaf/services/saf/ntfsv/ntfs/NtfClient.cc
--- a/osaf/services/saf/ntfsv/ntfs/NtfClient.cc
+++ b/osaf/services/saf/ntfsv/ntfs/NtfClient.cc
@@ -55,6 +55,8 @@ NtfClient::~NtfClient() {
   SubscriptionMap::iterator pos;
   for (pos = subscriptionMap.begin(); pos != subscriptionMap.end(); pos++)
{
     NtfSubscription* subscription = pos->second;
+    TRACE("For subscription:'%u', num of discarded Notifications: '%u'",
+      subscription->getSubscriptionId(), 
+ subscription->discardedListSize());
     delete subscription;
   }
   // delete all readers
diff --git a/osaf/services/saf/ntfsv/ntfs/NtfSubscription.cc
b/osaf/services/saf/ntfsv/ntfs/NtfSubscription.cc
--- a/osaf/services/saf/ntfsv/ntfs/NtfSubscription.cc
+++ b/osaf/services/saf/ntfsv/ntfs/NtfSubscription.cc
@@ -277,3 +277,10 @@ void NtfSubscription::printInfo() {
   TRACE("Subscription information");
   TRACE("  subscriptionId %u", subscriptionId_);  }
+/**
+ *  Returns size of discarded list.
+ */
+unsigned int NtfSubscription::discardedListSize() {
+  return discardedNotificationIdList.size();
+}
+
diff --git a/osaf/services/saf/ntfsv/ntfs/NtfSubscription.hh
b/osaf/services/saf/ntfsv/ntfs/NtfSubscription.hh
--- a/osaf/services/saf/ntfsv/ntfs/NtfSubscription.hh
+++ b/osaf/services/saf/ntfsv/ntfs/NtfSubscription.hh
@@ -41,6 +41,7 @@ class NtfSubscription{
   void sendNotification(NtfSmartPtr& notification, NtfClient *client);
   void discardedAdd(SaNtfIdentifierT n_id);
   void discardedClear();
+  unsigned int discardedListSize();
   void syncRequest(NCS_UBAID *uba);
  private:
   FilterMap filterMap;
diff --git a/osaf/services/saf/ntfsv/ntfs/ntfs_com.c
b/osaf/services/saf/ntfsv/ntfs/ntfs_com.c
--- a/osaf/services/saf/ntfsv/ntfs/ntfs_com.c
+++ b/osaf/services/saf/ntfsv/ntfs/ntfs_com.c
@@ -305,7 +305,8 @@ int send_notification_lib(ntfsv_send_not
                               MDS_SEND_PRIORITY_HIGH);
        if (rc != NCSCC_RC_SUCCESS) {
                discarded = NTFS_NOTIFICATION_DISCARDED;
-               LOG_ER("ntfs_mds_msg_send to ntfa failed rc: %d", (int)rc);
+               //This notification will be sent again as a discarded
notification.
+               TRACE_1("ntfs_mds_msg_send to ntfa failed rc: %d", (int)rc);
        } 
        /* Allways confirm if not success notification will be put in
discarded list. */
        notificationSentConfirmed(client_id, dispatchInfo->subscriptionId,
*header->notificationId, discarded); diff --git
a/osaf/services/saf/ntfsv/ntfs/ntfs_mds.c
b/osaf/services/saf/ntfsv/ntfs/ntfs_mds.c
--- a/osaf/services/saf/ntfsv/ntfs/ntfs_mds.c
+++ b/osaf/services/saf/ntfsv/ntfs/ntfs_mds.c
@@ -938,7 +938,7 @@ static uint32_t mds_svc_event(struct ncs
                        evt->info.mds_info.mds_dest_id =
info->info.svc_evt.i_dest;
 
                        /* Push the event and we are done */
-                       if (m_NCS_IPC_SEND(&ntfs_cb->mbx, evt,
NCS_IPC_PRIORITY_NORMAL) != NCSCC_RC_SUCCESS) {
+                       if (m_NCS_IPC_SEND(&ntfs_cb->mbx, evt,
NCS_IPC_PRIORITY_HIGH) != 
+NCSCC_RC_SUCCESS) {
                                TRACE("ipc send failed");
                                ntfs_evt_destroy(evt);
                                rc = NCSCC_RC_FAILURE;
@@ -1287,7 +1287,7 @@ uint32_t ntfs_mds_msg_send(ntfs_cb_t *cb
        /* send the message */
        rc = ncsmds_api(&mds_info);
        if (rc != NCSCC_RC_SUCCESS) {
-               LOG_ER("ntfs_mds_msg_send FAILED");
+               LOG_WA("ntfs_mds_msg_send FAILED");
        }
        return rc;
 }


------------------------------------------------------------------------------
_______________________________________________
Opensaf-devel mailing list
Opensaf-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to