#138 Crash with db_postgresql and no db connection

1.5.x
closed-out-of-date
modules (454)
5
2009-05-11
2009-05-05
Anonymous
No

Opensips with usrloc and db_postgresql will crash if the db server is unreachable.

Scenario is the following, I have a remote postgres DB server, and had not opened the PG port on the firewall, which causes opensips to be unable to reach the DB server.
on init, opensips times out trying to connect to the DB, and then crash, looking at the logs, it seems to be usrloc module related.

It's easy to reproduce, I can provide as many tracks as needed.

If you need me bogdan, ask on irc ( Gled ).

bt:
#0 0x0000000000425f36 in handle_sigs () at main.c:486
486 if (pt[i].pid==chld) break;

#0 0x0000000000425f36 in handle_sigs () at main.c:486
#1 <signal handler called>
#2 0x00000030e6ae0cb7 in munmap () from /lib64/libc.so.6
#3 0x00000000004a4804 in shm_mem_destroy () at mem/shm_mem.c:238
#4 0x00000000004259a6 in cleanup (show_status=0) at main.c:365
#5 0x0000000000428560 in main (argc=<value optimized out>, argv=0x20) at main.c:1324

bt full:
#0 0x0000000000425f36 in handle_sigs () at main.c:486
chld = 1909
chld_status = 0
i = <value optimized out>
do_exit = 0
__FUNCTION__ = "handle_sigs"
#1 <signal handler called>
No symbol table info available.
#2 0x00000030e6ae0cb7 in munmap () from /lib64/libc.so.6
No symbol table info available.
#3 0x00000000004a4804 in shm_mem_destroy () at mem/shm_mem.c:238
__FUNCTION__ = "shm_mem_destroy"
#4 0x00000000004259a6 in cleanup (show_status=0) at main.c:365
No locals.
#5 0x0000000000428560 in main (argc=<value optimized out>, argv=0x20) at main.c:1324
cfg_log_stderr = 1906
cfg_stream = (FILE *) 0x772
c = <value optimized out>
r = 1
tmp = 0x4ffe65 "H\205ít\0341Û\017\037@"
tmp_len = <value optimized out>
port = <value optimized out>
proto = <value optimized out>
ret = -1
seed = 2320449269
rfd = <value optimized out>
__FUNCTION__ = "main"

Discussion

    • assigned_to: nobody --> bogdan_iancu
     
  • Hi Gled,

    I tried to reproduce this bug by configuring the usrloc module to use a postgres DB. I put the URL to point to a bogus IP as I have no postgres server and because actually the scenario is about unreachable DB server....

    But I got :
    May 9 11:27:07 [2171] DBG:db_postgres:db_postgres_new_connection: PQsetdbLogin(0x82b9770)
    May 9 11:27:07 [2171] ERROR:db_postgres:db_postgres_new_connection: could not connect to server: Connection timed out
    Is the server running on host "192.168.1.254" and accepting
    TCP/IP connections on port 5432?

    May 9 11:27:07 [2171] ERROR:db_postgres:db_postgres_new_connection: cleaning up 0x81b1998=pkg_free()

    and a normal shutdown...

    Regards,
    Bogdan

     
  • Morning Bogdan,

    seems like it's fixed in r5678 of branch 1.5, tried again this morning and I see like you a normal shutdown...

    You must have fixed this fixing something else ;)

    Regards,

    Gled

     
    • status: open --> closed-out-of-date
     
  • OK - good to know :)

    Best regards,
    Bogdan