[Freeswitch-users] freeswitch segfault in mod_cdr_pg_csv
Matthew Grooms
matthew at brightfire.net
Mon Aug 15 19:49:38 UTC 2022
Hey Everyone,
I've been seeing freeswitch crash a bit in production recently and
finally had a chance to look into the issue. Appears to be coming from
mod_cdr_pg_csv ...
$ /usr/local/freeswitch/bin/fs_cli -x "version"
FreeSWITCH Version 1.10.7-release~64bit ( 64bit)
2022-08-15 12:00:02.033897 64.60% [CRIT] mod_cdr_pg_csv.c:274 INSERT
command failed: connection not open
Program terminated with signal SIGABRT, Aborted.
#0 0x00007f0ec45cfa9f in raise () from /lib64/libc.so.6
[Current thread is 1 (Thread 0x7f0db4adc700 (LWP 1203217))]
Missing separate debuginfos, use: ...
(gdb) bt
#0 0x00007f0ec45cfa9f in raise () from /lib64/libc.so.6
#1 0x00007f0ec45a2e05 in abort () from /lib64/libc.so.6
#2 0x00007f0ec4612037 in __libc_message () from /lib64/libc.so.6
#3 0x00007f0ec461919c in malloc_printerr () from /lib64/libc.so.6
#4 0x00007f0ec461af40 in _int_free () from /lib64/libc.so.6
#5 0x00007f0ec7248936 in freePGconn () from /lib64/libpq.so.5
#6 0x00007f0eba7ec8d0 in insert_cdr (
values=0x7f0dd41cd4a0
11:59:32',null,'2022-08-15
12:00:02',30,0,'NO_ANSWER','6fd81787-c290-430d-b67b-ebfafe9f29d5',null,null,'PCMU','PCMU','se"...)
at mod_cdr_pg_csv.c:289
#7 my_on_reporting (session=0x7f0df80b1668) at mod_cdr_pg_csv.c:385
#8 0x00007f0ec75221cd in switch_core_session_reporting_state
(session=session at entry=0x7f0df80b1668) at
src/switch_core_state_machine.c:932
#9 0x00007f0ec7522b68 in switch_core_session_run
(session=0x7f0df80b1668) at src/switch_core_state_machine.c:606
#10 0x00007f0ec751d1be in switch_core_session_thread (thread=<optimized
out>, obj=0x7f0df80b1668) at src/switch_core_session.c:1736
#11 0x00007f0ec751891b in switch_core_session_thread_pool_worker
(thread=0x7f0dc8759bd0, obj=<optimized out>) at
src/switch_core_session.c:1800
#12 0x00007f0ec786658c in dummy_worker (opaque=0x7f0dc8759bd0) at
threadproc/unix/thread.c:151
#13 0x00007f0ec50cb1cf in start_thread () from /lib64/libpthread.so.0
#14 0x00007f0ec45badd3 in clone () from /lib64/libc.so.6
(gdb) frame 6
#6 0x00007f0eba7ec8d0 in insert_cdr (
values=0x7f0dd41cd4a0
289 PQfinish(globals.db_connection);
I'm going to try this in production unless someone else has a better
idea on how to fix this ...
--- mod_cdr_pg_csv.c.orig 2022-08-15 14:44:56.028404623 -0500
+++ mod_cdr_pg_csv.c 2022-08-15 14:45:55.122482570 -0500
@@ -286,7 +286,9 @@
error:
- PQfinish(globals.db_connection);
+ if (PQstatus(globals.db_connection) == CONNECTION_OK) {
+ PQfinish(globals.db_connection);
+ }
globals.db_online = 0;
switch_mutex_unlock(globals.db_mutex);
Thanks,
-Matthew
More information about the FreeSWITCH-users
mailing list