Hi,

it seems that siptrace module doesn’t close db connections.

I’m on Kamailio 5.1.4 from official debian stretch repository with postgresql db module enabled.
siptrace config:
modparam("siptrace", "db_url", DBURL)
modparam("siptrace", "duplicate_uri", "sip:193.32.51.189:9060")
modparam("siptrace", "hep_mode_on", 1)
modparam("siptrace", "hep_version", 3)
modparam("siptrace", "hep_capture_id", 1001)
modparam("siptrace", "trace_mode", 1)

Here you can see the open connections from the kamailio host:

# select client_addr, state, query from pg_stat_activity where client_addr = '10.23.101.61';
 client_addr  | state |                             query                              
--------------+-------+----------------------------------------------------------------
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
 10.23.101.61 | idle  | select table_version from version where table_name='sip_trace'
(31 Zeilen)


another example, other installation with same kamailio version 5.1.4:

# select client_addr, state, query from pg_stat_activity where client_addr = '10.23.102.1';
 client_addr | state |                             query                              
-------------+-------+----------------------------------------------------------------
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
 10.23.102.1 | idle  | select table_version from version where table_name='sip_trace'
(39 Zeilen)


Thanks Roman