[syslog-ng] [Bug 142] --worker-threads=0 support

bugzilla at bugzilla.balabit.com bugzilla at bugzilla.balabit.com
Sun Oct 30 05:48:24 CET 2011


https://bugzilla.balabit.com/show_bug.cgi?id=142





--- Comment #1 from Balazs Scheidler <bazsi at balabit.hu>  2011-10-30 05:48:23 ---


hmm... this patch against the bundled ivykis should do the trick:

$ git diff
diff --git a/modules/iv_work.c b/modules/iv_work.c
index e941745..e034fb1 100644
--- a/modules/iv_work.c
+++ b/modules/iv_work.c
@@ -334,7 +334,7 @@ iv_work_pool_submit_work(struct iv_work_pool *this, struct iv_work_item *work)
                                   struct work_pool_thread, list);
                thr->kicked = 1;
                iv_event_post(&thr->kick);
-       } else if (pool->started_threads < this->max_threads) {
+       } else if (!this->max_threads || pool->started_threads < this->max_threads) {
                iv_work_start_thread(pool);
        }


Can you check if it is indeed ok?

What it does is if max_threads is set to 0, it'll allow the creation of threads undefinitely. This one is needed against the syslog-ng core:

diff --git a/lib/mainloop.c b/lib/mainloop.c
index f092536..681148b 100644
--- a/lib/mainloop.c
+++ b/lib/mainloop.c
@@ -292,6 +292,7 @@ main_loop_io_worker_thread_start(void *cookie)
    * since the ID map is stored in a single 64 bit integer.  If we ever need
    * more threads than that, we can generalize this algorithm further. */

+  main_loop_io_worker_id = 0;
   for (id = 0; id < main_loop_io_workers.max_threads; id++)
     {
       if ((main_loop_io_workers_idmap & (1 << id)) == 0)
@@ -311,8 +312,11 @@ main_loop_io_worker_thread_stop(void *cookie)
 {
   g_static_mutex_lock(&main_loop_io_workers_idmap_lock);
   dns_cache_destroy();
-  main_loop_io_workers_idmap &= ~(1 << (main_loop_io_worker_id - 1));
-  main_loop_io_worker_id = 0;
+  if (main_loop_worker_id)
+    {
+      main_loop_io_workers_idmap &= ~(1 << (main_loop_io_worker_id - 1));
+      main_loop_io_worker_id = 0;
+    }
   g_static_mutex_unlock(&main_loop_io_workers_idmap_lock);
 }

Threads above 64 will not scale very well in the log_queue_fifo_push_tail() function call, as they don't get a unique ID for per-thread structures.

I'd appreciate some testing if this works out for you.
Thanks.


-- 
Configure bugmail: https://bugzilla.balabit.com/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the syslog-ng mailing list