Re: [devel] [PATCH 0/1] Review Request for amf: add support for container/contained [#70]

2018-08-03 Thread Alex Jones
   Hi Gary,

   The check to make sure saAmfCompContainerCsi is defined for a
   contained component, was not handling the case in which the comptype
   was being added dynamically in the same ccb. I assume that is what your
   tests are doing...

   Try the attached patch on top of what I sent.

   Alex

   On 08/02/2018 09:50 PM, Gary Lee wrote:
 __

   NOTICE: This email was received from an EXTERNAL sender
 __

   Some more info from valgrind:
   ==274== Invalid read of size 1
   ==274== at 0x14C080: is_config_valid(std::__cxx11::basic_string, std::allocator > const&,
   SaImmAttrValuesT_2 const**, CcbUtilOperationData*) [clone
   .constprop.98] (comp.cc:404)
   ==274== by 0x14C4A0: comp_ccb_completed_cb(CcbUtilOperationData*)
   (comp.cc:1359)
   ==274== by 0x16B4C7: ccb_completed_cb(unsigned long long, unsigned long
   long) (imm.cc:1177)
   ==274== by 0x548D487: imma_process_callback_info(imma_cb*,
   imma_client_node*, imma_callback_info*, unsigned long long)
   (imma_proc.cc:2337)
   ==274== by 0x548EED8: imma_hdl_callbk_dispatch_all(imma_cb*, unsigned
   long long) (imma_proc.cc:1832)
   ==274== by 0x5482FA6: saImmOiDispatch (imma_oi_api.cc:642)
   ==274== by 0x12866B: main_loop (main.cc:713)
   ==274== by 0x12866B: main (main.cc:844)
   ==274== Address 0x20 is not stack'd, malloc'd or (recently) free'd
   On 3/8/18, 11:25 am, "Gary Lee" [1] wrote:
   Hi Alex
   I haven't had a chance to look at it, but I did run our regression
   tests with the patch.
   amfd is segfaulting regularly, with backtraces like the attachment.
   Thanks
   Gary
   From: Alex Jones [2]
   Organization: Ribbon
   Date: Thursday, 2 August 2018 at 3:52 am
   To: [3], [4],
   [5], [6]
   Cc: [7]
   Subject: Re: [PATCH 0/1] Review Request for amf: add support for
   container/contained [#70]
   Hi Guys,
   I realized I forgot to put some notes in this review request...
   75% of this code is from Praveen. I added some stuff that wasn't there
   like shutting down contained sus when the container goes down, allowing
   TRY_AGAIN in contained instantiation, and some more configuration
   checking.
   Everything in the B.04.01 spec regarding container/contained should be
   implemented, but I have not testing everything. Everything in the
   samples/amf/container directory has been tested (container n-way,
   contained 2-n, TRY_AGAIN for contained instantiation), but I have not
   tested other service models for the contained SG. I have also tested
   locking the container SUs, and the container SG, to make sure the
   contained SUs go down.
   Let me know if you see problems, or think something wasn't done right.
   Alex
   On 07/31/2018 04:22 PM, Alex Jones wrote:
   Summary: amf: add support for container/contained [#70]
   Review request for Ticket(s): 70
   Peer Reviewer(s): Nagu, Hans, Ravi, Gary
   Pull request to:
   Affected branch(es): develop
   Development branch: ticket-70
   Base revision: 7f6f6c0531a0f5e4f2b0dc1abf4bab6962a3d1a9
   Personal repository: [8]git://git.code.sf.net/u/trguitar/review
   
   Impacted area Impact y/n
   
   Docs n
   Build system n
   RPM/packaging n
   Configuration files n
   Startup scripts n
   SAF services y
   OpenSAF services n
   Core libraries n
   Samples n
   Tests n
   Other n
   NOTE: Patch(es) contain lines longer than 80 characers
   Comments (indicate scope for each "y" above):
   -
   revision d33e50eeb51ccf8808c24a445637d6f1472c396e
   Author: Alex Jones [9]
   Date: Tue, 31 Jul 2018 16:06:47 -0400
   amf: add support for container/contained [#70]
   This ticket adds support for container/contained for AMF.
   Added Files:
   
   samples/amf/container/amf_container_demo.c
   samples/amf/container/amf_container_script
   samples/amf/container/AppConfig-contained-2N.xml
   samples/amf/container/AppConfig-container.xml
   samples/amf/container/Makefile.am
   samples/amf/container/README
   Complete diffstat:
   --
   samples/amf/container/AppConfig-contained-2N.xml | 327 +
   samples/amf/container/AppConfig-container.xml | 331 ++
   samples/amf/container/Makefile.am | 45 ++
   samples/amf/container/README | 36 +
   samples/amf/container/amf_container_demo.c | 803
   +++
   samples/amf/container/amf_container_script | 101 +++
   src/amf/agent/amf_agent.cc | 73 ++-
   src/amf/agent/ava_cb.h | 1 +
   src/amf/agent/ava_hdl.cc | 31 +
   src/amf/agent/ava_mds.cc | 34 +-
   src/amf/agent/ava_mds.h | 3 +-
   src/amf/agent/ava_op.cc | 6 +
   src/amf/amfd/comp.cc | 55 +-
   src/amf/amfd/comp.h | 4 +-
   src/amf/amfd/comptype.cc | 6 +-
   src/amf/amfd/csi.cc | 6 +
   src/amf/amfd/csi.h | 3 +
   src/amf/amfd/ndproc.cc | 14 +
   src/amf/amfd/node.cc | 29 +
   

Re: [devel] [PATCH 1/1] ntf: Update timeout for initializing log client [#2878]

2018-08-03 Thread Lennart Lund
Hi Canh

I happened to see this

It is always correct to have a timed try again loop. If initializing the log 
service time out in the AMF callback may not a big issue. If this happen NTF 
will get a BAD_HANDLE reply when trying to write a log record. If this happen, 
just initialize the log service and then write the log record (initializing in 
this case means initializing and open the alarm stream, only alarms are 
logged). If initializing fail at this time it may be considered a bit more 
serious. The recovery in this case may be a node restart initiated by an abort. 
I assume writing log records is not done in any AMF callback function it does 
not matter if the try again loop has a bit longer timeout time than it can have 
in an AMF callback function. I think initializing the log service in AMF 
callback shall be removed. It is good enough if it is done the first time 
writing a log record is requested and if the log handle becomes invalid for 
some reason.
I haven't checked the code yet but I will take a look

Regards
Lennart

> -Original Message-
> From: Minh Hon Chau 
> Sent: den 3 augusti 2018 09:32
> To: Canh Van Truong ; Vu Minh Nguyen
> 
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [devel] [PATCH 1/1] ntf: Update timeout for initializing log 
> client
> [#2878]
> 
> Hi Canh,
> 
> This issue seems to be partially fixed, we now prioritize to respond to
> AMF callback. But if LOG service is still not responsive, NTF will run
> without logging capability. I think we can address the second issue in
> another ticket.
> 
> Ack from me for code review, one comment in line.
> 
> Thanks
> 
> Minh
> 
> 
> On 26/06/18 16:53, Canh Van Truong wrote:
> > When NTFD is started, the NtfAdmin class object is defined and log client is
> > initialized in this object. The initialiation of client may be loop forever
> > if TRY_AGAIN error always return. Somehow log service has not been
> started on
> > time or log service is busy, NTFD is kept in the loop. And the AMF hasn't
> > received csi callback.
> >
> > This patch update the timeout when initializing log client.
> > ---
> >  src/ntf/ntfd/NtfLogger.cc | 165 +++---
> 
> >  src/ntf/ntfd/NtfLogger.h  |   4 +-
> >  2 files changed, 85 insertions(+), 84 deletions(-)
> >
> > diff --git a/src/ntf/ntfd/NtfLogger.cc b/src/ntf/ntfd/NtfLogger.cc
> > index fd17c58a2..9878824c3 100644
> > --- a/src/ntf/ntfd/NtfLogger.cc
> > +++ b/src/ntf/ntfd/NtfLogger.cc
> > @@ -20,17 +20,18 @@
> >   *   INCLUDE FILES
> >   *
> ==
> ==
> >   */
> > -#include 
> > +#include "ntf/ntfd/NtfLogger.h"
> >
> > -#include "base/osaf_utility.h"
> > +#include 
> >  #include 
> >  #include 
> > -#include "ntf/ntfd/NtfAdmin.h"
> > -#include "ntf/ntfd/NtfLogger.h"
> >  #include "ntfs_com.h"
> > -#include "base/logtrace.h"
> >  #include "ntf/common/ntfsv_mem.h"
> > +#include "ntf/ntfd/NtfAdmin.h"
> > +#include "base/logtrace.h"
> >  #include "base/osaf_extended_name.h"
> > +#include "base/osaf_utility.h"
> > +#include "base/osaf_time.h"
> >
> >  /*
> ==
> ==
> >   *   DEFINITIONS
> > @@ -38,7 +39,6 @@
> >   */
> >  #define LOG_OPEN_TIMEOUT SA_TIME_ONE_SECOND
> >  #define LOG_NOTIFICATION_TIMEOUT SA_TIME_ONE_SECOND
> > -#define AIS_TIMEOUT 50
> >
> >  /*
> ==
> ==
> >   *   TYPE DEFINITIONS
> > @@ -65,15 +65,15 @@ void saLogWriteLogCallback(SaInvocationT
> invocation, SaAisErrorT error);
> >   */
> >
> >  static SaLogCallbacksT logCallbacks = {NULL, NULL, saLogWriteLogCallback};
> > -
> >  static SaLogHandleT logHandle;
> >  static SaLogStreamHandleT alarmStreamHandle;
> > +static bool log_client_initialized = false;
> >  const SaVersionT kLogVersion = {'A', 2, 3};
> > +const uint64_t kWaitTime = 8 * 1000; // Wait for timeout is 8 seconds
> >
> >  NtfLogger::NtfLogger() : readCounter(0) {
> >if (SA_AIS_OK != initLog()) {
> > -LOG_ER("initialize saflog failed exiting...");
> > -exit(EXIT_FAILURE);
> > +LOG_WA("Initialize saflog failed");
> >}
> >  }
> [Minh]: I think the exit() was there if initLog() fails, so that NID/AMF
> can restart the NTF service. We can remove it unless NTF has completed
> recycling LOG handle from BAD_HANDLE/TIMEOUT/...
> >
> > @@ -97,6 +97,8 @@ void saLogWriteLogCallback(SaInvocationT invocation,
> SaAisErrorT error) {
> >
> >  TRACE_1("Error when logging (%d), queue for relogging", error);
> >
> > +if (error == SA_AIS_ERR_BAD_HANDLE) log_client_initialized = false;
> > +
> >  notification = NtfAdmin::theNtfAdmin->getNotificationById(
> >  (SaNtfIdentifierT)invocation);
> >
> > @@ -151,6 +153,15 @@ void NtfLogger::queueNotifcation(NtfSmartPtr&
> notif) {
> >
> >  void NtfLogger::checkQueueAndLog(NtfSmartPtr& newNotif) {
> >TRACE_ENTER();
> > +
> > +  // Initialize client if 

Re: [devel] [PATCH 1/1] osaf: update for saflog in case saLogWriteLogAsync with BAD_HANDLE [#2886]

2018-08-03 Thread Vu Minh Nguyen
Hi Canh,

Ack with minor comments inline.

Regards, Vu

> -Original Message-
> From: Canh Van Truong 
> Sent: Monday, July 2, 2018 5:24 PM
> To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong
> 
> Subject: [PATCH 1/1] osaf: update for saflog in case saLogWriteLogAsync
> with BAD_HANDLE [#2886]
> 
> If saLogWriteLogAsync return BAD_HANDLE error, log client will never be
> re-initialized again. The patch reset variable "log_client_initialized =
false"
> in case BAD_HANDLE and the client will be re-initialized later.
> ---
>  src/osaf/saflog/saflog.c | 75

>  1 file changed, 25 insertions(+), 50 deletions(-)
> 
> diff --git a/src/osaf/saflog/saflog.c b/src/osaf/saflog/saflog.c
> index 0c6ae5850..24312d162 100644
> --- a/src/osaf/saflog/saflog.c
> +++ b/src/osaf/saflog/saflog.c
> @@ -15,53 +15,48 @@
>   * Author(s): Ericsson
>   *
>   */
> +#include "osaf/saflog/saflog.h"
> 
>  #include 
> -#include 
>  #include 
> +#include 
>  #include 
> -#include "osaf/saflog/saflog.h"
>  #include 
> +#include "base/logtrace.h"
> 
> -static int initialized;
> +static bool log_client_initialized;
[Vu] Should initialize this variable.

>  static SaLogStreamHandleT logStreamHandle;
>  static SaLogHandleT logHandle;
> 
>  void saflog_init(void)
>  {
> - SaAisErrorT error;
> -
> - if (!initialized) {
> + if (log_client_initialized == false) {
[Vu] Checking the value with true might be better. Return if true, otherwise
do below. 
Do that, we will not have one more level of indentation.

>   SaVersionT logVersion = {'A', 2, 3};
>   SaNameT stream_name;
>   saAisNameLend(SA_LOG_STREAM_SYSTEM, _name);
> 
> - error = saLogInitialize(, NULL, );
> - if (error != SA_AIS_OK) {
> - syslog(LOG_INFO,
> -"saflogInit: saLogInitialize FAILED: %u",
error);
> + SaAisErrorT rc = saLogInitialize(, NULL,
> );
[Vu] Consider to add retry mechanism when calling SAF API.

> + if (rc != SA_AIS_OK) {
> + LOG_NO("saflogInit: saLogInitialize FAILED: %u",
rc);
>   return;
>   }
> 
> - error = saLogStreamOpen_2(logHandle, _name,
> NULL, 0,
> + rc = saLogStreamOpen_2(logHandle, _name, NULL, 0,
> SA_TIME_ONE_SECOND,
> );
> - if (error != SA_AIS_OK) {
> - syslog(LOG_INFO,
> -"saflogInit: saLogStreamOpen_2 FAILED: %u",
> -error);
> + if (rc != SA_AIS_OK) {
> + LOG_NO("saflogInit: saLogStreamOpen_2 FAILED: %u",
> rc);
>   if (saLogFinalize(logHandle) != SA_AIS_OK)
> - syslog(LOG_INFO,
> -"saflogInit: saLogFinalize FAILED:
%u",
> -error);
> + LOG_NO("saflogInit: saLogFinalize FAILED:
%u",
> +rc);
>   return;
>   }
> - initialized = 1;
> + log_client_initialized = true;
>   }
>  }
> 
>  void saflog(int priority, const SaNameT *logSvcUsrName, const char
> *format, ...)
>  {
> - SaAisErrorT error;
> + SaAisErrorT rc;
>   SaLogRecordT logRecord;
>   SaLogBufferT logBuffer;
>   va_list ap;
> @@ -74,34 +69,14 @@ void saflog(int priority, const SaNameT
> *logSvcUsrName, const char *format, ...)
>   va_end(ap);
> 
>   if (logBuffer.logBufSize > SA_LOG_MAX_RECORD_SIZE) {
> - syslog(LOG_INFO,
> -"saflog write FAILED: log record size > %u max
limit",
> + LOG_NO("saflog write FAILED: log record size > %u max
limit",
>  SA_LOG_MAX_RECORD_SIZE);
>   return;
>   }
> 
> - if (!initialized) {
> - SaVersionT logVersion = {'A', 2, 3};
> - SaNameT stream_name;
> - saAisNameLend(SA_LOG_STREAM_SYSTEM, _name);
> -
> - error = saLogInitialize(, NULL, );
> - if (error != SA_AIS_OK) {
> - syslog(LOG_INFO, "saLogInitialize FAILED: %u",
error);
> - goto done;
> - }
> -
> - error = saLogStreamOpen_2(logHandle, _name,
> NULL, 0,
> -   SA_TIME_ONE_SECOND,
> );
> - if (error != SA_AIS_OK) {
> - syslog(LOG_INFO, "saLogStreamOpen_2 FAILED: %u",
> error);
> - if (saLogFinalize(logHandle) != SA_AIS_OK)
> - syslog(LOG_INFO, "saLogFinalize FAILED: %u",
> -error);
> - goto done;
> - }
> - initialized = 1;
> - }
> + // Initialize log 

Re: [devel] [PATCH 1/1] ntf: Update timeout for initializing log client [#2878]

2018-08-03 Thread Vu Minh Nguyen
Hi Canh,

Ack with minor comments inline.

Regards, Vu

> -Original Message-
> From: Canh Van Truong 
> Sent: Tuesday, June 26, 2018 1:54 PM
> To: minh.c...@dektech.com.au; vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong
> 
> Subject: [PATCH 1/1] ntf: Update timeout for initializing log client
[#2878]
> 
> When NTFD is started, the NtfAdmin class object is defined and log client
is
> initialized in this object. The initialiation of client may be loop
forever
> if TRY_AGAIN error always return. Somehow log service has not been started
> on
> time or log service is busy, NTFD is kept in the loop. And the AMF hasn't
> received csi callback.
> 
> This patch update the timeout when initializing log client.
> ---
>  src/ntf/ntfd/NtfLogger.cc | 165
+++---
> 
>  src/ntf/ntfd/NtfLogger.h  |   4 +-
>  2 files changed, 85 insertions(+), 84 deletions(-)
> 
> diff --git a/src/ntf/ntfd/NtfLogger.cc b/src/ntf/ntfd/NtfLogger.cc
> index fd17c58a2..9878824c3 100644
> --- a/src/ntf/ntfd/NtfLogger.cc
> +++ b/src/ntf/ntfd/NtfLogger.cc
> @@ -20,17 +20,18 @@
>   *   INCLUDE FILES
>   *
> ==
> ==
>   */
> -#include 
> +#include "ntf/ntfd/NtfLogger.h"
> 
> -#include "base/osaf_utility.h"
> +#include 
>  #include 
>  #include 
> -#include "ntf/ntfd/NtfAdmin.h"
> -#include "ntf/ntfd/NtfLogger.h"
>  #include "ntfs_com.h"
> -#include "base/logtrace.h"
>  #include "ntf/common/ntfsv_mem.h"
> +#include "ntf/ntfd/NtfAdmin.h"
> +#include "base/logtrace.h"
>  #include "base/osaf_extended_name.h"
> +#include "base/osaf_utility.h"
> +#include "base/osaf_time.h"
> 
>  /*
> ==
> ==
>   *   DEFINITIONS
> @@ -38,7 +39,6 @@
>   */
>  #define LOG_OPEN_TIMEOUT SA_TIME_ONE_SECOND
>  #define LOG_NOTIFICATION_TIMEOUT SA_TIME_ONE_SECOND
> -#define AIS_TIMEOUT 50
> 
>  /*
> ==
> ==
>   *   TYPE DEFINITIONS
> @@ -65,15 +65,15 @@ void saLogWriteLogCallback(SaInvocationT
> invocation, SaAisErrorT error);
>   */
> 
>  static SaLogCallbacksT logCallbacks = {NULL, NULL,
> saLogWriteLogCallback};
> -
>  static SaLogHandleT logHandle;
>  static SaLogStreamHandleT alarmStreamHandle;
> +static bool log_client_initialized = false;
[Vu] consider to move this global to be an attribute of NtfLogger class.
>  const SaVersionT kLogVersion = {'A', 2, 3};
> +const uint64_t kWaitTime = 8 * 1000; // Wait for timeout is 8 seconds
[Vu] Make it static if this constant is used only in this file.
> 
>  NtfLogger::NtfLogger() : readCounter(0) {
>if (SA_AIS_OK != initLog()) {
> -LOG_ER("initialize saflog failed exiting...");
> -exit(EXIT_FAILURE);
> +LOG_WA("Initialize saflog failed");
[Vu] Warning messages are logged inside the function `InitLog` if it fails
to initialize.
So, we probably just calls `InitLog()`, no need to log additional warning
here.

>}
>  }
> 
> @@ -97,6 +97,8 @@ void saLogWriteLogCallback(SaInvocationT invocation,
> SaAisErrorT error) {
> 
>  TRACE_1("Error when logging (%d), queue for relogging", error);
> 
> +if (error == SA_AIS_ERR_BAD_HANDLE) log_client_initialized = false;
[Vu] Probably need to finalize the log handle here.
> +
>  notification = NtfAdmin::theNtfAdmin->getNotificationById(
>  (SaNtfIdentifierT)invocation);
> 
> @@ -151,6 +153,15 @@ void NtfLogger::queueNotifcation(NtfSmartPtr&
> notif) {
> 
>  void NtfLogger::checkQueueAndLog(NtfSmartPtr& newNotif) {
>TRACE_ENTER();
> +
> +  // Initialize client if it hasn't
> +  if (log_client_initialized == false) {
> +if (SA_AIS_OK != initLog()) {
> +  queueNotifcation(newNotif);
> +  return;
> +}
> +  }
> +
>/* Check if there are not logged notifications in queue */
>while (!queuedNotificationList.empty()) {
>  NtfSmartPtr notification = queuedNotificationList.front();
> @@ -174,7 +185,7 @@ void NtfLogger::checkQueueAndLog(NtfSmartPtr&
> newNotif) {
> 
>  SaAisErrorT NtfLogger::logNotification(NtfSmartPtr& notif) {
>/* Write to the log if we're the local node */
> -  SaAisErrorT errorCode = SA_AIS_OK;
> +  SaAisErrorT rc = SA_AIS_OK;
>SaLogHeaderT logHeader;
>char addTextBuf[MAX_ADDITIONAL_TEXT_LENGTH] = {0};
>SaLogBufferT logBuffer;
> @@ -219,10 +230,10 @@ SaAisErrorT
> NtfLogger::logNotification(NtfSmartPtr& notif) {
>if ((notif->sendNotInfo_->notificationType == SA_NTF_TYPE_ALARM) ||
>(notif->sendNotInfo_->notificationType ==
> SA_NTF_TYPE_SECURITY_ALARM)) {
>  TRACE_2("Logging notification to alarm stream");
> -errorCode =
> +rc =
>  saLogWriteLogAsync(alarmStreamHandle, notif->getNotificationId(),
> SA_LOG_RECORD_WRITE_ACK, );
> -switch (errorCode) {
> +switch (rc) {
>case SA_AIS_OK:
>  break;
> 
> @@ -230,107 +241,97 @@ SaAisErrorT
> 

Re: [devel] [PATCH 1/1] dtm: Add --extract-trace option to osaflog command V2 [#2894]

2018-08-03 Thread Hans Nordeback

Hi Minh,

ack, review only. Minor comment below. /Thanks HansN


On 07/20/2018 05:33 AM, Minh Chau wrote:

If a process produces a core dump file that has THREAD_TRACE_BUFFER
enabled, this option reads the core dump file to extract the trace
strings in all threads and writes them to the trace file.
---
  src/base/log_writer.h|   3 +-
  src/dtm/tools/osaflog.cc | 100 +--
  2 files changed, 99 insertions(+), 4 deletions(-)

diff --git a/src/base/log_writer.h b/src/base/log_writer.h
index a7c5000..0a03e92 100644
--- a/src/base/log_writer.h
+++ b/src/base/log_writer.h
@@ -45,6 +45,7 @@ class LogWriter {
void Write(size_t size);
void Write(const char* bytes, size_t size);
void Flush();
+  void SetLogFile(const std::string& log_file) { log_file_ = log_file; }
  
   private:

constexpr static const size_t kBufferSize = 128 * size_t{1024};
@@ -54,7 +55,7 @@ class LogWriter {
  
std::string log_file(size_t backup) const;
  
-  const std::string log_file_;

+  std::string log_file_;
int fd_;
size_t current_file_size_;
size_t current_buffer_size_;
diff --git a/src/dtm/tools/osaflog.cc b/src/dtm/tools/osaflog.cc
index c5946ee..87deecb 100644
--- a/src/dtm/tools/osaflog.cc
+++ b/src/dtm/tools/osaflog.cc
@@ -27,10 +27,15 @@
  #include 
  #include 
  #include 
+#include 
+#include 
  #include 
  #include 
  #include 
  #include 
+#include 
+#include "base/logtrace_buffer.h"
+#include "base/log_writer.h"
  #include "base/string_parse.h"
  #include "base/time.h"
  #include "base/unix_server_socket.h"
@@ -53,7 +58,7 @@ std::string PathName(const std::string& log_stream, int 
suffix);
  uint64_t GetInode(int fd);
  bool PrettyPrint(FILE* stream);
  bool PrettyPrint(const char* line, size_t size);
-
+int ExtractTrace(const std::string& core_file, const std::string& trace_file);
  char buf[65 * 1024];
  
  }  // namespace

@@ -64,6 +69,7 @@ int main(int argc, char** argv) {
{"flush", no_argument, 0, 'f'},
{"print", no_argument, nullptr, 'p'},
{"delete", no_argument, nullptr, 'd'},
+  {"extract-trace", required_argument, 0, 'e'},
{0, 0, 0, 0}};
  
uint64_t max_file_size = 0;

@@ -81,13 +87,16 @@ int main(int argc, char** argv) {
bool delete_set = false;
bool max_file_size_set = false;
bool max_backups_set = false;
+  bool thread_trace = false;

[HansN] use
     std::string input_core;
 std::string output_trace;  (default constructor), instead.

+  std::string input_core = "";
+  std::string output_trace = "";
  
if (argc == 1) {

   PrintUsage(argv[0]);
   exit(EXIT_FAILURE);
}
  
-  while ((option = getopt_long(argc, argv, "m:b:p:f",

+  while ((option = getopt_long(argc, argv, "m:b:p:f:e:",
 long_options, _index)) != -1) {
  switch (option) {
   case 'p':
@@ -115,11 +124,33 @@ int main(int argc, char** argv) {
   exit(EXIT_FAILURE);
 }
   break;
+ case 'e':
+   if (argv[optind] == nullptr || optarg == nullptr) {
+ fprintf(stderr, "Coredump file or output trace file is "
+ "not specified in arguments\n");
+ exit(EXIT_FAILURE);
+   }
+   input_core = std::string(optarg);
+   output_trace = std::string(argv[optind]);
+   struct stat statbuf;
+   if (stat(input_core.c_str(), ) != 0) {
+fprintf(stderr, "Core dump file does not exist\n");
+exit(EXIT_FAILURE);
+   }
+
+   if (stat(output_trace.c_str(), ) == 0) {
+ fprintf(stderr, "Output trace file already exists\n");
+ exit(EXIT_FAILURE);
+   }
+   thread_trace = true;
+   break;
   default: PrintUsage(argv[0]);
   exit(EXIT_FAILURE);
  }
}
  
+  if (thread_trace) exit(ExtractTrace(input_core, output_trace));

+
if (argc > optind && !pretty_print_set && !delete_set) {
  pretty_print_set = true;
  flush_set = true;
@@ -183,7 +214,13 @@ void PrintUsage(const char* program_name) {
"  G can be used for kilo-, mega- and\n"
"  gigabytes.\n"
"--max-backups=NUM Set the maximum number of backup files to\n"
-  "  retain during log rotation to NUM.\n",
+  "  retain during log rotation to NUM.\n"
+  "--extract-trace  \n"
+  "  If a process produces a core dump file has\n"
+  "  THREAD_TRACE_BUFFER enabled, this option\n"
+  "  

Re: [devel] [PATCH 1/1] ntf: Update timeout for initializing log client [#2878]

2018-08-03 Thread Minh Hon Chau
Hi Canh,

I am aware of #2899 which causes the LOG unresponsive, but LOG (or any
service) unresponsiveness can be of any other reasons, not only #2899.

Thanks

Minh


On 03/08/18 17:44, Canh Van Truong wrote:
> Hi aMinh,
>
> Thanks for your comments.
> This patch just help enhance to avoid ntf loop long time in case log service 
> may up slowly and user of log (ntf here)  may be delay.
> The issue why Log still does not response is ticket 2899 and that ticket is 
> reviewing. 
>
> Thanks
> Canh
>
> -Original Message-
> From: Minh Hon Chau  
> Sent: Friday, August 3, 2018 2:32 PM
> To: Canh Van Truong ; vu.m.ngu...@dektech.com.au
> Cc: opensaf-devel@lists.sourceforge.net
> Subject: Re: [PATCH 1/1] ntf: Update timeout for initializing log client 
> [#2878]
>
> Hi Canh,
>
> This issue seems to be partially fixed, we now prioritize to respond to
> AMF callback. But if LOG service is still not responsive, NTF will run
> without logging capability. I think we can address the second issue in
> another ticket.
>
> Ack from me for code review, one comment in line.
>
> Thanks
>
> Minh
>
>
> On 26/06/18 16:53, Canh Van Truong wrote:
>> When NTFD is started, the NtfAdmin class object is defined and log client is
>> initialized in this object. The initialiation of client may be loop forever
>> if TRY_AGAIN error always return. Somehow log service has not been started on
>> time or log service is busy, NTFD is kept in the loop. And the AMF hasn't
>> received csi callback.
>>
>> This patch update the timeout when initializing log client.
>> ---
>>  src/ntf/ntfd/NtfLogger.cc | 165 
>> +++---
>>  src/ntf/ntfd/NtfLogger.h  |   4 +-
>>  2 files changed, 85 insertions(+), 84 deletions(-)
>>
>> diff --git a/src/ntf/ntfd/NtfLogger.cc b/src/ntf/ntfd/NtfLogger.cc
>> index fd17c58a2..9878824c3 100644
>> --- a/src/ntf/ntfd/NtfLogger.cc
>> +++ b/src/ntf/ntfd/NtfLogger.cc
>> @@ -20,17 +20,18 @@
>>   *   INCLUDE FILES
>>   * 
>>   */
>> -#include 
>> +#include "ntf/ntfd/NtfLogger.h"
>>  
>> -#include "base/osaf_utility.h"
>> +#include 
>>  #include 
>>  #include 
>> -#include "ntf/ntfd/NtfAdmin.h"
>> -#include "ntf/ntfd/NtfLogger.h"
>>  #include "ntfs_com.h"
>> -#include "base/logtrace.h"
>>  #include "ntf/common/ntfsv_mem.h"
>> +#include "ntf/ntfd/NtfAdmin.h"
>> +#include "base/logtrace.h"
>>  #include "base/osaf_extended_name.h"
>> +#include "base/osaf_utility.h"
>> +#include "base/osaf_time.h"
>>  
>>  /* 
>>   *   DEFINITIONS
>> @@ -38,7 +39,6 @@
>>   */
>>  #define LOG_OPEN_TIMEOUT SA_TIME_ONE_SECOND
>>  #define LOG_NOTIFICATION_TIMEOUT SA_TIME_ONE_SECOND
>> -#define AIS_TIMEOUT 50
>>  
>>  /* 
>>   *   TYPE DEFINITIONS
>> @@ -65,15 +65,15 @@ void saLogWriteLogCallback(SaInvocationT invocation, 
>> SaAisErrorT error);
>>   */
>>  
>>  static SaLogCallbacksT logCallbacks = {NULL, NULL, saLogWriteLogCallback};
>> -
>>  static SaLogHandleT logHandle;
>>  static SaLogStreamHandleT alarmStreamHandle;
>> +static bool log_client_initialized = false;
>>  const SaVersionT kLogVersion = {'A', 2, 3};
>> +const uint64_t kWaitTime = 8 * 1000; // Wait for timeout is 8 seconds
>>  
>>  NtfLogger::NtfLogger() : readCounter(0) {
>>if (SA_AIS_OK != initLog()) {
>> -LOG_ER("initialize saflog failed exiting...");
>> -exit(EXIT_FAILURE);
>> +LOG_WA("Initialize saflog failed");
>>}
>>  }
> [Minh]: I think the exit() was there if initLog() fails, so that NID/AMF
> can restart the NTF service. We can remove it unless NTF has completed
> recycling LOG handle from BAD_HANDLE/TIMEOUT/...
>>  
>> @@ -97,6 +97,8 @@ void saLogWriteLogCallback(SaInvocationT invocation, 
>> SaAisErrorT error) {
>>  
>>  TRACE_1("Error when logging (%d), queue for relogging", error);
>>  
>> +if (error == SA_AIS_ERR_BAD_HANDLE) log_client_initialized = false;
>> +
>>  notification = NtfAdmin::theNtfAdmin->getNotificationById(
>>  (SaNtfIdentifierT)invocation);
>>  
>> @@ -151,6 +153,15 @@ void NtfLogger::queueNotifcation(NtfSmartPtr& notif) {
>>  
>>  void NtfLogger::checkQueueAndLog(NtfSmartPtr& newNotif) {
>>TRACE_ENTER();
>> +
>> +  // Initialize client if it hasn't
>> +  if (log_client_initialized == false) {
>> +if (SA_AIS_OK != initLog()) {
>> +  queueNotifcation(newNotif);
>> +  return;
>> +}
>> +  }
>> +
>>/* Check if there are not logged notifications in queue */
>>while (!queuedNotificationList.empty()) {
>>  NtfSmartPtr notification = queuedNotificationList.front();
>> @@ -174,7 +185,7 @@ void NtfLogger::checkQueueAndLog(NtfSmartPtr& newNotif) {
>>  
>>  SaAisErrorT NtfLogger::logNotification(NtfSmartPtr& notif) {
>>/* Write to the log if we're the local node */
>> -  SaAisErrorT errorCode = SA_AIS_OK;
>> +  SaAisErrorT rc = 

Re: [devel] [PATCH 1/1] ntf: Update timeout for initializing log client [#2878]

2018-08-03 Thread Canh Van Truong
Hi aMinh,

Thanks for your comments.
This patch just help enhance to avoid ntf loop long time in case log service 
may up slowly and user of log (ntf here)  may be delay.
The issue why Log still does not response is ticket 2899 and that ticket is 
reviewing. 

Thanks
Canh

-Original Message-
From: Minh Hon Chau  
Sent: Friday, August 3, 2018 2:32 PM
To: Canh Van Truong ; vu.m.ngu...@dektech.com.au
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 1/1] ntf: Update timeout for initializing log client [#2878]

Hi Canh,

This issue seems to be partially fixed, we now prioritize to respond to
AMF callback. But if LOG service is still not responsive, NTF will run
without logging capability. I think we can address the second issue in
another ticket.

Ack from me for code review, one comment in line.

Thanks

Minh


On 26/06/18 16:53, Canh Van Truong wrote:
> When NTFD is started, the NtfAdmin class object is defined and log client is
> initialized in this object. The initialiation of client may be loop forever
> if TRY_AGAIN error always return. Somehow log service has not been started on
> time or log service is busy, NTFD is kept in the loop. And the AMF hasn't
> received csi callback.
>
> This patch update the timeout when initializing log client.
> ---
>  src/ntf/ntfd/NtfLogger.cc | 165 
> +++---
>  src/ntf/ntfd/NtfLogger.h  |   4 +-
>  2 files changed, 85 insertions(+), 84 deletions(-)
>
> diff --git a/src/ntf/ntfd/NtfLogger.cc b/src/ntf/ntfd/NtfLogger.cc
> index fd17c58a2..9878824c3 100644
> --- a/src/ntf/ntfd/NtfLogger.cc
> +++ b/src/ntf/ntfd/NtfLogger.cc
> @@ -20,17 +20,18 @@
>   *   INCLUDE FILES
>   * 
>   */
> -#include 
> +#include "ntf/ntfd/NtfLogger.h"
>  
> -#include "base/osaf_utility.h"
> +#include 
>  #include 
>  #include 
> -#include "ntf/ntfd/NtfAdmin.h"
> -#include "ntf/ntfd/NtfLogger.h"
>  #include "ntfs_com.h"
> -#include "base/logtrace.h"
>  #include "ntf/common/ntfsv_mem.h"
> +#include "ntf/ntfd/NtfAdmin.h"
> +#include "base/logtrace.h"
>  #include "base/osaf_extended_name.h"
> +#include "base/osaf_utility.h"
> +#include "base/osaf_time.h"
>  
>  /* 
>   *   DEFINITIONS
> @@ -38,7 +39,6 @@
>   */
>  #define LOG_OPEN_TIMEOUT SA_TIME_ONE_SECOND
>  #define LOG_NOTIFICATION_TIMEOUT SA_TIME_ONE_SECOND
> -#define AIS_TIMEOUT 50
>  
>  /* 
>   *   TYPE DEFINITIONS
> @@ -65,15 +65,15 @@ void saLogWriteLogCallback(SaInvocationT invocation, 
> SaAisErrorT error);
>   */
>  
>  static SaLogCallbacksT logCallbacks = {NULL, NULL, saLogWriteLogCallback};
> -
>  static SaLogHandleT logHandle;
>  static SaLogStreamHandleT alarmStreamHandle;
> +static bool log_client_initialized = false;
>  const SaVersionT kLogVersion = {'A', 2, 3};
> +const uint64_t kWaitTime = 8 * 1000; // Wait for timeout is 8 seconds
>  
>  NtfLogger::NtfLogger() : readCounter(0) {
>if (SA_AIS_OK != initLog()) {
> -LOG_ER("initialize saflog failed exiting...");
> -exit(EXIT_FAILURE);
> +LOG_WA("Initialize saflog failed");
>}
>  }
[Minh]: I think the exit() was there if initLog() fails, so that NID/AMF
can restart the NTF service. We can remove it unless NTF has completed
recycling LOG handle from BAD_HANDLE/TIMEOUT/...
>  
> @@ -97,6 +97,8 @@ void saLogWriteLogCallback(SaInvocationT invocation, 
> SaAisErrorT error) {
>  
>  TRACE_1("Error when logging (%d), queue for relogging", error);
>  
> +if (error == SA_AIS_ERR_BAD_HANDLE) log_client_initialized = false;
> +
>  notification = NtfAdmin::theNtfAdmin->getNotificationById(
>  (SaNtfIdentifierT)invocation);
>  
> @@ -151,6 +153,15 @@ void NtfLogger::queueNotifcation(NtfSmartPtr& notif) {
>  
>  void NtfLogger::checkQueueAndLog(NtfSmartPtr& newNotif) {
>TRACE_ENTER();
> +
> +  // Initialize client if it hasn't
> +  if (log_client_initialized == false) {
> +if (SA_AIS_OK != initLog()) {
> +  queueNotifcation(newNotif);
> +  return;
> +}
> +  }
> +
>/* Check if there are not logged notifications in queue */
>while (!queuedNotificationList.empty()) {
>  NtfSmartPtr notification = queuedNotificationList.front();
> @@ -174,7 +185,7 @@ void NtfLogger::checkQueueAndLog(NtfSmartPtr& newNotif) {
>  
>  SaAisErrorT NtfLogger::logNotification(NtfSmartPtr& notif) {
>/* Write to the log if we're the local node */
> -  SaAisErrorT errorCode = SA_AIS_OK;
> +  SaAisErrorT rc = SA_AIS_OK;
>SaLogHeaderT logHeader;
>char addTextBuf[MAX_ADDITIONAL_TEXT_LENGTH] = {0};
>SaLogBufferT logBuffer;
> @@ -219,10 +230,10 @@ SaAisErrorT NtfLogger::logNotification(NtfSmartPtr& 
> notif) {
>if ((notif->sendNotInfo_->notificationType == SA_NTF_TYPE_ALARM) ||
>(notif->sendNotInfo_->notificationType == SA_NTF_TYPE_SECURITY_ALARM)) 
> {
>  

Re: [devel] [PATCH 1/1] ntf: Update timeout for initializing log client [#2878]

2018-08-03 Thread Minh Hon Chau
Hi Canh,

This issue seems to be partially fixed, we now prioritize to respond to
AMF callback. But if LOG service is still not responsive, NTF will run
without logging capability. I think we can address the second issue in
another ticket.

Ack from me for code review, one comment in line.

Thanks

Minh


On 26/06/18 16:53, Canh Van Truong wrote:
> When NTFD is started, the NtfAdmin class object is defined and log client is
> initialized in this object. The initialiation of client may be loop forever
> if TRY_AGAIN error always return. Somehow log service has not been started on
> time or log service is busy, NTFD is kept in the loop. And the AMF hasn't
> received csi callback.
>
> This patch update the timeout when initializing log client.
> ---
>  src/ntf/ntfd/NtfLogger.cc | 165 
> +++---
>  src/ntf/ntfd/NtfLogger.h  |   4 +-
>  2 files changed, 85 insertions(+), 84 deletions(-)
>
> diff --git a/src/ntf/ntfd/NtfLogger.cc b/src/ntf/ntfd/NtfLogger.cc
> index fd17c58a2..9878824c3 100644
> --- a/src/ntf/ntfd/NtfLogger.cc
> +++ b/src/ntf/ntfd/NtfLogger.cc
> @@ -20,17 +20,18 @@
>   *   INCLUDE FILES
>   * 
>   */
> -#include 
> +#include "ntf/ntfd/NtfLogger.h"
>  
> -#include "base/osaf_utility.h"
> +#include 
>  #include 
>  #include 
> -#include "ntf/ntfd/NtfAdmin.h"
> -#include "ntf/ntfd/NtfLogger.h"
>  #include "ntfs_com.h"
> -#include "base/logtrace.h"
>  #include "ntf/common/ntfsv_mem.h"
> +#include "ntf/ntfd/NtfAdmin.h"
> +#include "base/logtrace.h"
>  #include "base/osaf_extended_name.h"
> +#include "base/osaf_utility.h"
> +#include "base/osaf_time.h"
>  
>  /* 
>   *   DEFINITIONS
> @@ -38,7 +39,6 @@
>   */
>  #define LOG_OPEN_TIMEOUT SA_TIME_ONE_SECOND
>  #define LOG_NOTIFICATION_TIMEOUT SA_TIME_ONE_SECOND
> -#define AIS_TIMEOUT 50
>  
>  /* 
>   *   TYPE DEFINITIONS
> @@ -65,15 +65,15 @@ void saLogWriteLogCallback(SaInvocationT invocation, 
> SaAisErrorT error);
>   */
>  
>  static SaLogCallbacksT logCallbacks = {NULL, NULL, saLogWriteLogCallback};
> -
>  static SaLogHandleT logHandle;
>  static SaLogStreamHandleT alarmStreamHandle;
> +static bool log_client_initialized = false;
>  const SaVersionT kLogVersion = {'A', 2, 3};
> +const uint64_t kWaitTime = 8 * 1000; // Wait for timeout is 8 seconds
>  
>  NtfLogger::NtfLogger() : readCounter(0) {
>if (SA_AIS_OK != initLog()) {
> -LOG_ER("initialize saflog failed exiting...");
> -exit(EXIT_FAILURE);
> +LOG_WA("Initialize saflog failed");
>}
>  }
[Minh]: I think the exit() was there if initLog() fails, so that NID/AMF
can restart the NTF service. We can remove it unless NTF has completed
recycling LOG handle from BAD_HANDLE/TIMEOUT/...
>  
> @@ -97,6 +97,8 @@ void saLogWriteLogCallback(SaInvocationT invocation, 
> SaAisErrorT error) {
>  
>  TRACE_1("Error when logging (%d), queue for relogging", error);
>  
> +if (error == SA_AIS_ERR_BAD_HANDLE) log_client_initialized = false;
> +
>  notification = NtfAdmin::theNtfAdmin->getNotificationById(
>  (SaNtfIdentifierT)invocation);
>  
> @@ -151,6 +153,15 @@ void NtfLogger::queueNotifcation(NtfSmartPtr& notif) {
>  
>  void NtfLogger::checkQueueAndLog(NtfSmartPtr& newNotif) {
>TRACE_ENTER();
> +
> +  // Initialize client if it hasn't
> +  if (log_client_initialized == false) {
> +if (SA_AIS_OK != initLog()) {
> +  queueNotifcation(newNotif);
> +  return;
> +}
> +  }
> +
>/* Check if there are not logged notifications in queue */
>while (!queuedNotificationList.empty()) {
>  NtfSmartPtr notification = queuedNotificationList.front();
> @@ -174,7 +185,7 @@ void NtfLogger::checkQueueAndLog(NtfSmartPtr& newNotif) {
>  
>  SaAisErrorT NtfLogger::logNotification(NtfSmartPtr& notif) {
>/* Write to the log if we're the local node */
> -  SaAisErrorT errorCode = SA_AIS_OK;
> +  SaAisErrorT rc = SA_AIS_OK;
>SaLogHeaderT logHeader;
>char addTextBuf[MAX_ADDITIONAL_TEXT_LENGTH] = {0};
>SaLogBufferT logBuffer;
> @@ -219,10 +230,10 @@ SaAisErrorT NtfLogger::logNotification(NtfSmartPtr& 
> notif) {
>if ((notif->sendNotInfo_->notificationType == SA_NTF_TYPE_ALARM) ||
>(notif->sendNotInfo_->notificationType == SA_NTF_TYPE_SECURITY_ALARM)) 
> {
>  TRACE_2("Logging notification to alarm stream");
> -errorCode =
> +rc =
>  saLogWriteLogAsync(alarmStreamHandle, notif->getNotificationId(),
> SA_LOG_RECORD_WRITE_ACK, );
> -switch (errorCode) {
> +switch (rc) {
>case SA_AIS_OK:
>  break;
>  
> @@ -230,107 +241,97 @@ SaAisErrorT NtfLogger::logNotification(NtfSmartPtr& 
> notif) {
>case SA_AIS_ERR_TRY_AGAIN:
>case SA_AIS_ERR_TIMEOUT:
>  TRACE("Failed to log notification (ret: %d). Try 

Re: [devel] [PATCH 0/1] Review Request for log: fix logtest 6 42 fail [#2903]

2018-08-03 Thread Canh Van Truong
Hi Lennart,

 

Please see my comment

 

Thanks

Canh

 

From: Lennart Lund  
Sent: Thursday, August 2, 2018 7:32 PM
To: Canh Van Truong ; Vu Minh Nguyen

Cc: opensaf-devel@lists.sourceforge.net; Lennart Lund

Subject: RE: [PATCH 0/1] Review Request for log: fix logtest 6 42 fail
[#2903]

 

Hi Canh

 

Thanks for the information. See my comments below

 

Regards

Lennart

 

From: Canh Van Truong mailto:canh.v.tru...@dektech.com.au> > 
Sent: den 2 augusti 2018 07:12
To: Lennart Lund mailto:lennart.l...@ericsson.com> >; Vu Minh Nguyen
mailto:vu.m.ngu...@dektech.com.au> >
Cc: opensaf-devel@lists.sourceforge.net
 
Subject: RE: [PATCH 0/1] Review Request for log: fix logtest 6 42 fail
[#2903]

 

Hi Lennart

 

Please see my reply inline

 

Thanks

Canh

 

-Original Message-
From: Lennart Lund mailto:lennart.l...@ericsson.com> > 
Sent: Wednesday, August 1, 2018 9:20 PM
To: Canh Van Truong mailto:canh.v.tru...@dektech.com.au> >; Vu Minh Nguyen
mailto:vu.m.ngu...@dektech.com.au> >
Cc: opensaf-devel@lists.sourceforge.net
 ; Canh Van Truong
mailto:canh.v.tru...@dektech.com.au> >;
Lennart Lund mailto:lennart.l...@ericsson.com> >
Subject: RE: [PATCH 0/1] Review Request for log: fix logtest 6 42 fail
[#2903]

 

Hi Canh,

 

I am not sure this is a correct fix. Please answer my comments [Lennart]:

 

Test case logtest 2 49 creates some cfg app to test the limitation, then

deleting these stream at the end. But the deleting fails due to timeout for

waiting the implementer. After that test case logtest 6 42 need to create

some cfg app and take the same stream name. That causes the creattion fail

with SA_AIS_ERR_EXIST error.

[Lennart] This part will make it possible to run the second test case (6 42)
if the first test case (2 49) fails to delete the log streams it creates.
Before the fix the streams was given the same name in both test cases.
However if you should try to run test (2 49) again it will fail for the same
reason as test case (6 42) failed so the problem is actually not solved.

[Canh] I think the case you mention here is that you MANUALLY try to run
test case (2 49) 2 times separately. To avoid it, you have to delete existed
object manually before running second test case (2 49). The fix just solves
when you run the whole test cases "logtest", each test case executed
sequentially and we cannot involve to delete existed object.

[Lennart1] Testing of the log service may be done on several nodes in the
same test session. If for example logtest is run on node1 and this problem
occurs the will continue. However, if logtest is done again on another node2
test 2 49 will fail as above since in an automated test nobody will MANUALLY
remove anything.

 

[Canh1] Yes, you are right. But after changing timeout in log service from
8s to 5s, the timeout issue that imm wait for implementer is solved. If the
deleting cfg stream still fail and cause second test 2 49 still fail, the
problem may not be in log service and logtest. The fact  is that user cannot
delete object successfully in imm.

 

The purpose of both test cases is that test the limitation of number of app
stream and it doesn't verify if deleting stream fail or not at the end of
test cases.

 

In deep, lib function rename() return failure causes the retry is happened.
>From the second retry, it cannot find the old file due to file name is
changed. Actually the file name is changed (check file name in directory
"saflog/..."). This rarely happen (first time I see it). Maybe no way to fix
this. How do you think about it?


[Lennart1] I'm a little bit confused here, something with this seems wrong.
Test 2 49 and 6 46 is supposed to test the limitation of the number of
APPLICATION streams (app streams) that shall be possible to create in a
cluster and was introduced with ticket  "#1446 log: trouble when the number
of existing app streams reaches limitation"
The header information for test case 2 49 says (and something similar for 6
42):

"/*

* Add test case for ticket #1446

* Verify that logsv failed to create runtime app stream  if number of app

* streams has reached the limitation

*

*/"
However, test 2 49 and 6 42 creates a number of CONFIGURATION streams and
tests that no more than the number of streams set in IMM attribute
logMaxApplicationStreams can be created. This is incorrect, there is no
limitation for CONFIGURATION streams. The limitation set in
logMaxApplicationStreams is only for APPLICATION streams!
When I look at the test cases there seems to be some confusion about the
definitions of application stream and configuration stream and there
properties.

  An APPLICATION stream is a stream that is always (and can only be) created
in runtime using the log service API saLogStreamOpen_2(). The stream is
created if in-parameter *logFileCreateAttributes is not set to NULL, shall
be set to NULL if an existing stream shall be opened. An app stream 

Re: [devel] [PATCH 1/1] smf: fix memory leak reported by clang [#2904]

2018-08-03 Thread Lennart Lund
Hi Vu

Ack

Thanks
Lennart

> -Original Message-
> From: Vu Minh Nguyen 
> Sent: den 3 augusti 2018 04:37
> To: Lennart Lund 
> Cc: opensaf-devel@lists.sourceforge.net; Vu Minh Nguyen
> 
> Subject: [PATCH 1/1] smf: fix memory leak reported by clang [#2904]
> 
> When SmfImmOperation::Execute() gets failed in
> SmfImmUtils::doImmOperations(),
> the allocated memory `rollbackData` is not deallocated.
> ---
>  src/smf/smfd/SmfUtils.cc | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/src/smf/smfd/SmfUtils.cc b/src/smf/smfd/SmfUtils.cc
> index 77d424a65..915c086a5 100644
> --- a/src/smf/smfd/SmfUtils.cc
> +++ b/src/smf/smfd/SmfUtils.cc
> @@ -704,6 +704,8 @@ SaAisErrorT SmfImmUtils::doImmOperations(
>  if (result != SA_AIS_OK) {
>LOG_WA("%s: imm_operation->Execute Fail, %s", __FUNCTION__,
>   saf_error(result));
> +  delete rollbackData;
> +  rollbackData = nullptr;
>break;
>  }
> 
> --
> 2.18.0


--
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


Re: [devel] [PATCH 1/2] mdstest: identify svcs using svc_id and mds_dest when storing event info [#2798]

2018-08-03 Thread Minh Hon Chau
Hi Hoa,

One comment inline.

Thanks

Minh


On 20/06/18 13:38, Hoa Le wrote:
> Currently, when updating the last event info, mdstest identify services
> using their svc_id. This will cause confusion when several services was
> installed with the same svc_id (on different mds_dest-s). If a service
> subscribes to this svc_id, the service will retrieve several event info
> with the same svc_id. When storing these event info to svcevt array, the
> info are overwritten one by one and only the last info will be stored.
>
> This patch helps avoid the above situation by identifying these
> services using both their svc_id and mds_dest. This helps the event
> info, from different service, be separatedly stored to svcevt array.
> subscr_count value will also be updated in accordance with these
> event info.
> ---
>  src/mds/apitest/mdstipc_api.c  |  13 ++--
>  src/mds/apitest/mdstipc_conf.c | 162 
> +
>  2 files changed, 152 insertions(+), 23 deletions(-)
>
> diff --git a/src/mds/apitest/mdstipc_api.c b/src/mds/apitest/mdstipc_api.c
> index 22a4386..090af99 100644
> --- a/src/mds/apitest/mdstipc_api.c
> +++ b/src/mds/apitest/mdstipc_api.c
> @@ -1090,7 +1090,7 @@ static int tet_verify_version(MDS_HDL mds_hdl, 
> NCSMDS_SVC_ID your_scv_id,
> MDS_SVC_PVT_SUB_PART_VER svc_pvt_ver,
> NCSMDS_CHG change)
>  {
> - int i, j, k, ret_val = 0;
> + int i, j, k;
>   if (is_service_on_adest(mds_hdl, your_scv_id) == NCSCC_RC_SUCCESS) {
>   for (i = 0; i < gl_tet_adest.svc_count; i++) {
>   if (gl_tet_adest.svc[i].svc_id == your_scv_id) {
> @@ -1107,9 +1107,8 @@ static int tet_verify_version(MDS_HDL mds_hdl, 
> NCSMDS_SVC_ID your_scv_id,
>.svcevt[j]
>.rem_svc_pvt_ver ==
>svc_pvt_ver))
> - ret_val = 1;
> - else
> - ret_val = 0;
> + return 1;
> +
>   }
>   }
>   }
> @@ -1137,16 +1136,14 @@ static int tet_verify_version(MDS_HDL mds_hdl, 
> NCSMDS_SVC_ID your_scv_id,
>.svcevt[k]
>
> .rem_svc_pvt_ver ==
>svc_pvt_ver))
> - ret_val = 1;
> - else
> - ret_val = 0;
> + return 1;
>   }
>   }
>   }
>   }
>   }
>   }
> - return ret_val;
> + return 0;
>  }
>  void tet_svc_subscr_VDEST_1()
>  {
> diff --git a/src/mds/apitest/mdstipc_conf.c b/src/mds/apitest/mdstipc_conf.c
> index bf4c1de..61bf27f 100644
> --- a/src/mds/apitest/mdstipc_conf.c
> +++ b/src/mds/apitest/mdstipc_conf.c
> @@ -557,7 +557,7 @@ uint32_t mds_service_subscribe(MDS_HDL mds_hdl, 
> MDS_SVC_ID svc_id,
>  NCSMDS_SCOPE_TYPE scope, uint8_t num_svcs,
>  MDS_SVC_ID *svc_ids)
>  {
> - int i, j, k, l, FOUND;
> + int i, j, l, FOUND;
>   uint32_t YES_ADEST;
>   NCSMDS_INFO svc_to_mds_info;
>   /*Find whether this Service is on Adest or Vdest*/
> @@ -594,6 +594,7 @@ uint32_t mds_service_subscribe(MDS_HDL mds_hdl, 
> MDS_SVC_ID svc_id,
>   .svc[j]
>   .subscr.svc_ids = svc_ids;
>   
> /*gl_tet_vdest[i].svc[j].subscr.evt_map=*/
> + /* Fix for ticket #2798
>   gl_tet_vdest[i]
>   .svc[j]
>   .subscr_count += num_svcs;
> @@ -611,6 +612,7 @@ uint32_t mds_service_subscribe(MDS_HDL mds_hdl, 
> MDS_SVC_ID svc_id,
>   .svcevt[k]
>   .ur_svc_id = svc_id;
>   }
> + */
>   FOUND = 1;
>   break;
>   }
> @@ -642,6 +644,7 @@ uint32_t