Same effect....

Can you please generate the patch with hg email command


Thanks
Vadim
Le 16 juin 09 à 20:25, Mauro Sergio Ferreira Brasil a écrit :

Hi Vadim!

Can you please try this new one ?

Thanks and best regards,
Mauro.




Vadim Lebedev escreveu:

Mauro

It is greate idea....

Unfortunately your patch does not apply (8 hunks out of 8 are refused)


Thanks
Vadim
Le 16 juin 09 à 18:53, Mauro Sergio Ferreira Brasil a écrit :

Hi Vadim!

I've added the critical section control on "transport_manager" as exposed below and it seems it work pretty fine.
At least, I'm not getting the crash on "udp.c" file any more.

The idea is quite simple: avoid the "transport_manager" finalization while a packet is being handled by "transport_on_data_socket_event" method. (I have protected "transport_on_listening_socket_event" method too, although I'm not completely sure if it's necessary as "transport_on_data_socket_event").

Please let me know if you have any comments or disagreements about it, ok ?

Thanks and best regards,
Mauro.




Mauro Sergio Ferreira Brasil escreveu:

Hi Vadim!

Sorry...
Wrong terminology...

I mean, that I could notice this problem when I was debugging the application...
I'll try to contact and make some search on "portaudio" library.

Regarding the patch you've sent me, I experienced a problem debugging the application yesterday... It seems the patch wasn't enough to avoid a crash on some scenario, because the crash ocurred inside "__osip_find_transaction" on same "udp.c" file like shown below:

            /* TODO: fix it for IPv6 */
osip_message_fix_last_via_header (sipevent->sip, inet_ntoa (((struct sockaddr_in *) & address)->sin_addr), ntohs (((struct sockaddr_in *) & address)->sin_port)) ;

transaction = __osip_find_transaction (eXosip.j_osip, sipevent, 1) ;

            if (transaction != NULL)

This method calling occurs right after the first "if (! eXosip.j_osip)" validation and before the second one (both present on your patch), and at this point (on the moment of "__osip_find_transaction" method calling) the "eXosip.j_osip" is NULL, what actually results on the crash some methods invocations later.

I'll try to code the "transport_manager" methods blocking as I've suggested on my first email (please see below), and get back to you with a possible patch after some time of validation.

Thanks and best regards,
Mauro.



--
At.,
<CMMI_2.jpg>
Technology and Quality on Information
Mauro Sérgio Ferreira Brasil
Coordenador de Projetos e Analista de Sistemas
+ [email protected]
: www.tqi.com.br
( + 55 (34)3291-1700
( + 55 (34)9971-2572 diff -r dc29b6afa409 wifo/eXosip/ transport_manager/transport_manager.c --- a/wifo/eXosip/transport_manager/transport_manager.c Mon Jun 15 18:27:14 2009 +0200 +++ b/wifo/eXosip/transport_manager/transport_manager.c Tue Jun 16 13:35:25 2009 -0300
@@ -34,6 +34,8 @@
static OWList * transport_data_socket_list = NULL ;
static OWList * transport_listening_socket_list = NULL ;
static pthread_mutex_t transport_socket_lists_mutex ;
+static pthread_mutex_t transport_termination_mutex ;
+static int is_terminating = 0;

static void
transport_on_data_socket_event
@@ -305,6 +307,17 @@
  return -1 ;
 }

+ if (pthread_mutex_init (& transport_termination_mutex, NULL))
+ {
+  pthread_mutex_destroy (& transport_socket_lists_mutex) ;
+  owlist_free (transport_listening_socket_list) ;
+  transport_listening_socket_list = NULL ;
+  owlist_free (transport_data_socket_list) ;
+  transport_data_socket_list = NULL ;
+  owsl_terminate () ;
+  return -1 ;
+ }
+
 return 0 ;
}

@@ -314,7 +327,18 @@
{
 int return_code = 0 ;

+ if ((return_code = pthread_mutex_lock (& transport_termination_mutex)) != 0)
+ {
+  //TODO: What ?
+  //return return_code;
+ }
+
+ is_terminating = 1;
+
+ pthread_mutex_unlock (& transport_termination_mutex);
+
return_code |= pthread_mutex_destroy (& transport_socket_lists_mutex) ; + return_code |= pthread_mutex_destroy (& transport_termination_mutex) ;

return_code |= owlist_free_all (transport_listening_socket_list, (void (*) (void *)) transport_socket_free) ;
 transport_listening_socket_list = NULL ;
@@ -789,9 +813,21 @@
 void * user_data
)
{
+ if (pthread_mutex_lock (& transport_termination_mutex))
+ {
+  return;
+ }
+
+ if (is_terminating)
+ {
+  pthread_mutex_unlock (& transport_termination_mutex);
+  return;
+ }
+
 if (event & OWSL_EVENT_ERROR)
 {
  transport_socket_remove (socket, TRANSPORT_DATA) ;
+  pthread_mutex_unlock (& transport_termination_mutex);
  return ;
 }

@@ -799,6 +835,9 @@
 {
  transport_recv_callback (socket) ;
 }
+
+ pthread_mutex_unlock (& transport_termination_mutex);
+
 return ;
}

