Stefan Winter stefan.winter at
Fri Oct 12 10:26:54 CEST 2012


I believe this has been reported earlier and it's not very grave, but

When shutting down the server normally, it will almost cleanly shut
down, including "Exiting normally" in the logs, but will generate a
SIGSEGV after that.

So, something in the terminal cleanup seems wrong. It's not a big
deal usually, because after all the process is going to die anyway.

However, now with systemd, things are slightly different. systemd
will watch over the return code of any PID under its responsibility
and memorizes these return codes for later debugging by the admin.

So these days, I'd appreciate if even during shutdown time, things
are "clean".

I looked through the shutdown in radiusd.c main() and spotted - I 
believe - two spots where things go wrong:

- rcode is derived from a function, and can be an arbitrary number;
and the process in the end returns rcode - 1. On failures it gets
set to 2 (i.e. return 1) but on normal shutdown, it doesn't get set.

I "fixed" the situation by adding a "rcode = 1" right after the 
"Exiting normally." This ensures that the process returns 0 once it
gets to its return statement.

- It never gets there; the SIGSEGV on my system is generated during
the call to free_mainconfig(). Once comment that line out, I get a
clean shutdown.

I'm not sure this is a sane approach, it's rather a brute fix with
the axe. Anyway, trivial patch below.

--- freeradius-server-2.2.0/src/main/radiusd.c  2012-09-10 13:51:34.000000000 +0200
+++ freeradius-server-2.2.0-patched/src/main/radiusd.c  2012-10-12 10:14:02.136026913 +0200
@@ -416,6 +416,7 @@
                rcode = 2;
        } else {
                radlog(L_INFO, "Exiting normally.");
+               rcode = 1;
@@ -448,7 +449,7 @@
         *      Free the configuration items.
-       free_mainconfig();
+       /* free_mainconfig(); */
         *      Detach any modules.


Stefan Winter

Ingenieur de Recherche
Fondation RESTENA - Réseau Téléinformatique de l'Education Nationale et de la Recherche
6, rue Richard Coudenhove-Kalergi
L-1359 Luxembourg

Tel: +352 424409 1
Fax: +352 422473

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 259 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the Freeradius-Devel mailing list