MINOR: threads: Don't start when device a detection module is used

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.
This commit is contained in:
Christopher Faulet 2017-10-25 17:23:02 +02:00 committed by Willy Tarreau
parent 9f0b458525
commit e8ca434074
3 changed files with 16 additions and 0 deletions

View File

@ -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)

View File

@ -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",

View 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));