Re: [devel] [PATCH 2/2] dtmd: change log wording [#2030]
Hi Ale, ACK, with following ( not tested). Please take care of alignment. -AVM On 8/9/2017 8:14 PM, Alex Jones wrote: return failure when unable to add new node --- src/dtm/dtmnd/dtm_node.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/dtm/dtmnd/dtm_node.c b/src/dtm/dtmnd/dtm_node.c index 236ae65..4f0b065 100644 --- a/src/dtm/dtmnd/dtm_node.c +++ b/src/dtm/dtmnd/dtm_node.c @@ -111,6 +111,8 @@ uint32_t dtm_process_node_info(DTM_INTERNODE_CB *dtms_cb, int stream_sock, if (dtm_node_add(node, 0) != NCSCC_RC_SUCCESS) { LOG_ER( "DTM: A node already exists in the cluster with similar configuration (possible duplicate IP address and/or node id), please correct the other joining Node configuration "); +rc = NCSCC_RC_FAILURE; +goto done; } } else if (node->node_id == node_id) { @@ -130,8 +132,9 @@ uint32_t dtm_process_node_info(DTM_INTERNODE_CB *dtms_cb, int stream_sock, } else { LOG_ER( - "DTM: Node already exit in the cluster with smiler configuration , correct the other joining Node configuration "); - osafassert(0); + "DTM: A node already exists in the cluster with similar configuration (possible duplicate IP address and/or node id), please correct the other joining Node configuration "); + rc = NCSCC_RC_FAILURE; + goto done; } TRACE( -- 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/1] dtmd: change log wording [#2030]
As a general principle, we should never assert (or crash) due to the reception of unexpected or corrupted data over the network. So the assertion should be removed. But you are right that we need to do something sensible here. Maybe log an error message and terminate the connection to the node that sent the message? regards, Anders Widell On 08/09/2017 05:33 AM, A V Mahesh wrote: Hi Alex, You removed osafassert(0); and event `rc` is not updated to NCSCC_RC_FAILURE; why you what proceed for when node_id=0. node->node_id can be zero because of other factors, please check. -AVM On 8/8/2017 11:42 PM, Alex Jones wrote: Sep 13 14:00:52 SC-2 local0.err osafdtmd[378]: ER DTM: Node already exit in the cluster with smiler configuration , correct the other joining Node configuration The message is confusing. Reword it to make it clear that there is a possible duplicate IP address. --- src/dtm/dtmnd/dtm_node.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/dtm/dtmnd/dtm_node.c b/src/dtm/dtmnd/dtm_node.c index ac762d0..236ae65 100644 --- a/src/dtm/dtmnd/dtm_node.c +++ b/src/dtm/dtmnd/dtm_node.c @@ -110,8 +110,7 @@ uint32_t dtm_process_node_info(DTM_INTERNODE_CB *dtms_cb, int stream_sock, node->comm_status = true; if (dtm_node_add(node, 0) != NCSCC_RC_SUCCESS) { LOG_ER( -"DTM: Node already exit in the cluster with smiler configuration , correct the other joining Node configuration "); -osafassert(0); +"DTM: A node already exists in the cluster with similar configuration (possible duplicate IP address and/or node id), please correct the other joining Node configuration "); } } else if (node->node_id == node_id) { -- 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 1/1] imm: fix immnd coredump due to initialized CLM handle [#2549]
Initially CLM handle is set to 0. When CLM handle is initialized, it can be initialized again only when saClmDispatch returns SA_AIS_ERR_BAD_HANDLE. This will prevent coredumps with initialized CLM handle caused with MDS UP message for AMF and CLM services. --- src/imm/immnd/immnd_clm.c | 7 +++ src/imm/immnd/immnd_main.c | 8 +--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/imm/immnd/immnd_clm.c b/src/imm/immnd/immnd_clm.c index 4019439..beae739 100644 --- a/src/imm/immnd/immnd_clm.c +++ b/src/imm/immnd/immnd_clm.c @@ -199,6 +199,11 @@ void *immnd_clm_init_thread(void *cb) { TRACE_ENTER(); + if(immnd_cb->clm_hdl) { + TRACE("CLM handle has already been initialized."); + goto done; + } + SaAisErrorT rc = saClmInitialize_4(_cb->clm_hdl, _callbacks, ); while ((rc == SA_AIS_ERR_TRY_AGAIN) || (rc == SA_AIS_ERR_TIMEOUT) || @@ -228,6 +233,8 @@ void *immnd_clm_init_thread(void *cb) exit(EXIT_FAILURE); } TRACE("CLM Initialization SUCCESS.."); + +done: TRACE_LEAVE(); return NULL; } diff --git a/src/imm/immnd/immnd_main.c b/src/imm/immnd/immnd_main.c index bca8f80..0f8364d 100644 --- a/src/imm/immnd/immnd_main.c +++ b/src/imm/immnd/immnd_main.c @@ -423,11 +423,12 @@ int main(int argc, char *argv[]) } if (fds[FD_CLM_INIT].revents & POLLIN) { - osafassert(!immnd_cb->clm_hdl); - TRACE("Initalize CLM "); ncs_sel_obj_rmv_ind(_cb->clm_init_sel_obj, true, true); - immnd_init_with_clm(); + if(!immnd_cb->clm_hdl) { + TRACE("Initalize CLM "); + immnd_init_with_clm(); + } nfds = 5; } @@ -445,6 +446,7 @@ int main(int argc, char *argv[]) immnd_cb->clm_hdl); immnd_clm_node_cleanup( immnd_cb); + immnd_cb->clm_hdl = 0; immnd_cb->clmSelectionObject = -1; immnd_init_with_clm(); -- 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 imm: fix immnd coredump due to initialized CLM handle [#2549]
Summary: imm: fix immnd coredump due to initialized CLM handle [#2549] Review request for Ticket(s): 2549 Peer Reviewer(s): Hung, Mahesh Pull request to: Zoran Affected branch(es): develop, release Development branch: ticket-2549 Base revision: 56f638bc7ac2f5baa8988e6500eb63160de75a2d Personal repository: git://git.code.sf.net/u/zmilinkovic/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): - revision 668d3ccc3bb5adff9c3891dcaadeafe9508486f8 Author: Zoran MilinkovicDate: Wed, 9 Aug 2017 13:37:11 +0200 imm: fix immnd coredump due to initialized CLM handle [#2549] Initially CLM handle is set to 0. When CLM handle is initialized, it can be initialized again only when saClmDispatch returns SA_AIS_ERR_BAD_HANDLE. This will prevent coredumps with initialized CLM handle caused with MDS UP message for AMF and CLM services. Complete diffstat: -- src/imm/immnd/immnd_clm.c | 7 +++ src/imm/immnd/immnd_main.c | 8 +--- 2 files changed, 12 insertions(+), 3 deletions(-) Testing Commands: - Testing, Expected Results: -- IMMND should not assert when AMF or CLM services come up again. Conditions of Submission: - Ack from Hung and Mahesh. 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 1/1] log: fix cppcheck, cpplint and reorganize headers - part 1 [#2445]
Hi Canh, Ack with comments, with [Vu]. Regards, Vu > -Original Message- > From: Canh Van Truong [mailto:canh.v.tru...@dektech.com.au] > Sent: Thursday, July 20, 2017 1:31 PM > To: lennart.l...@ericsson.com; vu.m.ngu...@dektech.com.au; > mahesh.va...@oracle.com > Cc: opensaf-devel@lists.sourceforge.net; Canh Van Truong >> Subject: [PATCH 1/1] log: fix cppcheck, cpplint and reorganize headers - part > 1 [#2445] > >Fix cppcheck, cpplint, replace nullptr for following files: > - lgs_amf.*, lgs_config.*, lgs_dest.*, lgs_evt.*, lgs_file.*, > lgs_filehdl.*, lgs_nildest.*, lgs_unixsock_dest.* > lgs_util.*, lgs_dest_test.* > --- > src/log/logd/lgs_amf.cc | 25 ++-- > src/log/logd/lgs_config.cc | 238 +++ > src/log/logd/lgs_config.h| 3 +- > src/log/logd/lgs_dest.cc | 2 +- > src/log/logd/lgs_dest.h | 6 +- > src/log/logd/lgs_evt.cc | 111 +- > src/log/logd/lgs_evt.h | 17 ++- > src/log/logd/lgs_file.cc | 56 + > src/log/logd/lgs_filehdl.cc | 84 +++--- > src/log/logd/lgs_nildest.h | 6 +- > src/log/logd/lgs_recov.cc| 4 +- > src/log/logd/lgs_stream.cc | 16 +-- > src/log/logd/lgs_unixsock_dest.h | 6 +- > src/log/logd/lgs_util.cc | 58 +- > src/log/logd/lgs_util.h | 7 +- > src/log/tests/lgs_dest_test.cc | 2 +- > 16 files changed, 293 insertions(+), 348 deletions(-) > > diff --git a/src/log/logd/lgs_amf.cc b/src/log/logd/lgs_amf.cc > index 434d40861..6821cb859 100644 > --- a/src/log/logd/lgs_amf.cc > +++ b/src/log/logd/lgs_amf.cc > @@ -20,9 +20,9 @@ > */ > > #include "nid/agent/nid_start_util.h" > -#include "log/logd/lgs.h" > -#include "lgs_config.h" > #include "osaf/immutil/immutil.h" > +#include "log/logd/lgs.h" > +#include "log/logd/lgs_config.h" > > static void close_all_files() { >log_stream_t *stream; > @@ -124,13 +124,11 @@ static SaAisErrorT > amf_standby_state_handler(lgs_cb_t *cb, > > ** > ***/ > static SaAisErrorT amf_quiescing_state_handler(lgs_cb_t *cb, > SaInvocationT invocation) { > - SaAisErrorT ais_rc = SA_AIS_OK; > - >TRACE_ENTER2("HA QUIESCING request"); >close_all_files(); > >/* Give up our IMM OI implementer role */ > - ais_rc = immutil_saImmOiImplementerClear(cb->immOiHandle); > + SaAisErrorT ais_rc = immutil_saImmOiImplementerClear(cb- > >immOiHandle); >if (ais_rc != SA_AIS_OK) { > LOG_WA("immutil_saImmOiImplementerClear failed: %s", > saf_error(ais_rc)); >} > @@ -156,13 +154,11 @@ static SaAisErrorT > amf_quiescing_state_handler(lgs_cb_t *cb, > static SaAisErrorT amf_quiesced_state_handler(lgs_cb_t *cb, >SaInvocationT invocation) { >V_DEST_RL mds_role; > - SaAisErrorT rc = SA_AIS_OK; > - >TRACE_ENTER2("HA AMF QUIESCED STATE request"); >close_all_files(); > >/* Give up our IMM OI implementer role */ > - rc = immutil_saImmOiImplementerClear(cb->immOiHandle); > + SaAisErrorT rc = immutil_saImmOiImplementerClear(cb->immOiHandle); >if (rc != SA_AIS_OK) { > LOG_WA("immutil_saImmOiImplementerClear failed: %s", saf_error(rc)); >} > @@ -410,12 +406,14 @@ static SaAisErrorT amf_healthcheck_start(lgs_cb_t > *lgs_cb) { >memset(, 0, sizeof(healthy)); >health_key = getenv("LGSV_ENV_HEALTHCHECK_KEY"); > > - if (health_key == NULL) > -strcpy((char *)healthy.key, "F1B2"); > + if (health_key == nullptr) > +snprintf(reinterpret_cast(healthy.key), > + SA_AMF_HEALTHCHECK_KEY_MAX, "F1B2"); >else > -strcpy((char *)healthy.key, health_key); > +snprintf(reinterpret_cast(healthy.key), > + SA_AMF_HEALTHCHECK_KEY_MAX, "%s", health_key); > > - healthy.keyLen = strlen((char *)healthy.key); > + healthy.keyLen = strlen(reinterpret_cast(healthy.key)); > >error = saAmfHealthcheckStart(lgs_cb->amf_hdl, _cb->comp_name, > , > SA_AMF_HEALTHCHECK_AMF_INVOKED, > @@ -485,7 +483,8 @@ SaAisErrorT lgs_amf_init(lgs_cb_t *cb) { [Vu] `lgs_amf_init()` is public interface of lgs_amf.cc. Consider to creating its own header file lgs_amf.h and move that function to that file. >} > >/* Register component with AMF */ > - error = saAmfComponentRegister(cb->amf_hdl, >comp_name, > (SaNameT *)NULL); > + error = saAmfComponentRegister(cb->amf_hdl, >comp_name, > + reinterpret_cast(NULL)); [Vu] 1) Use nullptr instread. 2) Why need to cast NULL pointer to SaNameT*? >if (error != SA_AIS_OK) { > LOG_ER("saAmfComponentRegister() FAILED"); > goto done; > diff --git a/src/log/logd/lgs_config.cc b/src/log/logd/lgs_config.cc > index 7b1ad56d6..141aaa2f8 100644 > --- a/src/log/logd/lgs_config.cc