Problems with freeradius 1.1.5 (2.0.0) 20070322 with postgresql (SIGHUP => segmentation fault)

Claudiu Filip claudiu at
Thu Mar 22 19:00:00 CET 2007

Hello freeradius-devel,

      I'm running Freeradius 20070322 snapshot with postgresql
      backend. (I tried older versions too)

      I have 3 questions for you, all related to $subject.

      Everything is working fine (the radius is getting the nas
      clients from the database, doing db auth/acct, etc.) until we
      send a -HUP to the radiusd..

First one:
$ /radius/sbin/radiusd -fsX                            $ killall -HUP radiusd
rlm_sql (sql): Closing sqlsocket 4
rlm_sql (sql): Closing sqlsocket 3
rlm_sql (sql): Closing sqlsocket 2
rlm_sql (sql): Closing sqlsocket 1
rlm_sql (sql): Closing sqlsocket 0
read_config_files:  reading realms
Thu Mar 22 16:21:23 2007 : Info: rlm_sql (sql): Driver rlm_sql_postgresql (module rlm_sql_postgresql) loaded and linked
Thu Mar 22 16:21:23 2007 : Info: rlm_sql (sql): Attempting to connect to radius at
Segmentation fault

No core file..

      I solved this problem by commenting out the "we do other magic"
      in mainconfig.c lines 1059->1064. This will disable debug level
      change on the fly facility, it's not that important anyway

rlm_sql_postgresql: Status: PGRES_TUPLES_OK
rlm_sql_postgresql: query affected rows = 3 , fields = 5
rlm_sql (sql): Read entry nasname=,shortname=nume,secret=secret
rlm_sql (sql): Adding client (nume) to clients list
Segmentation fault (core dumped)

#0  rbtree_insert (tree=0x7d4c4c55, Data=0x80025808) at rbtree.c:246
246             Current = tree->Root;
(gdb) bt
#0  rbtree_insert (tree=0x7d4c4c55, Data=0x80025808) at rbtree.c:246
#1  0x8000685d in client_add (clients=0x800fbb18, client=0x80025808) at client.c:231
#2  0xb7db29ca in rlm_sql_instantiate (conf=0x8012efc8, instance=0x7d4c4c55) at rlm_sql.c:347
#3  0x8000f77c in find_module_instance (modules=0x8012e5e0, instname=0x80130100 "sql") at modules.c:322
#4  0x80010243 in setup_modules (reload=1) at modules.c:917
#5  0x8000ed65 in read_mainconfig (reload=1) at mainconfig.c:1162
#6  0x80012dc0 in main (argc=2, argv=0xbfdb1a34) at radiusd.c:560

    I add
        DEBUG2("OLD: %p",(void *)old_clients);
        DEBUG2("NEW: %p",(void *)clients);
    right before
                mainconfig.clients = clients;
                clients_free(old_clients); in mainparse.c

Start radiusd -fsX
OLD: (nil)
NEW: 0x800fbb18

killall -HUP radiusd:
OLD: 0x800fbb18
NEW: 0x800fbb18
rlm_sql (sql): Adding client (nume) to clients list
Segmentation fault (core dumped)

     So, we free the same location..
     I guess the problem is in the clients_parse_section which doesnt
     return a new address space.
-       if (clients) return clients;
+       if (clients) clients_free(clients);
-        clients_free(old_clients);
+        if ((void *)old_clients != (void *)clients)
+                  clients_free(old_clients);
     solved the problem.
     Do I still need the clients_free(old_clients)?


         There is any other way to make the radius re-reread its
         clients from database, without an expensive HUP (and not so easy
         to send when you add entries to db)?


Thanks for scrolling this down..

Best wishes,

Claudiu FILIP
claudiu at            Phone  : +40344880100         Fax:     +40344880113

More information about the Freeradius-Devel mailing list