thread_pool_addrequest()

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

thread_pool_addrequest()

Joe Maimon
returns if it cannot spawn a thread per each request.

It returns before adding the request to the queue.

Does that mean the server will ignore requests if it cannot spawn a
thread at the time of arrival?

If so, wouldnt it be better to queue it and hope for the availability of
threads in the near future?

Something like this thread_pool_addrequest()

    while ((thread_pool.total_threads - thread_pool.active_threads) <
lrad_hash_table_num_elements(thread_pool.queue)) {
                 if (spawn_thread(request->timestamp) == NULL) {
                         radlog(L_INFO,
                                "The maximum number of threads (%d) are
active, cannot spawn new thread to handle request",
                                thread_pool.max_threads);
                         break;
                 }
         }


-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html
Reply | Threaded
Open this post in threaded view
|

Re: thread_pool_addrequest()

Alan DeKok
Joe Maimon <[hidden email]> wrote:
> Does that mean the server will ignore requests if it cannot spawn a
> thread at the time of arrival?

  Tes.

> If so, wouldnt it be better to queue it and hope for the availability of
> threads in the near future?

  Yes.

> Something like this thread_pool_addrequest()

  No, just move the "request_enqueue" code to before the "spawn
thread" checks.

  I'll commit a fix to CVS.

  Alan DeKok.

-
List info/subscribe/unsubscribe? See http://www.freeradius.org/list/devel.html