Hi list,

attached is a patch that fixes a PANIC condition we have been reported:

2018-09-07 11:38:07.241 [25148] [9] PANIC: gwlib/conn.c:889: conn_unregister: Assertion `conn != NULL' failed. 2018-09-07 11:38:07.255 [25148] [9] PANIC: /opt/kannel/sbin/smsbox(gw_backtrace+0xbe) [0x44e82e] 2018-09-07 11:38:07.255 [25148] [9] PANIC: /opt/kannel/sbin/smsbox(gw_panic+0x1ce) [0x44ea0e] 2018-09-07 11:38:07.255 [25148] [9] PANIC: /opt/kannel/sbin/smsbox() [0x44a21c] 2018-09-07 11:38:07.255 [25148] [9] PANIC: /opt/kannel/sbin/smsbox() [0x43fba1] 2018-09-07 11:38:07.255 [25148] [9] PANIC: /opt/kannel/sbin/smsbox() [0x443783]

where:

# addr2line -e /opt/kannel/sbin/smsbox 0x44a21c 0x43fba1 0x443783
/tmp/kannel/smppbox-1.9.4/gateway-ha/gwlib/http.c:1213
/tmp/kannel/smppbox-1.9.4/gateway-ha/gwlib/fdset.c:354
/tmp/kannel/smppbox-1.9.4/gateway-ha/gwlib/gwthread-pthread.c:165

so this was coming from gwlib/http.c:handle_transaction().

In fact we DO conn_destroy in gwlib/http.c:/send_request() if a conn_write() fails, and then again in handle_transaction() bail out and try to conn_unregister() and conn_destroy().

The conn_destroy() is safe as it tests for conn == NULL, but the conn_unregister() would raise an assertion panic here.

Suggested patch simply removes the gw_assert() check and leaves it to the function to test (what it does) to bail out if the conn is NULL.

If no objections arise, will commit to svn trunk.

Stipe



--
Best Regards,
Stipe Tolj

-------------------------------------------------------------------
Düsseldorf, NRW, Germany

Kannel Foundation                 tolj.org system architecture
http://www.kannel.org/            http://www.tolj.org/

stolj at kannel.org               st at tolj.org
-------------------------------------------------------------------
Index: gwlib/conn.c
===================================================================
--- gwlib/conn.c        (revision 5261)
+++ gwlib/conn.c        (working copy)
@@ -855,8 +855,6 @@
     int fd = -1;
     void *data = NULL;
     conn_callback_data_destroyer_t *destroyer = NULL;
-    
-    gw_assert(conn != NULL);
 
     if (conn == NULL || conn->fd < 0)
         return;

Reply via email to