@@ -810,6 +849,17 @@
 void * user_data
)
{
+ if (pthread_mutex_lock (& transport_termination_mutex))
+ {
+  return;
+ }
+
+ if (is_terminating)
+ {
+  pthread_mutex_unlock (& transport_termination_mutex);
+  return;
+ }
+
 if ((event & OWSL_EVENT_ERROR) != 0)
 {
  OWSLSocketType implementation = owsl_type_get (socket)  ;
@@ -819,6 +869,9 @@
  {
transport_listen_error_callback (transport_protocol_get (implementation), bind_address) ;
  }
+
+  pthread_mutex_unlock (& transport_termination_mutex);
+
  return ;
 }

@@ -829,7 +882,13 @@
  {
   transport_socket_add (new_socket, TRANSPORT_DATA) ;
  }
+
+  pthread_mutex_unlock (& transport_termination_mutex);
+
  return ;
 }
+
+ pthread_mutex_unlock (& transport_termination_mutex);
+
 return ;
}


--
At.,
<CMMI_2.jpg>
Technology and Quality on Information
Mauro Sérgio Ferreira Brasil
Coordenador de Projetos e Analista de Sistemas
+ [email protected]
: www.tqi.com.br
( + 55 (34)3291-1700
( + 55 (34)9971-2572 diff -r 15be388684d5 wifo/eXosip/ transport_manager/transport_manager.c --- a/wifo/eXosip/transport_manager/transport_manager.c Tue Jun 16 19:55:04 2009 +0200 +++ b/wifo/eXosip/transport_manager/transport_manager.c Tue Jun 16 15:24:00 2009 -0300
@@ -34,6 +34,8 @@
static OWList * transport_data_socket_list = NULL ;
static OWList * transport_listening_socket_list = NULL ;
static pthread_mutex_t transport_socket_lists_mutex ;
+static pthread_mutex_t transport_termination_mutex ;
+static int is_terminating = 0;

static void
transport_on_data_socket_event
@@ -305,6 +307,17 @@
                return -1 ;
        }

+       if (pthread_mutex_init (& transport_termination_mutex, NULL))
+       {
+               pthread_mutex_destroy (& transport_socket_lists_mutex) ;
+               owlist_free (transport_listening_socket_list) ;
+               transport_listening_socket_list = NULL ;
+               owlist_free (transport_data_socket_list) ;
+               transport_data_socket_list = NULL ;
+               owsl_terminate () ;
+               return -1 ;
+       }
+
        return 0 ;
}

@@ -314,7 +327,18 @@
{
        int return_code = 0 ;

+ if ((return_code = pthread_mutex_lock (& transport_termination_mutex)) != 0)
+       {
+               //TODO: What ?
+               //return return_code;
+       }
+
+       is_terminating = 1;
+
+       pthread_mutex_unlock (& transport_termination_mutex);
+
return_code |= pthread_mutex_destroy (& transport_socket_lists_mutex) ; + return_code |= pthread_mutex_destroy (& transport_termination_mutex) ;

return_code |= owlist_free_all (transport_listening_socket_list, (void (*) (void *)) transport_socket_free) ;
        transport_listening_socket_list = NULL ;
@@ -789,9 +813,21 @@
        void * user_data
)
{
+       if (pthread_mutex_lock (& transport_termination_mutex))
+       {
+               return;
+       }
+
+       if (is_terminating)
+       {
+               pthread_mutex_unlock (& transport_termination_mutex);
+               return;
+       }
+
        if (event & OWSL_EVENT_ERROR)
        {
                transport_socket_remove (socket, TRANSPORT_DATA) ;
+               pthread_mutex_unlock (& transport_termination_mutex);
                return ;
        }

@@ -799,6 +835,9 @@
        {
                transport_recv_callback (socket) ;
        }
+
+       pthread_mutex_unlock (& transport_termination_mutex);
+
        return ;
}

@@ -810,6 +849,17 @@
        void * user_data
)
{
+       if (pthread_mutex_lock (& transport_termination_mutex))
+       {
+               return;
+       }
+
+       if (is_terminating)
+       {
+               pthread_mutex_unlock (& transport_termination_mutex);
+               return;
+       }
+
        if ((event & OWSL_EVENT_ERROR) != 0)
        {
                OWSLSocketType implementation = owsl_type_get (socket)  ;
@@ -819,6 +869,9 @@
                {
transport_listen_error_callback (transport_protocol_get (implementation), bind_address) ;
                }
+
+               pthread_mutex_unlock (& transport_termination_mutex);
+
                return ;
        }

@@ -829,7 +882,13 @@
                {
                        transport_socket_add (new_socket, TRANSPORT_DATA) ;
                }
+
+               pthread_mutex_unlock (& transport_termination_mutex);
+
                return ;
        }
+
+       pthread_mutex_unlock (& transport_termination_mutex);
+
        return ;
}

_______________________________________________
QuteCom-dev mailing list
[email protected]
http://lists.qutecom.org/mailman/listinfo/qutecom-dev

Reply via email to