Re: [devel] [PATCH 0/1] Review Request for smf: Validation error for rollback CCB and a related core dump [#2858]

2018-06-01 Thread Lennart Lund
Hi Nguyen,

Yes, I will use this information and check this. Maybe some sort of internal 
length check is needed in order to prevent this kind of assert.

Thanks
Lennart

From: Nguyen Luu 
Sent: den 1 juni 2018 09:55
To: Lennart Lund 
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 0/1] Review Request for smf: Validation error for rollback 
CCB and a related core dump [#2858]

Hi Lennart,

I've run test_ccbhdl in OpenSAF UML cluster and the same core dump was still 
generated as described in my previous mail.
My UML cluster was built and installed with the latest OpenSAF develop commit 
(5d8d104 rded: run controller promotion code in new thread [#2857]), and with 
your patch applied on top.

I debugged a little by removing the creation of the long-value 
SA_IMM_ATTR_SANAMET attribute from the test (below code, at two places in the 
test), and the test passed successfully with no core dump.

  // Add a long name and a third short name
  char long_name[300];
  for (size_t i = 0; i < 299; i++) {
long_name[i] = 'a';
  }
  long_name[299] = '\0';
  osaf_extended_name_lend(long_name, _name);
  attribute.AddValue(modelmodify::SaNametToString(_name));

Testing further, I tried running a test campaign which included the creation of 
a long-dn object, and the campaign also failed at such creation (I did enable 
longDnsAllowed beforehand). Then, I tried testing the same campaign after 
reverting your 2nd increment for ticket #1398 and the campaign completed 
successfully with the long-dn object created. So I've doubted that the 2nd 
increment of #1398 might have introduced the issue here.

Can you check/verify the patch again in consideration of my testing and 
observation?

Thanks,
Nguyen

On 5/31/2018 7:33 PM, Lennart Lund wrote:
Hi Nguyen,

I have tried to reproduce the coredump but I have not succeeded. Did you just 
run test_ccbhdl without any special settings?
I am testing in an OpenSAF UML cluster that is built and started using the 
tools in …/tools/cluster_sim_uml/
I have also tested when the test class is not in the IMM model. The test of 
course fail but no coredump. The fail happen in a controlled and predictable 
way.
What kind of system are you using?

Thanks
Lennart

From: Nguyen Luu 

Sent: den 31 maj 2018 11:10
To: Lennart Lund 
Cc: 
opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 0/1] Review Request for smf: Validation error for rollback 
CCB and a related core dump [#2858]

Hi Lennart,

I've reviewed and tested your patch.
- For the code review, please check comments in the attached diff file.
- For the testing, a core dump occurred when executing test_ccbhdl (always 
reproducible). Test printouts, core dump backtrace, and syslog as shown below. 
Looks like some issue with setting an extended-name attribute of type 
SA_IMM_ATTR_SANAMET. Has this test passed in your last run?

-Terminal printouts-
root@SC-1:~# test_ccbhdl
ccbhdl_test
IMM class used for test: ImmTestValuesConfig
Creating: Test1=1,safApp=safSmfService
Aborted (core dumped)

-System logs-
2018-05-31 16:02:35.873 SC-1 osafimmpbed: IN Create of class 
ImmTestValuesConfig committing with ccbId:10004
2018-05-31 16:02:35.889 SC-1 osafimmnd[207]: NO Create of class 
ImmTestValuesConfig is PERSISTENT.
2018-05-31 16:02:35.908 SC-1 osafimmpbed: NO PBE allowing modification to 
object opensafImm=opensafImm,safApp=safImmService
2018-05-31 16:02:35.922 SC-1 osafimmnd[207]: NO Ccb 2 COMMITTED 
(immcfg_SC-1_487)
2018-05-31 16:02:35.934 SC-1 test_ccbhdl: src/base/osaf_extended_name.c:144: 
osaf_extended_name_length: Assertion 'osaf_extended_names_enabled && length >= 
SA_MAX_UNEXTENDED_NAME_LENGTH' failed.

-Core dump backtrace-
(gdb) bt
#0  0x7faf97b83428 in __GI_raise (sig=sig@entry=6) at 
../sysdeps/unix/sysv/linux/raise.c:54
#1  0x7faf97b8502a in __GI_abort () at abort.c:89
#2  0x7faf987034ab in __osafassert_fail (__file=__file@entry=0x7faf9873275d 
"src/base/osaf_extended_name.c",
__line=__line@entry=144, __func=__func@entry=0x7faf987327f0 
<__FUNCTION__.3368> "osaf_extended_name_length",
__assertion=__assertion@entry=0x7faf987327a8 "osaf_extended_names_enabled 
&& length >= SA_MAX_UNEXTENDED_NAME_LENGTH")
at src/base/sysf_def.c:286
#3  0x7faf986fef89 in osaf_extended_name_length (name=0x564decae3796) at 
src/base/osaf_extended_name.c:143
#4  0x7faf9895ef1d in imma_copyAttrValue (p=p@entry=0x564decae2d00, 
attrValueType=SA_IMM_ATTR_SANAMET,
attrValue=0x564decae3796) at src/imm/agent/imma_init.cc:434
#5  0x7faf9896b140 in ccb_object_create_common 
(ccbHandle=1527757355930828673, className=,
parentName=0x7ffefbb72e20, objectName=, 
objectName@entry=0x0, attrValues=attrValues@entry=0x7ffefbb72cf0)
at src/imm/agent/imma_om_api.cc:2079
#6  0x7faf9896d8cf in saImmOmCcbObjectCreate_2 (ccbHandle=, 
className=,
parentName=, 

Re: [devel] [PATCH 0/1] Review Request for smf: Validation error for rollback CCB and a related core dump [#2858]

2018-06-01 Thread Lennart Lund
Hi Nguyen,

I will send out a new review request as you suggest. I will probably not be 
able to do this today

I also would like to understand why you get a coredump. I cannot reproduce that 
problem in my environment also it does not happen in Osaftest or CoreMW test. 
The imm_modify_config has been on develop branch for a while and this last 
#2858 fix does not affect that except that I have added protection of adding 
duplicate create descriptors to the ccb descriptor.
There were some issues with make files and the opensaf.spec.in (for creating 
rpms) that are fixed but I don’t think that has anything to do with this.

Can you please help look into this. The only information I have got is the 
backtrace in this mail-thread. I will continue looking for possible problems 
based on the backtrace.

Thanks
Lennart

From: Nguyen Luu 
Sent: den 1 juni 2018 05:39
To: Lennart Lund 
Cc: opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 0/1] Review Request for smf: Validation error for rollback 
CCB and a related core dump [#2858]

Hi Lennart,

Thanks for your answers to my comments. I agree with most of the major points.
So Ack from me for the diff file. I can do a double-check review if you will 
send out a new patch (with comments removed).

Thanks,
Nguyen

On 5/31/2018 10:48 PM, Lennart Lund wrote:
Hi Nguyen,

Attached is a diff with your comments still in there and my answers tagged 
[Lennart].
I have also kept your uncommented fixes.
If you ack this I will use the patch with review comments removed.

Thanks
Lennart

From: Nguyen Luu 

Sent: den 31 maj 2018 11:10
To: Lennart Lund 
Cc: 
opensaf-devel@lists.sourceforge.net
Subject: Re: [PATCH 0/1] Review Request for smf: Validation error for rollback 
CCB and a related core dump [#2858]

Hi Lennart,

I've reviewed and tested your patch.
- For the code review, please check comments in the attached diff file.
- For the testing, a core dump occurred when executing test_ccbhdl (always 
reproducible). Test printouts, core dump backtrace, and syslog as shown below. 
Looks like some issue with setting an extended-name attribute of type 
SA_IMM_ATTR_SANAMET. Has this test passed in your last run?

-Terminal printouts-
root@SC-1:~# test_ccbhdl
ccbhdl_test
IMM class used for test: ImmTestValuesConfig
Creating: Test1=1,safApp=safSmfService
Aborted (core dumped)

-System logs-
2018-05-31 16:02:35.873 SC-1 osafimmpbed: IN Create of class 
ImmTestValuesConfig committing with ccbId:10004
2018-05-31 16:02:35.889 SC-1 osafimmnd[207]: NO Create of class 
ImmTestValuesConfig is PERSISTENT.
2018-05-31 16:02:35.908 SC-1 osafimmpbed: NO PBE allowing modification to 
object opensafImm=opensafImm,safApp=safImmService
2018-05-31 16:02:35.922 SC-1 osafimmnd[207]: NO Ccb 2 COMMITTED 
(immcfg_SC-1_487)
2018-05-31 16:02:35.934 SC-1 test_ccbhdl: src/base/osaf_extended_name.c:144: 
osaf_extended_name_length: Assertion 'osaf_extended_names_enabled && length >= 
SA_MAX_UNEXTENDED_NAME_LENGTH' failed.

-Core dump backtrace-
(gdb) bt
#0  0x7faf97b83428 in __GI_raise (sig=sig@entry=6) at 
../sysdeps/unix/sysv/linux/raise.c:54
#1  0x7faf97b8502a in __GI_abort () at abort.c:89
#2  0x7faf987034ab in __osafassert_fail (__file=__file@entry=0x7faf9873275d 
"src/base/osaf_extended_name.c",
__line=__line@entry=144, __func=__func@entry=0x7faf987327f0 
<__FUNCTION__.3368> "osaf_extended_name_length",
__assertion=__assertion@entry=0x7faf987327a8 "osaf_extended_names_enabled 
&& length >= SA_MAX_UNEXTENDED_NAME_LENGTH")
at src/base/sysf_def.c:286
#3  0x7faf986fef89 in osaf_extended_name_length (name=0x564decae3796) at 
src/base/osaf_extended_name.c:143
#4  0x7faf9895ef1d in imma_copyAttrValue (p=p@entry=0x564decae2d00, 
attrValueType=SA_IMM_ATTR_SANAMET,
attrValue=0x564decae3796) at src/imm/agent/imma_init.cc:434
#5  0x7faf9896b140 in ccb_object_create_common 
(ccbHandle=1527757355930828673, className=,
parentName=0x7ffefbb72e20, objectName=, 
objectName@entry=0x0, attrValues=attrValues@entry=0x7ffefbb72cf0)
at src/imm/agent/imma_om_api.cc:2079
#6  0x7faf9896d8cf in saImmOmCcbObjectCreate_2 (ccbHandle=, 
className=,
parentName=, attrValues=attrValues@entry=0x7ffefbb72cf0) at 
src/imm/agent/imma_om_api.cc:1660
#7  0x564dea9df953 in immom::ImmOmCcbObjectCreate::AddObjectCreateToCcb 
(this=this@entry=0x7ffefbb72ff0)
at src/smf/smfd/imm_om_ccapi/om_ccb_object_create.cc:61
#8  0x564dea9d8d54 in modelmodify::AddCreateToCcb 
(ccb_handle=@0x7ffefbb730c8: 1527757355930828673, create_descriptor=...)
at src/smf/smfd/imm_modify_config/add_operation_to_ccb.cc:103
#9  0x564dea9db26c in modelmodify::ModelModification::AddCreate 
(this=this@entry=0x7ffefbb73870, create_descriptor=...)
at src/smf/smfd/imm_modify_config/immccb.cc:482
#10 0x564dea9dca8b in 

[devel] [PATCH 1/1] log: restore ref counter for deleted stream [#2870]

2018-06-01 Thread Vu Minh Nguyen
In the methods LogAgent::saLogStreamClose() and LogAgent::saLogWriteLogAsync(),
the client is deleted if failed to recover; however, the pointer to the log
stream of this client has not been reseted. Therefore, when the destrustor of
ScopeData runs, the reference counter could be restored on deleted log stream.

This patch resets the pointer to nullptr in such case.
---
 src/log/agent/lga_agent.cc | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/log/agent/lga_agent.cc b/src/log/agent/lga_agent.cc
index f33b5dc..93ab150 100644
--- a/src/log/agent/lga_agent.cc
+++ b/src/log/agent/lga_agent.cc
@@ -1267,6 +1267,8 @@ SaAisErrorT 
LogAgent::saLogWriteLogAsync(SaLogStreamHandleT logStreamHandle,
 if (client->is_recovery_failed() == true) {
   ScopeLock critical_section(get_delete_obj_sync_mutex_);
   RemoveLogClient();
+  // To avoid ScopeData restore ref counter for already deleted stream
+  stream = nullptr;
   ais_rc = SA_AIS_ERR_BAD_HANDLE;
   return ais_rc;
 }
@@ -1388,6 +1390,8 @@ SaAisErrorT LogAgent::saLogStreamClose(SaLogStreamHandleT 
logStreamHandle) {
 if (client->is_recovery_failed() == true) {
   ScopeLock critical_section(get_delete_obj_sync_mutex_);
   RemoveLogClient();
+  // To avoid ScopeData restore ref counter for already deleted stream
+  stream = nullptr;
   ais_rc = SA_AIS_ERR_BAD_HANDLE;
   return ais_rc;
 }
-- 
1.9.1


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


[devel] [PATCH 0/1] Review Request for log: restore ref counter for deleted stream [#2870]

2018-06-01 Thread Vu Minh Nguyen
Summary: log: restore ref counter for deleted stream [#2870]
Review request for Ticket(s): 2870
Peer Reviewer(s): Lennart, Canh
Pull request to: *** LIST THE PERSON WITH PUSH ACCESS HERE ***
Affected branch(es): develop, release
Development branch: ticket-2870
Base revision: 5d8d104ef442e4c58e2c6f870b912994a1e68398
Personal repository: git://git.code.sf.net/u/winhvu/review


Impacted area   Impact y/n

 Docsn
 Build systemn
 RPM/packaging   n
 Configuration files n
 Startup scripts n
 SAF servicesy
 OpenSAF servicesn
 Core libraries  n
 Samples n
 Tests   n
 Other   n


Comments (indicate scope for each "y" above):
-
*** EXPLAIN/COMMENT THE PATCH SERIES HERE ***

revision 4b86d52749d1fb134064cf40d9b37eb6e90ad541
Author: Vu Minh Nguyen 
Date:   Fri, 1 Jun 2018 15:36:18 +0700

log: restore ref counter for deleted stream [#2870]

In the methods LogAgent::saLogStreamClose() and LogAgent::saLogWriteLogAsync(),
the client is deleted if failed to recover; however, the pointer to the log
stream of this client has not been reseted. Therefore, when the destrustor of
ScopeData runs, the reference counter could be restored on deleted log stream.

This patch resets the pointer to nullptr in such case.



Complete diffstat:
--
 src/log/agent/lga_agent.cc | 4 
 1 file changed, 4 insertions(+)


Testing Commands:
-
*** LIST THE COMMAND LINE TOOLS/STEPS TO TEST YOUR CHANGES ***


Testing, Expected Results:
--
*** PASTE COMMAND OUTPUTS / TEST RESULTS ***


Conditions of Submission:
-
*** HOW MANY DAYS BEFORE PUSHING, CONSENSUS ETC ***


Arch  Built StartedLinux distro
---
mipsn  n
mips64  n  n
x86 n  n
x86_64  n  n
powerpc n  n
powerpc64   n  n


Reviewer Checklist:
---
[Submitters: make sure that your review doesn't trigger any checkmarks!]


Your checkin has not passed review because (see checked entries):

___ Your RR template is generally incomplete; it has too many blank entries
that need proper data filled in.

___ You have failed to nominate the proper persons for review and push.

___ Your patches do not have proper short+long header

___ You have grammar/spelling in your header that is unacceptable.

___ You have exceeded a sensible line length in your headers/comments/text.

___ You have failed to put in a proper Trac Ticket # into your commits.

___ You have incorrectly put/left internal data in your comments/files
(i.e. internal bug tracking tool IDs, product names etc)

___ You have not given any evidence of testing beyond basic build tests.
Demonstrate some level of runtime or other sanity testing.

___ You have ^M present in some of your files. These have to be removed.

___ You have needlessly changed whitespace or added whitespace crimes
like trailing spaces, or spaces before tabs.

___ You have mixed real technical changes with whitespace and other
cosmetic code cleanup changes. These have to be separate commits.

___ You need to refactor your submission into logical chunks; there is
too much content into a single commit.

___ You have extraneous garbage in your review (merge commits etc)

___ You have giant attachments which should never have been sent;
Instead you should place your content in a public tree to be pulled.

___ You have too many commits attached to an e-mail; resend as threaded
commits, or place in a public tree for a pull.

___ You have resent this content multiple times without a clear indication
of what has changed between each re-send.

___ You have failed to adequately and individually address all of the
comments and change requests that were proposed in the initial review.

___ You have a misconfigured ~/.gitconfig file (i.e. user.name, user.email etc)

___ Your computer have a badly configured date and time; confusing the
the threaded patch review.

___ Your changes affect IPC mechanism, and you don't present any results
for in-service upgradability test.

___ Your changes affect user manual and documentation, your patch series
do not contain the patch that updates the Doxygen manual.


--
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 0/1] Review Request for smf: Validation error for rollback CCB and a related core dump [#2858]

2018-06-01 Thread Nguyen Luu

Hi Lennart,

I've run *test_ccbhdl* in OpenSAF UML cluster and the same core dump was 
still generated as described in my previous mail.
My UML cluster was built and installed with the latest OpenSAF develop 
commit (*5d8d104 rded: run controller promotion code in new thread 
[#2857]*), and with your patch applied on top.


I debugged a little by removing the creation of the long-value 
SA_IMM_ATTR_SANAMET attribute from the test (below code, at two places 
in the test), and the test passed successfully with no core dump.


  // Add a long name and a third short name
  char long_name[300];
  for (size_t i = 0; i < 299; i++) {
    long_name[i] = 'a';
  }
  long_name[299] = '\0';
  osaf_extended_name_lend(long_name, _name);
  attribute.AddValue(modelmodify::SaNametToString(_name));

Testing further, I tried running a test campaign which included the 
creation of a long-dn object, and the campaign also failed at such 
creation (I did enable longDnsAllowed beforehand). Then, I tried testing 
the same campaign after *reverting your 2nd increment for ticket #1398* 
and the campaign completed successfully with the long-dn object created. 
So I've doubted that the 2nd increment of #1398 might have introduced 
the issue here.


Can you check/verify the patch again in consideration of my testing and 
observation?


Thanks,
Nguyen

On 5/31/2018 7:33 PM, Lennart Lund wrote:


Hi Nguyen,

I have tried to reproduce the coredump but I have not succeeded. Did 
you just run test_ccbhdl without any special settings?


I am testing in an OpenSAF UML cluster that is built and started using 
the tools in …/tools/cluster_sim_uml/


I have also tested when the test class is not in the IMM model. The 
test of course fail but no coredump. The fail happen in a controlled 
and predictable way.


What kind of system are you using?

Thanks

Lennart

*From:*Nguyen Luu 
*Sent:* den 31 maj 2018 11:10
*To:* Lennart Lund 
*Cc:* opensaf-devel@lists.sourceforge.net
*Subject:* Re: [PATCH 0/1] Review Request for smf: Validation error 
for rollback CCB and a related core dump [#2858]


Hi Lennart,

I've reviewed and tested your patch.
- For the code review, please check comments in the attached diff file.
- For the testing, a core dump occurred when executing *test_ccbhdl* 
(always reproducible). Test printouts, core dump backtrace, and syslog 
as shown below. Looks like some issue with setting an extended-name 
attribute of type SA_IMM_ATTR_SANAMET. Has this test passed in your 
last run?


-Terminal printouts-
root@SC-1:~# test_ccbhdl
ccbhdl_test
IMM class used for test: ImmTestValuesConfig
Creating: Test1=1,safApp=safSmfService
Aborted (core dumped)

-System logs-
2018-05-31 16:02:35.873 SC-1 osafimmpbed: IN Create of class 
ImmTestValuesConfig committing with ccbId:10004
2018-05-31 16:02:35.889 SC-1 osafimmnd[207]: NO Create of class 
ImmTestValuesConfig is PERSISTENT.
2018-05-31 16:02:35.908 SC-1 osafimmpbed: NO PBE allowing modification 
to object opensafImm=opensafImm,safApp=safImmService
2018-05-31 16:02:35.922 SC-1 osafimmnd[207]: NO Ccb 2 COMMITTED 
(immcfg_SC-1_487)
2018-05-31 16:02:35.934 SC-1 test_ccbhdl: 
src/base/osaf_extended_name.c:144: osaf_extended_name_length: 
Assertion 'osaf_extended_names_enabled && length >= 
SA_MAX_UNEXTENDED_NAME_LENGTH' failed.


-Core dump backtrace-
(gdb) bt
#0  0x7faf97b83428 in __GI_raise (sig=sig@entry=6) at 
../sysdeps/unix/sysv/linux/raise.c:54

#1  0x7faf97b8502a in __GI_abort () at abort.c:89
#2  0x7faf987034ab in __osafassert_fail 
(__file=__file@entry=0x7faf9873275d "src/base/osaf_extended_name.c",
    __line=__line@entry=144, __func=__func@entry=0x7faf987327f0 
<__FUNCTION__.3368> "osaf_extended_name_length",
    __assertion=__assertion@entry=0x7faf987327a8 
"osaf_extended_names_enabled && length >= SA_MAX_UNEXTENDED_NAME_LENGTH")

    at src/base/sysf_def.c:286
#3  0x7faf986fef89 in osaf_extended_name_length 
(name=0x564decae3796) at src/base/osaf_extended_name.c:143
#4  0x7faf9895ef1d in imma_copyAttrValue 
(p=p@entry=0x564decae2d00, attrValueType=SA_IMM_ATTR_SANAMET,

    attrValue=0x564decae3796) at src/imm/agent/imma_init.cc:434
#5  0x7faf9896b140 in ccb_object_create_common 
(ccbHandle=1527757355930828673, className=,
    parentName=0x7ffefbb72e20, objectName=, 
objectName@entry=0x0, attrValues=attrValues@entry=0x7ffefbb72cf0)

    at src/imm/agent/imma_om_api.cc:2079
#6  0x7faf9896d8cf in saImmOmCcbObjectCreate_2 
(ccbHandle=, className=,
    parentName=, 
attrValues=attrValues@entry=0x7ffefbb72cf0) at 
src/imm/agent/imma_om_api.cc:1660
#7  0x564dea9df953 in 
immom::ImmOmCcbObjectCreate::AddObjectCreateToCcb 
(this=this@entry=0x7ffefbb72ff0)

    at src/smf/smfd/imm_om_ccapi/om_ccb_object_create.cc:61
#8  0x564dea9d8d54 in modelmodify::AddCreateToCcb 
(ccb_handle=@0x7ffefbb730c8: 1527757355930828673, create_descriptor=...)

    at src/smf/smfd/imm_modify_config/add_operation_to_ccb.cc:103
#9  0x564dea9db26c in