]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: threads: Don't start when device a detection module is used
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 25 Oct 2017 15:23:02 +0000 (17:23 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 12:58:33 +0000 (13:58 +0100)
For now, we don't know if device detection modules (51degrees, deviceatlas and
wurfl) are thread-safe or not. So HAproxy exits with an error when you try to
use one of them with nbthread greater than 1.

We will ask to maintainers of these modules to make them thread-safe or to give
us hints to do so.

src/51d.c
src/da.c
src/wurfl.c

index 1f1a5f9690a5810fd6008f844fae95798f2f0aba..baeb2c277bd3bfe13b3d1e68e678cd00c146c2e3 100644 (file)
--- a/src/51d.c
+++ b/src/51d.c
@@ -547,6 +547,11 @@ static int init_51degrees(void)
        if (!global_51degrees.data_file_path)
                return 0;
 
+       if (global.nbthread > 1) {
+               Alert("51Degrees: multithreading is not supported for now.\n");
+               return (ERR_FATAL | ERR_ALERT);
+       }
+
        if (!LIST_ISEMPTY(&global_51degrees.property_names)) {
                i = 0;
                list_for_each_entry(name, &global_51degrees.property_names, list)
index 856ef0dadef46c364e6e2840fadbde38e5221d6c..c31855d52f635523bad1a589383d99f56c60c163 100644 (file)
--- a/src/da.c
+++ b/src/da.c
@@ -121,6 +121,12 @@ static int init_deviceatlas(void)
                size_t atlasimglen;
                da_status_t status;
 
+               if (global.nbthread > 1) {
+                       Alert("deviceatlas: multithreading is not supported for now.\n");
+                       err_code |= ERR_ALERT | ERR_FATAL;
+                       goto out;
+               }
+
                jsonp = fopen(global_deviceatlas.jsonpath, "r");
                if (jsonp == 0) {
                        Alert("deviceatlas : '%s' json file has invalid path or is not readable.\n",
index 5bd9a0c5a098d3bb1a754dd7121b26ebe58136a6..0349a50f9967101efeab18bd9ce8e3a0f538f798 100644 (file)
@@ -313,6 +313,11 @@ static int ha_wurfl_init(void)
                return ERR_WARN;
        }
 
+       if (global.nbthread > 1) {
+               Alert("WURFL: multithreading is not supported for now.\n");
+               return (ERR_FATAL | ERR_ALERT);
+       }
+
        if (wurfl_set_root(global_wurfl.handle, global_wurfl.data_file) != WURFL_OK) {
                Warning("WURFL: Engine setting root file failed - %s\n", wurfl_get_error_message(global_wurfl.handle));
                send_log(NULL, LOG_WARNING, "WURFL: Engine setting root file failed - %s\n", wurfl_get_error_message(global_wurfl.handle));