Hi Mahesh,

we are running test cases that do several start and stop of openSAF. With gcov 
enabled core dumps are frequently produced, one reason
is the MDS thread calls exit at the same time the main thread calls 
__gcov_flush. exit is not thread safe and normally _Exit should be called in
daemon_exit, but if gcov is run __gov_flush has to be called before. If MDS 
calls exit at this time, at_exit handlers and destructors are run in parallel 
with
the main thread performing __gcov_flush, this does not work.

/Thanks HansN 
  

-----Original Message-----
From: A V Mahesh [mailto:[email protected]] 
Sent: den 30 januari 2017 04:20
To: Hans Nordebäck <[email protected]>
Cc: [email protected]
Subject: Re: [PATCH 1 of 1] mds: Remove calls to exit [#2279]

Hi Hans N,

ACK, Not tested.

I Hope you have  simulated the New return cases.

-AVM


On 1/27/2017 8:20 PM, Hans Nordeback wrote:
>   src/mds/mds_dt_trans.c |  34 +++++++++++++++++-----------------
>   1 files changed, 17 insertions(+), 17 deletions(-)
>
>
> diff --git a/src/mds/mds_dt_trans.c b/src/mds/mds_dt_trans.c
> --- a/src/mds/mds_dt_trans.c
> +++ b/src/mds/mds_dt_trans.c
> @@ -609,7 +609,7 @@ void mdtm_process_poll_recv_data_tcp(voi
>       if (0 == tcp_cb->bytes_tb_read) {
>               if (0 == tcp_cb->num_by_read_for_len_buff) {
>                       uint8_t *data;
> -                     int recd_bytes = 0;
> +                     ssize_t recd_bytes = 0;
>   
>                       
> /*******************************************************/
>                       /* Receive all incoming data on this socket */ @@ 
> -617,9 +617,9 
> @@ void mdtm_process_poll_recv_data_tcp(voi
>   
>                       recd_bytes = recv(tcp_cb->DBSRsock, tcp_cb->len_buff, 
> 2, MSG_NOSIGNAL);
>                       if (0 == recd_bytes) {
> -                             syslog(LOG_ERR, "MDTM:SOCKET recd_bytes :%d, 
> conn lost with dh server, exiting library err :%s", recd_bytes, 
> strerror(errno));
> +                             syslog(LOG_ERR, "MDTM:SOCKET recd_bytes :%zd, 
> conn lost with dh 
> +server", recd_bytes);
>                               close(tcp_cb->DBSRsock);
> -                             exit(0);
> +                             return;
>                       } else if (2 == recd_bytes) {
>                               uint16_t local_len_buf = 0;
>   
> @@ -638,12 +638,12 @@ void mdtm_process_poll_recv_data_tcp(voi
>                               if (recd_bytes < 0) {
>                                       return;
>                               } else if (0 == recd_bytes) {
> -                                     syslog(LOG_ERR, "MDTM:SOCKET = %d, conn 
> lost with dh server, exiting library err :%s", recd_bytes, strerror(errno));
> +                                     syslog(LOG_ERR, "MDTM:SOCKET = %zd, 
> conn lost with dh server", 
> +recd_bytes);
>                                       close(tcp_cb->DBSRsock);
> -                                     exit(0);
> +                                     return;
>                               } else if (local_len_buf > recd_bytes) {
>                                       /* can happen only in two cases, system 
> call interrupt or half data, */
> -                                     TRACE("MDTM:SOCKET less data recd, recd 
> bytes = %d, actual len = %d", recd_bytes,
> +                                     TRACE("MDTM:SOCKET less data recd, recd 
> bytes = %zd, actual len 
> += %d", recd_bytes,
>                                              local_len_buf);
>                                       tcp_cb->bytes_tb_read = 
> tcp_cb->buff_total_len - recd_bytes;
>                                       return;
> @@ -672,7 +672,7 @@ void mdtm_process_poll_recv_data_tcp(voi
>                               }
>                       }
>               } else if (1 == tcp_cb->num_by_read_for_len_buff) {
> -                     int recd_bytes = 0;
> +                     ssize_t recd_bytes = 0;
>   
>                       recd_bytes = recv(tcp_cb->DBSRsock, 
> &tcp_cb->len_buff[1], 1, 0);
>                       if (recd_bytes < 0) {
> @@ -685,14 +685,14 @@ void mdtm_process_poll_recv_data_tcp(voi
>                               tcp_cb->buff_total_len = 
> ncs_decode_16bit(&data);
>                               return;
>                       } else if (0 == recd_bytes) {
> -                             syslog(LOG_ERR, "MDTM:SOCKET = %d, conn lost 
> with dh server, exiting library err :%s", recd_bytes, strerror(errno));
> +                             syslog(LOG_ERR, "MDTM:SOCKET = %zd, conn lost 
> with dh server", 
> +recd_bytes);
>                               close(tcp_cb->DBSRsock);
> -                             exit(0);
> +                             return;
>                       } else {
>                               assert(0);      /* This should never occur */
>                       }
>               } else if (2 == tcp_cb->num_by_read_for_len_buff) {
> -                     int recd_bytes = 0;
> +                     ssize_t recd_bytes = 0;
>   
>                       if (NULL == (tcp_cb->buffer = calloc(1, 
> (tcp_cb->buff_total_len + 1)))) {
>                               /* Length + 2 is done to reuse the same buffer 
> @@ -704,12 
> +704,12 @@ void mdtm_process_poll_recv_data_tcp(voi
>                       if (recd_bytes < 0) {
>                               return;
>                       } else if (0 == recd_bytes) {
> -                             syslog(LOG_ERR, "MDTM:SOCKET = %d, conn lost 
> with dh server, exiting library err :%s", recd_bytes, strerror(errno));
> +                             syslog(LOG_ERR, "MDTM:SOCKET = %zd, conn lost 
> with dh server", 
> +recd_bytes);
>                               close(tcp_cb->DBSRsock);
> -                             exit(0);
> +                             return;
>                       } else if (tcp_cb->buff_total_len > recd_bytes) {
>                               /* can happen only in two cases, system call 
> interrupt or half data, */
> -                             TRACE("MDTM:SOCKET less data recd, recd bytes = 
> %d, actual len = %d", recd_bytes,
> +                             TRACE("MDTM:SOCKET less data recd, recd bytes = 
> %zd, actual len = 
> +%d", recd_bytes,
>                                      tcp_cb->buff_total_len);
>                               tcp_cb->bytes_tb_read = tcp_cb->buff_total_len 
> - recd_bytes;
>                               return;
> @@ -731,19 +731,19 @@ void mdtm_process_poll_recv_data_tcp(voi
>   
>       } else {
>               /* Partial data already read */
> -             int recd_bytes = 0;
> +             ssize_t recd_bytes = 0;
>   
>               recd_bytes =
>                   recv(tcp_cb->DBSRsock, 
> &tcp_cb->buffer[(tcp_cb->buff_total_len - tcp_cb->bytes_tb_read)], 
> tcp_cb->bytes_tb_read, 0);
>               if (recd_bytes < 0) {
>                       return;
>               } else if (0 == recd_bytes) {
> -                     syslog(LOG_ERR, "MDTM:SOCKET = %d, conn lost with dh 
> server, exiting library err :%s", recd_bytes, strerror(errno));
> +                     syslog(LOG_ERR, "MDTM:SOCKET = %zd, conn lost with dh 
> server", 
> +recd_bytes);
>                       close(tcp_cb->DBSRsock);
> -                     exit(0);
> +                     return;
>               } else if (tcp_cb->bytes_tb_read > recd_bytes) {
>                       /* can happen only in two cases, system call interrupt 
> or half data, */
> -                     TRACE("MDTM:SOCKET less data recd, recd bytes = %d, 
> actual len = %d", recd_bytes, tcp_cb->bytes_tb_read);
> +                     TRACE("MDTM:SOCKET less data recd, recd bytes = %zd, 
> actual len = 
> +%d", recd_bytes, tcp_cb->bytes_tb_read);
>                       tcp_cb->bytes_tb_read = tcp_cb->bytes_tb_read - 
> recd_bytes;
>                       return;
>               } else if (tcp_cb->bytes_tb_read == recd_bytes) {


------------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to