Hi Stipe,

sorry I was not available earlier…

just checked your patch and see man many issues…

1. 

+static void init_smsbox_routes(Cfg *cfg, int reload)

you use continue if config is wrong

but you already destroyed previous configuration

-    /* send new config to clients */
+    gw_rwlock_wrlock(smsbox_list_rwlock);
+    dict_destroy(smsbox_by_smsc);
+    dict_destroy(smsbox_by_receiver);
+    dict_destroy(smsbox_by_smsc_receiver);
+    smsbox_by_smsc = dict_create(30, (void(*)(void *)) octstr_destroy);
+    smsbox_by_receiver = dict_create(50, (void(*)(void *)) octstr_destroy);
+    smsbox_by_smsc_receiver = dict_create(50, (void(*)(void *)) 
octstr_destroy);
+    init_smsbox_routes(cfg, 1);
+    gw_rwlock_unlock(smsbox_list_rwlock);

That means, you have inconsistency


2. if I see reload configs without a lock… Uhh I can construct soo many cases, 
e.g. smsc is renamed in new config but still used in the old smsbox group, etc. 
etc.

 int bb_graceful_restart(void)
 {
-    return smsc2_graceful_restart();
+    Cfg *cfg;
+
+    info(0, "Reloading configuration resource `%s'.", 
octstr_get_cstr(cfg_filename));
+    cfg = cfg_create(cfg_filename);
+    if (cfg_read(cfg) == -1) {
+        error(0, "Error processing configuration resource `%s'. Continue with 
existing configuration.",
+              octstr_get_cstr(cfg_filename));
+        return -1;
+    }
+
+    smsc2_graceful_restart(cfg);
+    smsbox_restart(cfg);
+    return 0;
 }


Reload has to be atomic operation otherwise you will have some time 
inconsistent state.

Thanks,
Alex




> Am 15.10.2018 um 15:10 schrieb Stipe Tolj <st...@kannel.org>:
> 
> Am 01.10.2018 14:56, schrieb Stipe Tolj:
>> Hi all,
>> 
>> the reloading of the config (aka graceful restart) supports the
>> on-th-fly manipulation of the upstream SMSC groups and the corresponding
>> routing constraints for them.
>> 
>> What is doesn't support is the on-the-fly changing of the 'group =
>> smsbox-route' MO direction routing.
>> 
>> The attached patch adds this capability.
>> 
>> Please review. If no objections arise I will commit this within the next
>> days.
> 
> committed to svn trunk, r5269.
> 
> -- 
> Best Regards,
> Stipe Tolj
> 
> -------------------------------------------------------------------
> Düsseldorf, NRW, Germany
> 
> Kannel Foundation                 tolj.org <http://tolj.org/> system 
> architecture
> http://www.kannel.org/ <http://www.kannel.org/>            
> http://www.tolj.org/ <http://www.tolj.org/>
> 
> stolj at kannel.org <http://kannel.org/>               st at tolj.org 
> <http://tolj.org/>
> -------------------------------------------------------------------
> 

Reply via email to