[asterisk-dev] cdr_radius.c thread safety
Alex Massover
alex at jajah.com
Mon Feb 1 03:21:07 CST 2010
Hi,
As far as I understand there're two libs (fork). One is a part of FreeRADIUS and another is radiusclient-ng hosted at Berlios - http://developer.berlios.de/projects/radiusclient-ng/.
cdr_radius.c uses radiusclient-ng. The latest version of radiusclient-ng is 0.5.6 and it uses non-reentrant versions of gethotby network functions and shared buffer(s).
I found this in a hard way, because I'm also using radiusclient-ng and went into troubles with threads (not related to Asterisk). But I'm also writing a module for Asterisk that suppose to provide generic API to build custom radius requests and also uses radiusclient-ng.
So I was curious about how cdr_radius.c deals with it.
I looked now into freeradius-client lib version 1.1.6. And indeed gethotby functions are wrapped with reentrant versions, but rc_avpair_log() is still using shared buffer.
Fortunately cdr_radius.c doesn't use rc_avpair_log() function ;)
Freeradius wiki states that radiusclient-ng is discontinued in favor of freeradius-client.
So what do you think about switching cdr_radius.c to freeradius-client?
I'll probably also switch from radiusclient-ng to freeradius-client and will send patches to FreeRADIUS. I have some performance patches and thread-safe version of rc_avpair_log().
-----Original Message-----
From: asterisk-dev-bounces at lists.digium.com [mailto:asterisk-dev-bounces at lists.digium.com] On Behalf Of Tilghman Lesher
Sent: יום ב 01 פברואר 2010 03:13
To: Asterisk Developers Mailing List
Subject: Re: [asterisk-dev] cdr_radius.c thread safety
On Sunday 31 January 2010 05:39:30 Alex Massover wrote:
> I'm trying to understand if there's thread safety problem with cdr_radius
> module. I'm pretty new to Asterisk internals, so please correct me if I
> misunderstand something.
>
> AFAIU, cdr_radius.c load_module() called once upon loading the module, and
> it exports radius_log() function. Each call opens a thread, so radius_log()
> can be called from different threads and should be thread-safe.
>
> But the radiusclient-ng lib, the module uses, is neither thread-safe nor
> reentrant.
>
> Is it a potential problem or I just miss something?
It might be a potential problem, if the function that calls the backend
function did not serialize all requests. However, I'm curious as to what
resource you've cited as to the thread-safety of the library, as the history
of the FreeRADIUS library tends to suggest the opposite: that radiusclient-ng
is not only threadsafe, but also reentrant.
See http://wiki.freeradius.org/Radiusclient#History
--
Tilghman Lesher
Digium, Inc. | Senior Software Developer
twitter: Corydon76 | IRC: Corydon76-dig (Freenode)
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
asterisk-dev mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-dev
This mail was received via Mail-SeCure System.
This mail was sent via Mail-SeCure System.
More information about the asterisk-dev
mailing list