Hi

The commit 82ab60f4 that added the sysconf call to mklib put it in the wrong 
place - it needs to happen right after set_init_values. Otherwise the lib 
crashes.

- Lauri
>From 930739dc34f528a4c9d6269d0683c7229074eb69 Mon Sep 17 00:00:00 2001
From: Lauri Kasanen <[email protected]>
Date: Mon, 11 Mar 2013 20:31:45 +0200
Subject: [PATCH] lib: Move the workers check to the right place, fixes crash


Signed-off-by: Lauri Kasanen <[email protected]>
---
 src/mk_lib.c |   17 +++++++++--------
 1 files changed, 9 insertions(+), 8 deletions(-)

diff --git a/src/mk_lib.c b/src/mk_lib.c
index 131bd4b..c39bdb1 100644
--- a/src/mk_lib.c
+++ b/src/mk_lib.c
@@ -150,6 +150,15 @@ mklib_ctx mklib_init(const char *address, const unsigned 
int port,
 
     config->serverconf = strdup(MONKEY_PATH_CONF);
     mk_config_set_init_values();
+
+    /*
+     * If the worker numbers have not be set, set the number based on
+     * the number of CPU cores
+     */
+    if (config->workers < 1) {
+        config->workers = sysconf(_SC_NPROCESSORS_ONLN);
+    }
+
     mk_sched_init();
     mk_plugin_init();
 
@@ -208,14 +217,6 @@ mklib_ctx mklib_init(const char *address, const unsigned 
int port,
     config->default_mimetype = mk_string_dup(MIMETYPE_DEFAULT_TYPE);
     mk_mimetype_read_config();
 
-    /*
-     * If the worker numbers have not be set, set the number based on
-     * the number of CPU cores
-     */
-    if (config->workers < 1) {
-        config->workers = sysconf(_SC_NPROCESSORS_ONLN);
-    }
-
     config->worker_capacity = mk_server_worker_capacity(config->workers);
     config->max_load = (config->worker_capacity * config->workers);
 
-- 
1.7.2.1

_______________________________________________
Monkey mailing list
[email protected]
http://lists.monkey-project.com/listinfo/monkey

Reply via email to