Re: [PATCH] fixing possible PANIC condition
[email protected] Wed, 19 Sep 2018 15:31:32 +0200
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Stipe, is it not easier just check for conn !=3D NULL at the place it passed to = conn_unregister ? assertion is very interesting at this place IMHO because it can show = that someone try to unregister connection which is null but should not = be null. This prevents from resources leak. Alex > Am 10.09.2018 um 12:21 schrieb Stipe Tolj <[email protected]>: >=20 > Hi list, >=20 > attached is a patch that fixes a PANIC condition we have been = reported: >=20 > 2018-09-07 11:38:07.241 [25148] [9] PANIC: gwlib/conn.c:889: = conn_unregister: Assertion `conn !=3D 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] >=20 > where: >=20 > # 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 >=20 > so this was coming from gwlib/http.c:handle_transaction(). >=20 > 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(). >=20 > The conn_destroy() is safe as it tests for conn =3D=3D NULL, but the = conn_unregister() would raise an assertion panic here. >=20 > 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. >=20 > If no objections arise, will commit to svn trunk. >=20 > Stipe >=20 >=20 >=20 > --=20 > Best Regards, > Stipe Tolj >=20 > ------------------------------------------------------------------- > D=C3=BCsseldorf, NRW, Germany >=20 > Kannel Foundation tolj.org system architecture > http://www.kannel.org/ http://www.tolj.org/ >=20 > stolj at kannel.org st at tolj.org > ------------------------------------------------------------------- > <workspace-gateway-conn-unreg.diff>