Re: [PATCH] 0000326: SMSbox CRASH: PANIC: gwlib/list.c:502: lock: Assertion

Alexander Malysh <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>
Hi,

this patch doesn't add anything and doesn't fix #326.
List in conn_pool dictionary in function check_pool_conn is never NULL!
Just look how we add Connection check to FDSet, function conn_pool_put:

     key = conn_pool_key(host, port);
     mutex_lock(conn_pool_lock);
     list = dict_get(conn_pool, key);
     if (list == NULL) {
         list = gwlist_create();
         dict_put(conn_pool, key, list);
     }
     gwlist_append(list, conn);
     /* register connection to get server disconnect */
     conn_register_real(conn, client_fdset, check_pool_conn, key, 
octstr_destroy_item);

If this patch fix #326 then we have heavy race condition somewhere in 
the conn.c,fdset.c,http.c.

Could someone to 100% confirm that this patch fix #326?

Thanks,
Alex

Vincent CHAVANIS schrieb:
> We have here an issue :
> 
> 
> -list is not checked in gwlist_delete_equal()
> So if dict_get(conn_pool, key) returns NULL the process panic.
> 
> 
> 
> diff -rau /gateway-cvs/gwlib/http.c /gateway/gwlib/http.c
> --- /gateway-cvs/gwlib/http.c   2006-04-01 19:45:13.000000000 +0200
> +++ /gateway/gwlib/http.c       2006-06-26 20:08:53.000000000 +0200
> @@ -848,7 +848,7 @@
>          List *list;
>          mutex_lock(conn_pool_lock);
>          list = dict_get(conn_pool, key);
> -        if (gwlist_delete_equal(list, conn) > 0) {
> +        if (list != NULL && gwlist_delete_equal(list, conn) > 0) {
>              /*
>               * ok, connection was still within pool. So it's
>               * safe to destroy this connection.
> 
> 
> 
> --
> Telemaque - NICE - (FR)
> Service Technique - Developpement
> http://www.telemaque.fr/
> [email protected]
> Tel : +33 4 93 97 71 64 (fax 68)
> 
> 
> ------------------------------------------------------------------------
> 
> diff -rau /gateway-cvs/gwlib/http.c /gateway/gwlib/http.c
> --- /gateway-cvs/gwlib/http.c   2006-04-01 19:45:13.000000000 +0200
> +++ /gateway/gwlib/http.c       2006-06-26 20:08:53.000000000 +0200
> @@ -848,7 +848,7 @@
>          List *list;
>          mutex_lock(conn_pool_lock);
>          list = dict_get(conn_pool, key);
> -        if (gwlist_delete_equal(list, conn) > 0) {
> +        if (list != NULL && gwlist_delete_equal(list, conn) > 0) {
>              /*
>               * ok, connection was still within pool. So it's
>               * safe to destroy this connection.
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> devel mailing list
> [email protected]
> http://www.kannel.org/mailman/listinfo/devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.