### Description
<!-- On every startup of Kamailio I'm getting an error im my Log when Kamailio is going to load the globalblacklist table from MySQL Database I tested this with version 5.4.1 build from git source. With version 5.3.6 there are no errors like this. I diffed the source of userblacklist.c and saw some changes in the code. So there may be a bug. -->
### Troubleshooting
#### Reproduction
<!-- Create a simple config an use check_blacklist() Use db_mysql as database backend -->
#### Debugging Data
#### Log Messages
``` Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: DEBUG: <core> [core/route.c:885]: fix_actions(): fixing check_blacklist() Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: DEBUG: userblacklist [userblacklist.c:472]: add_source(): add table globalblacklist Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: DEBUG: <core> [dtrie.c:57]: dtrie_init(): allocate 16 bytes for root at 0x7fc29efa4ab0 Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: DEBUG: <core> [dtrie.c:67]: dtrie_init(): allocate 80 bytes for 10 root children pointer at 0x7fc29efa4b28 Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: ERROR: <core> [db.c:481]: db_use_table(): invalid parameter value Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: ERROR: userblacklist [db.c:123]: db_reload_source(): cannot use db table 'globalblacklist' Sep 17 07:56:36 voip-lab-proxy03 /usr/sbin/kamailio[553]: ERROR: userblacklist [userblacklist.c:425]: load_source(): cannot load source from 'globalblacklist' ```
### Additional Information
``` Kamailio 5.4.1 ```
* **Operating System**:
``` PRETTY_NAME="Debian GNU/Linux 10 (buster)" NAME="Debian GNU/Linux" VERSION_ID="10" VERSION="10 (buster)" VERSION_CODENAME=buster ID=debian HOME_URL="https://www.debian.org/" SUPPORT_URL="https://www.debian.org/support" BUG_REPORT_URL="https://bugs.debian.org/"
Linux voip-lab-proxy03 4.19.0-10-amd64 #1 SMP Debian 4.19.132-1 (2020-07-24) x86_64 GNU/Linux ```
Thanks for the report. Can you check if its later loaded successfully? It noticed this as well, but it is then loaded correctly. You can check with INFO log level or see if the server actually starts.
Sep 17 10:02:00 ip-XXX-31-38-XX /usr/sbin/kamailio[3752]: ERROR: userblacklist [db.c:123]: db_reload_source(): cannot use db table 'globalblacklist' Sep 17 10:02:00 ip-XXX-31-38-XX /usr/sbin/kamailio[3752]: ERROR: userblacklist [userblacklist.c:425]: load_source(): cannot load source from 'globalblacklist' Sep 17 10:02:00 ip-XXX-31-38-XX /usr/sbin/kamailio[3762]: INFO: userblacklist [userblacklist.c:797]: reload_sources(): Reloading source table 'globalblacklist' with dtrie root '0x7fc132b661d0'
As you mention, the server is starting correctly after this message. Also global blacklisting is working as expected. There are no errors afterwards. It's just while starting the server
Thanks for the configuration. As you also guessed, it is probably related to the changes done in 5.4 version, needs to be checked.
From the logs it seems an attempt to load the db records in the fixup function, which is executed after mod init callback, and typically the db connection is closed/reset in mod init callbacks not to be inherited on fork() for child processes, then opened in child init callback.
I split the error message in the srdb1 to be more clear in the future.
The recent commit to the module is cf2e3968000f1292ad1b1eb8f7d190fb53878c2b -- I am not familiar with the code, but I would look at the following snippet from commit to see if is the cause and/or done properly there:
* https://github.com/kamailio/kamailio/commit/cf2e3968000f1292ad1b1eb8f7d190fb...
Indeed, this is the commit i also had in my mind, thanks Daniel.
@henningw - are you planning to work on this one? Just to see in what direction should go. I am not familiar with it and not really using this module.
@miconda - did not found time yet due to more critial issues. @lbalaceanu as you did recently a major refactoring of the module, maybe you can have a look to this?
This should be tried on master branch with userblocklist module and a new issue opened if similar issue still happens.
Closed #2480.