[SR-Users] dmq_usrloc, usrloc:db_mode 3, and PostgreSQL

Alex Balashov abalashov at evaristesys.com
Fri Dec 15 21:52:40 CET 2017


By way of follow-up:

db_mode 1 likewise fails, in the same fashion.

db_mode 2 does work and successfully sync the contact to the DB on
timer_interval.

So, I suspect this is some sort of race that raises when immediate
database write-through is required.

On Fri, Dec 15, 2017 at 02:31:06PM -0500, Alex Balashov wrote:

> Hi,
> 
> Running bleeding-edge branch 5.1 clone here.
> 
> dmq_usrloc replication works fine when using in-memory only backing for
> the underlying usrloc module, i.e. db_mode 0. I haven't tried mode 1 and
> mode 2.
> 
> I use mode 3, so that contacts are immediately persisted straight to a
> local database. The database flavour is PostgreSQL in this case.
> 
> When new contacts replicated via dmq_usrloc come in, I get this in the
> Kamailio log:
> 
> Dec 15 19:23:35 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: ERROR: <core> [db.c:465]: db_use_table(): invalid parameter value
> Dec 15 19:23:35 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: ERROR: usrloc [udomain.c:817]: db_load_urecord_by_ruid(): failed to use table location
> Dec 15 19:23:35 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: WARNING: dmq_usrloc [usrloc_sync.c:147]: delete_contact(): AOR/Contact not found
> Dec 15 19:23:35 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: ERROR: <core> [db.c:465]: db_use_table(): invalid parameter value
> Dec 15 19:23:35 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: ERROR: usrloc [udomain.c:817]: db_load_urecord_by_ruid(): failed to use table location
> Dec 15 19:23:35 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: WARNING: dmq_usrloc [usrloc_sync.c:147]: delete_contact(): AOR/Contact not found
> 
> I added some code to lib/srdb1/db.c to print the parameter name and the
> location being passed to db_use_table():
> 
>   */
>  int db_use_table(db1_con_t* _h, const str* _t)
>  {
> +       LM_ERR("DB handle = %p\n", _h);
> +
>         if (!_h || !_t || !_t->s) {
> -               LM_ERR("invalid parameter value\n");
> +               LM_ERR("invalid parameter value %.*s\n", _t->len, _t->s);
>                 return -1;
>         }
> 
> And got this:
> 
> Dec 15 19:23:36 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: ERROR: <core> [db.c:462]: db_use_table(): DB handle = (nil)
> Dec 15 19:23:36 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: ERROR: <core> [db.c:465]: db_use_table(): invalid parameter value location
> Dec 15 19:23:36 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: ERROR: usrloc [udomain.c:631]: db_load_urecord(): failed to use table location
> Dec 15 19:23:36 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: ERROR: <core> [db.c:462]: db_use_table(): DB handle = (nil)
> Dec 15 19:23:36 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: ERROR: <core> [db.c:465]: db_use_table(): invalid parameter value location
> Dec 15 19:23:36 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: ERROR: usrloc [ucontact.c:679]: db_insert_ucontact(): sql use_table failed
> Dec 15 19:23:36 evaristesys-testbed-2 /usr/local/sbin/kamailio[9395]: ERROR: usrloc [urecord.c:582]: insert_ucontact(): failed to insert in database
> 
> So, it appears the DB handle being passed here is NULL is in this
> situation.
> 
> The same AOR is present in 'ul.dump' RPC command when using db_mode 0. 
> 
> Please advise? :)
> 
> -- Alex
> 
> -- 
> Alex Balashov | Principal | Evariste Systems LLC
> 
> Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) 
> Web: http://www.evaristesys.com/, http://www.csrpswitch.com/
> 
> _______________________________________________
> Kamailio (SER) - Users Mailing List
> sr-users at lists.kamailio.org
> https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users

-- 
Alex Balashov | Principal | Evariste Systems LLC

Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free) 
Web: http://www.evaristesys.com/, http://www.csrpswitch.com/



More information about the sr-users mailing list