question about concurrent auth packet process.

Liu dejun dejun.liu at
Fri Dec 30 02:37:46 CET 2005

In threads.c ,I find the code below
int thread_pool_addrequest(REQUEST *request, RAD_REQUEST_FUNP fun)
     *    Add the new request to the queue.
    if (!request_enqueue(request, fun)) return 0;

     *    If the thread pool is busy handling requests, then
     *    try to spawn another one.
    if (thread_pool.active_threads == thread_pool.total_threads) {
        if (spawn_thread(request->timestamp) == NULL) {
                   "The maximum number of threads (%d) are active, cannot
spawn new thread to handle request",
            return 1;

    return 1;

why not restricted the conditions ,and add the if condition to just if the
total threads exceed  the max threads,if so just add to the thread queue and
return ,if not do the spawn thread function to spawn a new thread .and do
this ,it will reduce many functioin calls is this function,at the same time
it will reduce too much time when too many packets arrived.

is my idea right?
and also in file threads.c,the if condition     if
(thread_pool.total_threads >= thread_pool.max_threads) {
        DEBUG2("Thread spawn failed.  Maximum number of threads (%d) already
running.", thread_pool.max_threads);
        return NULL;
is useless.
tks in advanced?

On 12/30/05, Alan DeKok <aland at> wrote:
> Liu dejun <dejun.liu at> wrote:
> > When lots of concurrent auth packets arrived at radius server .by
> default
> > ,if radius server exceeds the max packet process thread ,it will discard
> the
> > auth packet/
> > see the code below in version 1.0.5
>   This is fixed in 1.1.0.  See the 1.1.0-pre0 source for details.
>   Alan DeKok.
> -
> List info/subscribe/unsubscribe? See

Yesterday is a history.
Tomorrow is a mystery.
Today is a gift.
That's why we call it "the Present".
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Freeradius-Devel mailing list