On 16/12/14 11:38, Øyvind Kolbu wrote:

On 16.12.2014 10:44, Daniel-Constantin Mierla wrote:
The question would be more specific to the error message printed from postgres client library:

FATAL:  no pg_hba.conf entry for host "129.240.1.1", user "foo_test_user", database " foo_test", SSL off
The issue here is why suddenly SSL when attempting to connect. When not loading the TLS module this
does not happen. I've not been able to reorder any modules in order for it to succeed.

Is it something that is documented somewhere or maybe some web search can indicate the reasons why it happens?

Can you try loading tls module before db_postgres?
One thing which works sometimes is to increase the debuglevel to 5 and also set
memdbg=5 and memlog=5. The massive logging causes extra startup delay.
Maybe a TLS settings race? Non threadsafe interaction with libssl?

TLS module initializes libssl when it is loaded. db_postgress creates connections at mod init, so it is later and inside same process (no fork at that moment).

Based on the new details, I understand that some connections succeed, some not, and even sometimes all connection succeed (when having lot of log messages that add delay). What is the operating system you have? Is selinux enabled? You can try to play with fork_delay and modinit_delay core parameters:

- http://www.kamailio.org/wiki/cookbooks/4.2.x/core#fork_delay

Cheers,
Daniel

-- 
Daniel-Constantin Mierla
http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda