Hi,

We're trying to upgrade from 5.3.X to 5.4.5 however kamailio will not start and produces the following error, despite the db_url being set in the config and printed in the logs:

Bad config - you can not call 'handle_publish' function (db_url not set)

Looking at the code this error only seems plausible if the pres_library_mode is set to 1 here but we don't see the corresponding "switch to library mode" message in the debug logs which leaves me a bit stuck - I've included the grepped logs at the bottom of the message.

Does anyone have any ideas what is causing this issue? I've seen a previous issue relating to interactions between presence and presence_xml which we're also using, but it looks like this was fixed in an older version.

Any suggestions appreciated.

# ----- presence params -----
modparam("presence", "db_url", DBURL)
modparam("presence", "db_update_period", 20)
modparam("presence", "clean_period", 60)
modparam("presence", "local_log_facility", "LOG_LOCAL3")
modparam("presence", "max_expires", 14430)

# ----- presence_xml params -----
modparam("presence_xml", "db_url", DBURL)
modparam("presence_xml", "force_active", 1)


root@kamailio:/etc/kamailio# grep -i "presence" /var/log/kamailio/kamailio.log
May 10 12:44:14 kamailio /sbin/kamailio[23729]: ERROR: presence [presence.c:656]: fixup_presence(): Bad config - you can not call 'handle_publish' function (db_url not set)
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/cfg.y:1810]: yyparse(): loading module presence.so
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:525]: load_module(): trying to load </lib64/kamailio/modules/presence.so>
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/kemi.c:2927]: sr_kemi_modules_add(): adding module: presence
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:287]: register_module(): register PV from: presence
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/cfg.lex:1796]: pp_define(): defining id: MOD_presence
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/cfg.y:1810]: yyparse(): loading module presence_xml.so
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:525]: load_module(): trying to load </lib64/kamailio/modules/presence_xml.so>
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/kemi.c:2927]: sr_kemi_modules_add(): adding module: presence_xml
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/cfg.lex:1796]: pp_define(): defining id: MOD_presence_xml
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/cfg.y:1810]: yyparse(): loading module presence_mwi.so
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:525]: load_module(): trying to load </lib64/kamailio/modules/presence_mwi.so>
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/cfg.lex:1796]: pp_define(): defining id: MOD_presence_mwi
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/cfg.y:1810]: yyparse(): loading module presence_dialoginfo.so
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:525]: load_module(): trying to load </lib64/kamailio/modules/presence_dialoginfo.so>
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/cfg.lex:1796]: pp_define(): defining id: MOD_presence_dialoginfo
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:107]: set_mod_param_regex(): 'presence' matches module 'presence'
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:744]: find_param_export(): found <db_url> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:123]: set_mod_param_regex(): found <db_url> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:107]: set_mod_param_regex(): 'presence' matches module 'presence'
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:744]: find_param_export(): found <db_update_period> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:123]: set_mod_param_regex(): found <db_update_period> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:107]: set_mod_param_regex(): 'presence' matches module 'presence'
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:744]: find_param_export(): found <clean_period> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:123]: set_mod_param_regex(): found <clean_period> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:107]: set_mod_param_regex(): 'presence' matches module 'presence'
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:744]: find_param_export(): found <local_log_facility> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:123]: set_mod_param_regex(): found <local_log_facility> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:107]: set_mod_param_regex(): 'presence' matches module 'presence'
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:744]: find_param_export(): found <max_expires> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:123]: set_mod_param_regex(): found <max_expires> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:107]: set_mod_param_regex(): 'presence_xml' matches module 'presence_xml'
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:744]: find_param_export(): found <db_url> in module presence_xml [/lib64/kamailio/modules/presence_xml.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:123]: set_mod_param_regex(): found <db_url> in module presence_xml [/lib64/kamailio/modules/presence_xml.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:107]: set_mod_param_regex(): 'presence_xml' matches module 'presence_xml'
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/sr_module.c:744]: find_param_export(): found <force_active> in module presence_xml [/lib64/kamailio/modules/presence_xml.so]
May 10 12:44:41 kamailio kamailio: DEBUG: <core> [core/modparam.c:123]: set_mod_param_regex(): found <force_active> in module presence_xml [/lib64/kamailio/modules/presence_xml.so]
May 10 12:44:43 kamailio kamailio: DEBUG: <core> [core/sr_module.c:652]: find_mod_export_record(): found export of <handle_publish> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:43 kamailio kamailio: DEBUG: <core> [core/sr_module.c:652]: find_mod_export_record(): found export of <handle_subscribe> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:43 kamailio kamailio: DEBUG: <core> [core/route.c:129]: route_add(): mapping routing block (0x560e73f9a440)[PRESENCE] to 11
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: <core> [core/sr_module.c:873]: init_mod(): presence
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [presence.c:293]: mod_init(): db_url=mysql://kamailio:PASSWORD@localhost/kamailio (len=50 addr=0x7f3a33d4e288)
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [presence.c:337]: mod_init(): server_address parameter not set in configuration file
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [subscribe.c:2529]: restore_db_subs(): loading information from database 0 records
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: <core> [core/sr_module.c:873]: init_mod(): presence_xml
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence_xml [presence_xml.c:170]: mod_init(): db_url=mysql://kamailio:PASSWORD@localhost/kamailio (len=50 addr=0x7f3a33d4ef00)
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: <core> [core/sr_module.c:652]: find_mod_export_record(): found export of <bind_presence> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:324]: search_event(): start event= [presence/1]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:324]: search_event(): start event= [presence.winfo/2]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:239]: add_event(): successfully added event: presence - len= 8
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence_xml [add_events.c:75]: xml_add_events(): added 'presence' event to presence module
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:324]: search_event(): start event= [presence.winfo/2]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:324]: search_event(): start event= [presence/1]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:188]: add_event(): Found wipeer event [presence] for event [presence.winfo]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:239]: add_event(): successfully added event: presence.winfo - len= 14
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence_xml [add_events.c:94]: xml_add_events(): added 'presence.winfo' event to presence module
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:324]: search_event(): start event= [xcap-diff/0]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:324]: search_event(): start event= [xcap-diff.winfo/0]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:239]: add_event(): successfully added event: xcap-diff - len= 9
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence_xml [add_events.c:132]: xml_add_events(): added 'xcap-diff' event to presence module
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: <core> [core/sr_module.c:873]: init_mod(): presence_mwi
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: <core> [core/sr_module.c:652]: find_mod_export_record(): found export of <bind_presence> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:324]: search_event(): start event= [message-summary/6]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:324]: search_event(): start event= [message-summary.winfo/0]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:239]: add_event(): successfully added event: message-summary - len= 15
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: <core> [core/sr_module.c:873]: init_mod(): presence_dialoginfo
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: <core> [core/sr_module.c:652]: find_mod_export_record(): found export of <bind_presence> in module presence [/lib64/kamailio/modules/presence.so]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:324]: search_event(): start event= [dialog/5]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:324]: search_event(): start event= [dialog.winfo/0]
May 10 12:44:45 kamailio /sbin/kamailio[23830]: DEBUG: presence [event_list.c:239]: add_event(): successfully added event: dialog - len= 6
May 10 12:44:47 kamailio /sbin/kamailio[23830]: ERROR: presence [presence.c:656]: fixup_presence(): Bad config - you can not call 'handle_publish' function (db_url not set)
May 10 12:44:47 kamailio /sbin/kamailio[23830]: DEBUG: presence_xml [presence_xml.c:295]: destroy(): start
May 10 12:44:47 kamailio /sbin/kamailio[23830]: DEBUG: presence [subscribe.c:2433]: timer_db_update(): db_update timer
May 10 12:44:47 kamailio /sbin/kamailio[23830]: DEBUG: presence [subscribe.c:2137]: update_db_subs_timer(): update_db_subs_timer: start