[Spce-user] mr6.5.4 proxy still starts before redis

Alex Lutay alutay at sipwise.com
Thu May 23 12:22:15 EDT 2019

Hi all,

We have managed to reproduce it, searching for the fix...
The trick is in slow DB loading from append only file,
while systemd believes Redis is ready and starts kamailio.

The best fix here could be on Redis side to support Type=notify,
unfortunately we are not yet there...

Will find something better here.

P.S. I do not really want to bump TimeoutStartSec as
it will slows down the boot process.

Tnx for sharing and reporting anyway.
The current internal ticket is TT#59204 for referencing.

On 5/20/19 7:35 PM, Henk wrote:
> Thank you Sven,
> I'm not using Redis for calls yet, so it's not that big and it starts
> (around 140MB now), but this can be interesting for other users too.
> For me the only problem is the starting order. Your fix will work, but
> as Sipwise already made an effort to release a patch I will test until
> it works as it should.
> Regards,
> Henk
> On 20-5-2019 18:03, Sven Van Gorp wrote:
>> Hi Henk,
>> we had the same problem like a month ago:
>> In our case the problem was that Redis checks the database
>> file/ngcp-data/redis/mpc-nivisng1.aof at startup, and ours was 1G and
>> that took longer then the 1,5 minute that systemd waits and so systemd
>> abandoned startup of Redis and so redis never started, hence no calls
>> we changed the timeout in systemd from the default 1m 30sec to 3
>> minutes by adding to
>> /etc/systemd/system/redis-server.service.d/override.conf:
>>     TimeoutStartSec=3min
>> On the other hand we added a dependency for Redis in Kamailio therfore
>> we added to /etc/systemd/system/kamailio-proxy.service.d/override.conf
>>     [Unit]
>>     Requires=redis-server.service
>>     After=redis-server.service
>> That did the trick for us
>> cheers, Sven
>> El 11/5/19 a las 11:24, Henk escribió:
>>> Hi,
>>> After upgrading to mr6.5.4 and applying the latest patches,
>>> kamailio-proxy still starts with this error and stops:
>>> May 11 11:06:36 spce proxy[1840]: ERROR: db_redis
>>> [redis_connection.c:124]: db_redis_connect(): cannot open connection
>>> to redis://localhost:6379/23: Connection refused
>>> May 11 11:06:36 spce proxy[1840]: ERROR: db_redis
>>> [redis_connection.c:226]: db_redis_new_connection(): Failed to
>>> connect to redis db
>>> May 11 11:06:36 spce proxy[1840]: ERROR: <core> [db.c:319]:
>>> db_do_init2(): could not add connection to the pool
>>> May 11 11:06:36 spce proxy[1840]: ERROR: dialog
>>> [dlg_db_handler.c:146]: init_dlg_db(): Unable to connect to the database
>>> May 11 11:06:36 spce proxy[1840]: ERROR: dialog [dialog.c:688]:
>>> mod_init(): failed to initialize the DB support
>>> May 11 11:06:36 spce proxy[1840]: ERROR: <core>
>>> [core/sr_module.c:990]: init_mod(): Error while initializing module
>>> dialog (/usr/lib/x86_64-linux-gnu/kamailio/modules/dialog.so)
>>> It looks like dependencies on redis are still not all defined in systemd.
>>> As I search through the configuration only SEMS and prosody seems to
>>> have a defined dependency

Alex Lutay

More information about the Spce-user mailing list