Hi list,

when having a high IO scenario, i.e. a lot of DLRs coming in from the upstream SMSC side, and the smsbox connection vanished, then the thread gw/bb_box.c:sms_to_smsboxes() is most likely in the gwthread_sleep() loop captured. If we SIGTERM bearerbox it will iterate one more time, since the bb_status hasn't reflected the fact that we're in shutdown now and we need to wait 1m until the bearerbox goes down.

This is unnecessary IMO, since the MO/DLRs are persistent in the store, and we're not accepting any smsbox connection anyway when in shutdown mode. So we can make sure we wakeup-all in the main() scope and test for the corresponding bb_status in the while loop of the thread.

Please find the corresponding patch attached. If no objections arise, I'll commit the patch during the end of the week.

Stipe

--
-------------------------------------------------------------------
Kölner Landstrasse 419
40589 Düsseldorf, NRW, Germany

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

mailto:stolj_{at}_kannel.org      mailto:st_{at}_tolj.org
-------------------------------------------------------------------
Index: gw/bb_boxc.c
===================================================================
--- gw/bb_boxc.c        (revision 5138)
+++ gw/bb_boxc.c        (working copy)
@@ -1681,7 +1681,7 @@
 
     newmsg = startmsg = msg = NULL;
 
-    while(bb_status != BB_DEAD) {
+    while (bb_status != BB_SHUTDOWN && bb_status != BB_DEAD) {
 
         if (newmsg == startmsg) {
             /* check if we are in shutdown phase */
Index: gw/bearerbox.c
===================================================================
--- gw/bearerbox.c      (revision 5138)
+++ gw/bearerbox.c      (working copy)
@@ -789,6 +789,9 @@
     /* call shutdown */
     bb_shutdown();
 
+    /* wake up any sleeping threads */
+    gwthread_wakeup_all();
+
     /* wait until flow threads exit */
     while (gwlist_consume(flow_threads) != NULL)
         ;

Reply via email to