radiusclient thread-safety
Alex Massover
alex at jajah.com
Tue Mar 2 09:16:05 CET 2010
Hi,
Here're more updated results:
a) with rc_handle per thread it segfaults on the first call to rc_auth(). Please see below.
b) with static rc_handle it works for single calls but fails on heavy multithreading:
#0 0xb6122b42 in rc_get_ipaddr () from /usr/lib/libfreeradius-client.so.2
(gdb) bt
#0 0xb6122b42 in rc_get_ipaddr () from /usr/lib/libfreeradius-client.so.2
#1 0xb61211dc in rc_find_server () from /usr/lib/libfreeradius-client.so.2
#2 0xb611d119 in rc_send_server () from /usr/lib/libfreeradius-client.so.2
#3 0xb611bc32 in rc_aaa () from /usr/lib/libfreeradius-client.so.2
#4 0xb611bec4 in rc_auth () from /usr/lib/libfreeradius-client.so.2
#5 0xb61354ea in sendrad_exec_generic (chan=0xa896d0a0, data=<value optimized out>, type=0)
at app_sendradevent.c:214
#6 0x080f67c7 in pbx_exec ()
#7 0x080f76d0 in ?? ()
#8 0x080f933f in ?? ()
#9 0x080fa5f0 in ?? ()
#10 0x081346fb in ?? ()
#11 0xb73f6585 in start_thread () from /lib/i686/cmov/libpthread.so.0
#12 0xb761927e in clone () from /lib/i686/cmov/libc.so.6
Also regardless of rc_handle the lib has a lot of non-reentrant functions (inet_ntoa, localtime, gmtime, random, rand...). Does it supposed to be thread-safe even if there's no logical issue with rc_handle?
> -----Original Message-----
> From: freeradius-devel-bounces+alex=jajah.com at lists.freeradius.org
> [mailto:freeradius-devel-bounces+alex=jajah.com at lists.freeradius.org]
> On Behalf Of Alex Massover
> Sent: יום ב 01 מרץ 2010 15:37
> To: FreeRadius developers mailing list
> Subject: RE: radiusclient thread-safety
>
> Hmmm.. Sorry again. This is not result of wrong configs. This is what I
> get when I do rc_handle per thread:
>
> rc_handle *rh;
> if ((rh = rc_read_config(RC_CONFIG_FILE)) == NULL) { ... }
> if (rc_read_dictionary(rh, rc_conf_str(rh, "dictionary")) != 0) {...}
> [...build send avpair...]
> rc_auth();
>
> If I have a static rc_handle and call rc_read_config() and
> rc_read_dictionary() in parent there's no such problem.
>
> I'm even able to call rc_avpiar_log() just before rc_auth() and get
> correct dump of my avpiar.
>
>
> > -----Original Message-----
> > From: freeradius-devel-bounces+alex=jajah.com at lists.freeradius.org
> > [mailto:freeradius-devel-bounces+alex=jajah.com at lists.freeradius.org]
> > On Behalf Of Alex Massover
> > Sent: יום ב 01 מרץ 2010 14:01
> > To: FreeRadius developers mailing list
> > Subject: RE: radiusclient thread-safety
> >
> > Sorry, please ignore, I overwrote configs by mistake.
> >
> > > -----Original Message-----
> > > From: freeradius-devel-bounces+alex=jajah.com at lists.freeradius.org
> > > [mailto:freeradius-devel-
> bounces+alex=jajah.com at lists.freeradius.org]
> > > On Behalf Of Alex Massover
> > > Sent: יום ב 01 מרץ 2010 13:51
> > > To: FreeRadius developers mailing list
> > > Subject: RE: radiusclient thread-safety
> > >
> > > Hi,
> > >
> > > Here's what I get with latest code from CVS:
> > >
> > > Program terminated with signal 11, Segmentation fault.
> > > #0 0xb762fd19 in strncpy () from /lib/i686/cmov/libc.so.6
> > > (gdb) bt
> > > #0 0xb762fd19 in strncpy () from /lib/i686/cmov/libc.so.6
> > > #1 0xb61540f0 in rc_send_server () from /usr/lib/libfreeradius-
> > > client.so.2
> > > #2 0xb6152c32 in rc_aaa () from /usr/lib/libfreeradius-client.so.2
> > > #3 0xb6152ec4 in rc_auth () from /usr/lib/libfreeradius-
> client.so.2
> > > #4 0xb616c52f in sendrad_exec_generic (chan=0x9477088,
> > > data=<value optimized out>, type=0) at app_sendradevent.c:212
> > > #5 0x080f67c7 in pbx_exec ()
> > > #6 0x080f76d0 in ?? ()
> > > #7 0x080f933f in ?? ()
> > > #8 0x080fa5f0 in ?? ()
> > > #9 0x081346fb in ?? ()
> > > #10 0xb7468585 in start_thread () from
> /lib/i686/cmov/libpthread.so.0
> > > #11 0xb768b27e in clone () from /lib/i686/cmov/libc.so.6
> > > (gdb) quit
> > >
> > > And the strange thing is that sometimes (rarely) it works, exactly
> > the
> > > same code.
> > >
> > > Compiled with CFLAGS="-pthread -D_REENTRANT -fstack-protector-all"
> > >
> > >
> > >
> > > Or
> > >
> > > #0 0xb75f19cb in strlen () from /lib/i686/cmov/libc.so.6
> > > (gdb) bt
> > > #0 0xb75f19cb in strlen () from /lib/i686/cmov/libc.so.6
> > > #1 0xb601a417 in rc_find_server () from /usr/lib/libfreeradius-
> > > client.so.2
> > > #2 0xb6016119 in rc_send_server () from /usr/lib/libfreeradius-
> > > client.so.2
> > > #3 0xb6014c32 in rc_aaa () from /usr/lib/libfreeradius-client.so.2
> > > #4 0xb6014ec4 in rc_auth () from /usr/lib/libfreeradius-
> client.so.2
> > > #5 0xb602e52f in sendrad_exec_generic (chan=0x8a96e70,
> > > data=<value optimized out>, type=0) at app_sendradevent.c:212
> > > #6 0x080f67c7 in pbx_exec ()
> > > #7 0x080f76d0 in ?? ()
> > > #8 0x080f933f in ?? ()
> > > #9 0x080fa5f0 in ?? ()
> > > #10 0x081346fb in ?? ()
> > > #11 0xb742a585 in start_thread () from
> /lib/i686/cmov/libpthread.so.0
> > > #12 0xb764d27e in clone () from /lib/i686/cmov/libc.so.6
> > >
> > > > -----Original Message-----
> > > > From: freeradius-devel-
> bounces+alex=jajah.com at lists.freeradius.org
> > > > [mailto:freeradius-devel-
> > bounces+alex=jajah.com at lists.freeradius.org]
> > > > On Behalf Of Alan DeKok
> > > > Sent: יום א 28 פברואר 2010 13:56
> > > > To: FreeRadius developers mailing list
> > > > Subject: Re: radiusclient thread-safety
> > > >
> > > > Alex Massover wrote:
> > > > > Hi,
> > > > >
> > > > > I use radiusclient-ng code base, but freeradiusclient has
> exactly
> > > the
> > > > same code, at least the latest release downloaded from here:
> > > > >
> > > > > ftp://ftp.freeradius.org/pub/freeradius/freeradius-client-
> > > > 1.1.6.tar.bz2
> > > > >
> > > > > It's in lib/sendserver.c line 322 (there's only one FD_ISSET)
> > > >
> > > > OK. Then try grabbing the latest version from CVS. It has a
> > > number
> > > > of fixes.
> > > >
> > > > http://freeradius.org/development.html#cvs
> > > >
> > > > Alan DeKok.
> > > > -
> > > > List info/subscribe/unsubscribe? See
> > > > http://www.freeradius.org/list/devel.html
> > > >
> > > > This mail was received via Mail-SeCure System.
> > > >
> > >
> > >
> > > This mail was sent via Mail-SeCure System.
> > >
> > >
> > >
> > > -
> > > List info/subscribe/unsubscribe? See
> > > http://www.freeradius.org/list/devel.html
> > > This mail was received via Mail-SeCure System.
> >
> > This mail was sent via Mail-SeCure System.
> >
> >
> >
> > -
> > List info/subscribe/unsubscribe? See
> > http://www.freeradius.org/list/devel.html
> > This mail was received via Mail-SeCure System.
>
> This mail was sent via Mail-SeCure System.
>
>
>
> -
> List info/subscribe/unsubscribe? See
> http://www.freeradius.org/list/devel.html
> This mail was received via Mail-SeCure System.
This mail was sent via Mail-SeCure System.
More information about the Freeradius-Devel
mailing list