diff --git a/Documentation/Getting-Started/Configuration-Guide.md b/Documentation/Getting-Started/Configuration-Guide.md index 3803088eb..a10d8d7fd 100644 --- a/Documentation/Getting-Started/Configuration-Guide.md +++ b/Documentation/Getting-Started/Configuration-Guide.md @@ -923,9 +923,10 @@ MaxScale will at startup load the users from the backend server, but if the authentication of a user fails, MaxScale assumes it is because a new user has been created and will thus refresh the users. By default, MaxScale will do that at most once per 30 seconds and with this configuration option -that can be changed. The minimum allowed value is 10 seconds. A negative +that can be changed. A value of 0 allows infinite refreshes and a negative value disables the refreshing entirelly. Note that using `maxadmin` it is possible to explicitly cause the users of a service to be reloaded. + ``` users_refresh_time=120s ``` @@ -936,6 +937,9 @@ versions a value without a unit may be rejected. Note that since the granularity of the timeout is seconds, a timeout specified in milliseconds will be rejected, even if the duration is longer than a second. +In MaxScale 2.3.9 and older versions, the minimum allowed value was 10 seconds +but, due to a bug, the default value was 0 which allowed infinite refreshes. + ### `retain_last_statements` How many statements MaxScale should store for each session. This is for diff --git a/include/maxscale/service.hh b/include/maxscale/service.hh index 441a76a3f..aa9db74d8 100644 --- a/include/maxscale/service.hh +++ b/include/maxscale/service.hh @@ -77,7 +77,6 @@ inline bool server_ref_is_active(const SERVER_REF* ref) /* Refresh rate limits for load users from database */ #define USERS_REFRESH_TIME_DEFAULT 30 /* Allowed time interval (in seconds) after last update*/ -#define USERS_REFRESH_TIME_MIN 10 /* Minimum allowed time interval (in seconds)*/ /** Default timeout values used by the connections which fetch user authentication data */ #define DEFAULT_AUTH_CONNECT_TIMEOUT 3 diff --git a/maxctrl/package-lock.json b/maxctrl/package-lock.json index 313064867..dca595537 100644 --- a/maxctrl/package-lock.json +++ b/maxctrl/package-lock.json @@ -585,7 +585,7 @@ }, "commander": { "version": "2.15.1", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.15.1.tgz", + "resolved": "http://registry.npmjs.org/commander/-/commander-2.15.1.tgz", "integrity": "sha512-VlfT9F3V0v+jr4yxPc5gg9s62/fIVWsd2Bk2iD435um1NlGMYdVCq+MjcXnhYq2icNOizHr1kK+5TI6H0Hy0ag==", "dev": true }, @@ -1108,6 +1108,7 @@ "version": "4.1.2", "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", + "dev": true, "requires": { "neo-async": "^2.6.0", "optimist": "^0.6.1", @@ -1118,7 +1119,8 @@ "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", - "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==" + "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true } } }, @@ -1672,9 +1674,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "version": "4.17.14", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", + "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==" }, "lodash-getpath": { "version": "0.2.4", @@ -1773,13 +1775,13 @@ }, "minimist": { "version": "0.0.8", - "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", + "resolved": "http://registry.npmjs.org/minimist/-/minimist-0.0.8.tgz", "integrity": "sha1-hX/Kv8M5fSYluCKCYuhqp6ARsF0=" }, "mixin-deep": { - "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", - "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.2.tgz", + "integrity": "sha512-WRoDn//mXBiJ1H40rqa3vH0toePwSsGb45iInWlTySa+Uu4k3tYUSxa2v1KqAiLtvlrSzaExqS1gtk96A9zvEA==", "requires": { "for-in": "^1.0.2", "is-extendable": "^1.0.1" @@ -1797,7 +1799,7 @@ }, "mkdirp": { "version": "0.5.1", - "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", + "resolved": "http://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz", "integrity": "sha1-MAV0OOrGz3+MR2fzhkjWaX11yQM=", "requires": { "minimist": "0.0.8" @@ -1853,7 +1855,8 @@ "neo-async": { "version": "2.6.0", "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.0.tgz", - "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==" + "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==", + "dev": true }, "normalize-package-data": { "version": "2.5.0", @@ -3068,8 +3071,7 @@ }, "mixin-deep": { "version": "1.3.1", - "resolved": "https://registry.npmjs.org/mixin-deep/-/mixin-deep-1.3.1.tgz", - "integrity": "sha512-8ZItLHeEgaqEvd5lYBXfm4EZSFCX29Jb9K+lAHhDKzReKBQKj3R+7NOF6tjqYi9t4oI8VUfaWITJQm86wnXGNQ==", + "resolved": "", "dev": true, "requires": { "for-in": "^1.0.2", @@ -3511,8 +3513,7 @@ }, "set-value": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "resolved": "", "dev": true, "requires": { "extend-shallow": "^2.0.1", @@ -4152,8 +4153,7 @@ }, "union-value": { "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "resolved": "", "dev": true, "requires": { "arr-union": "^3.1.0", @@ -4491,6 +4491,7 @@ "version": "0.6.1", "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", "integrity": "sha1-2j6nRob6IaGaERwybpDrFaAZZoY=", + "dev": true, "requires": { "minimist": "~0.0.1", "wordwrap": "~0.0.2" @@ -4834,9 +4835,9 @@ "integrity": "sha1-BF+XgtARrppoA93TgrJDkrPYkPc=" }, "set-value": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.0.tgz", - "integrity": "sha512-hw0yxk9GT/Hr5yJEYnHNKYXkIA8mVJgd9ditYZCe16ZczcaELYYcfvaXesNACk2O8O0nTiPQcQhGUQj8JLzeeg==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/set-value/-/set-value-2.0.1.tgz", + "integrity": "sha512-JxHc1weCN68wRY0fhCoXpyK55m/XPHafOmK4UWD7m2CI14GMcFypt4w/0+NV5f/ZMby2F6S2wwA7fgynh9gWSw==", "requires": { "extend-shallow": "^2.0.1", "is-extendable": "^0.1.1", @@ -5249,6 +5250,7 @@ "version": "3.5.10", "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.10.tgz", "integrity": "sha512-/GTF0nosyPLbdJBd+AwYiZ+Hu5z8KXWnO0WCGt1BQ/u9Iamhejykqmz5o1OHJ53+VAk6xVxychonnApDjuqGsw==", + "dev": true, "optional": true, "requires": { "commander": "~2.20.0", @@ -5259,46 +5261,27 @@ "version": "2.20.0", "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", + "dev": true, "optional": true }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==", + "dev": true, "optional": true } } }, "union-value": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.0.tgz", - "integrity": "sha1-XHHDTLW61dzr4+oM0IIHulqhrqQ=", + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/union-value/-/union-value-1.0.1.tgz", + "integrity": "sha512-tJfXmxMeWYnczCVs7XAEvIV7ieppALdyepWMkHkwciRpZraG/xwT+s2JN8+pr1+8jCRf80FFzvr+MpQeeoF4Xg==", "requires": { "arr-union": "^3.1.0", "get-value": "^2.0.6", "is-extendable": "^0.1.1", - "set-value": "^0.4.3" - }, - "dependencies": { - "extend-shallow": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/extend-shallow/-/extend-shallow-2.0.1.tgz", - "integrity": "sha1-Ua99YUrZqfYQ6huvu5idaxxWiQ8=", - "requires": { - "is-extendable": "^0.1.0" - } - }, - "set-value": { - "version": "0.4.3", - "resolved": "https://registry.npmjs.org/set-value/-/set-value-0.4.3.tgz", - "integrity": "sha1-fbCPnT0i3H945Trzw79GZuzfzPE=", - "requires": { - "extend-shallow": "^2.0.1", - "is-extendable": "^0.1.1", - "is-plain-object": "^2.0.1", - "to-object-path": "^0.3.0" - } - } + "set-value": "^2.0.1" } }, "unset-value": { @@ -5395,7 +5378,8 @@ "wordwrap": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", - "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=" + "integrity": "sha1-o9XabNXAvAAI03I0u68b7WMFkQc=", + "dev": true }, "wrap-ansi": { "version": "2.1.0", diff --git a/maxctrl/package.json b/maxctrl/package.json index a75acc39b..0b445dc04 100644 --- a/maxctrl/package.json +++ b/maxctrl/package.json @@ -21,7 +21,7 @@ "globby": "^8.0.2", "inquirer": "^6.2.1", "inquirer-command-prompt": "0.0.8", - "lodash": "^4.17.11", + "lodash": "^4.17.14", "lodash-getpath": "^0.2.4", "readline-sync": "^1.4.9", "request": "^2.88.0", diff --git a/maxscale-system-test/cnf/maxscale.cnf.template.mxs922_base b/maxscale-system-test/cnf/maxscale.cnf.template.mxs922_base index 8a8ccd4a6..ad68d5a60 100644 --- a/maxscale-system-test/cnf/maxscale.cnf.template.mxs922_base +++ b/maxscale-system-test/cnf/maxscale.cnf.template.mxs922_base @@ -1,5 +1,6 @@ [maxscale] threads=###threads### +users_refresh_time=0 [rwsplit-service] type=service diff --git a/maxutils/maxbase/src/stacktrace.cc b/maxutils/maxbase/src/stacktrace.cc index b4aa8a49d..7ae7d19dd 100644 --- a/maxutils/maxbase/src/stacktrace.cc +++ b/maxutils/maxbase/src/stacktrace.cc @@ -71,7 +71,7 @@ static void extract_file_and_line(char* symbols, char* cmd, size_t size) const char* symname_start = filename_end + 1; - if (*symname_start != '+') + if (*symname_start != '+' && symname_start != symname_end) { // We have a string form symbol name and an offset, we need to // extract the symbol address @@ -111,6 +111,17 @@ static void extract_file_and_line(char* symbols, char* cmd, size_t size) } else { + if (symname_start == symname_end) + { + // Symbol is of the format `./executable [0xdeadbeef]` + if (!(symname_start = strchr(symname_start, '[')) + || !(symname_end = strchr(symname_start, ']'))) + { + snprintf(cmd, size, "Unexpected symbol format"); + return; + } + } + // Raw offset into library symname_start++; snprintf(symname, sizeof(symname), "%.*s", (int)(symname_end - symname_start), symname_start); @@ -126,13 +137,6 @@ static void extract_file_and_line(char* symbols, char* cmd, size_t size) memmove(cmd, str, strlen(cmd) - (str - cmd) + 1); } - // Strip the directory name from the symbols (could this be useful?) - if (char* str = strrchr(symbols, '/')) - { - ++str; - memmove(symbols, str, strlen(symbols) - (str - symbols) + 1); - } - // Remove the address where the symbol is in memory (i.e. the [0xdeadbeef] that follows the // (main+0xa1) part), we're only interested where it is in the library. if (char* str = strchr(symbols, '[')) diff --git a/server/core/admin.cc b/server/core/admin.cc index fb29a7b25..ae40ef2b0 100644 --- a/server/core/admin.cc +++ b/server/core/admin.cc @@ -371,6 +371,18 @@ static bool load_ssl_certificates() return rval; } +static bool log_daemon_errors = true; + +void admin_log_error(void* arg, const char* fmt, va_list ap) +{ + if (log_daemon_errors) + { + char buf[1024]; + vsnprintf(buf, sizeof(buf), fmt, ap); + MXS_ERROR("HTTP daemon error: %s\n", mxb::trimmed_copy(buf).c_str()); + } +} + bool mxs_admin_init() { struct sockaddr_storage addr; @@ -379,7 +391,7 @@ bool mxs_admin_init() config_get_global_options()->admin_port, &addr)) { - int options = MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY; + int options = MHD_USE_EPOLL_INTERNALLY_LINUX_ONLY | MHD_USE_DEBUG; if (addr.ss_family == AF_INET6) { @@ -393,27 +405,20 @@ bool mxs_admin_init() } // The port argument is ignored and the port in the struct sockaddr is used instead - http_daemon = MHD_start_daemon(options, - 0, - NULL, - NULL, - handle_client, - NULL, - MHD_OPTION_NOTIFY_COMPLETED, - close_client, - NULL, - MHD_OPTION_SOCK_ADDR, - &addr, + http_daemon = MHD_start_daemon(options, 0, NULL, NULL, handle_client, NULL, + MHD_OPTION_EXTERNAL_LOGGER, admin_log_error, NULL, + MHD_OPTION_NOTIFY_COMPLETED, close_client, NULL, + MHD_OPTION_SOCK_ADDR, &addr, !using_ssl ? MHD_OPTION_END : - MHD_OPTION_HTTPS_MEM_KEY, - admin_ssl_key, - MHD_OPTION_HTTPS_MEM_CERT, - admin_ssl_cert, - MHD_OPTION_HTTPS_MEM_TRUST, - admin_ssl_cert, + MHD_OPTION_HTTPS_MEM_KEY, admin_ssl_key, + MHD_OPTION_HTTPS_MEM_CERT, admin_ssl_cert, + MHD_OPTION_HTTPS_MEM_TRUST, admin_ssl_cert, MHD_OPTION_END); } + // Silence all other errors to prevent malformed requests from flooding the log + log_daemon_errors = false; + return http_daemon != NULL; } diff --git a/server/core/config.cc b/server/core/config.cc index 6c593c45d..3a74257a6 100644 --- a/server/core/config.cc +++ b/server/core/config.cc @@ -2648,16 +2648,6 @@ static int handle_global_item(const char* name, const char* value) return 0; } - if (users_refresh_time < USERS_REFRESH_TIME_MIN) - { - MXS_WARNING("%s is less than the allowed minimum value of %d for the " - "configuration option '%s', using the minimum value.", - value, - USERS_REFRESH_TIME_MIN, - CN_USERS_REFRESH_TIME); - users_refresh_time = USERS_REFRESH_TIME_MIN; - } - if (users_refresh_time > INT32_MAX) { // To ensure that there will be no overflows when @@ -3856,11 +3846,11 @@ int create_new_service(CONFIG_CONTEXT* obj) config_add_defaults(obj, config_service_params); config_add_defaults(obj, module->parameters); + int error_count = 0; Service* service = service_alloc(obj->name(), router.c_str(), &obj->m_parameters); if (service) { - int error_count = 0; if (!servers.empty()) { @@ -3913,9 +3903,10 @@ int create_new_service(CONFIG_CONTEXT* obj) else { MXS_ERROR("Service '%s' creation failed.", obj->name()); + error_count++; } - return service ? 0 : 1; + return error_count; } /** diff --git a/server/core/test/rest-api/package-lock.json b/server/core/test/rest-api/package-lock.json index 8bff368b0..6425db762 100644 --- a/server/core/test/rest-api/package-lock.json +++ b/server/core/test/rest-api/package-lock.json @@ -365,9 +365,9 @@ } }, "lodash": { - "version": "4.17.11", - "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.11.tgz", - "integrity": "sha512-cQKh8igo5QUhZ7lg38DYWAxMvjSAKG0A8wGSVimP07SIUEK2UO+arSRKbRZWtelMtN5V0Hkwh5ryOto/SshYIg==" + "version": "4.17.14", + "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.14.tgz", + "integrity": "sha512-mmKYbW3GLuJeX+iGP+Y7Gp1AiGHGbXHCOh/jZmrawMmsE7MS4znI3RL2FsjbqOyMayHInjOeykW7PEajUk1/xw==" }, "mime-db": { "version": "1.37.0", diff --git a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc index 3c2b8da0c..27754cc7e 100644 --- a/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc +++ b/server/modules/protocol/MySQL/mariadbbackend/mysql_backend.cc @@ -905,6 +905,7 @@ static int gw_read_and_write(DCB* dcb) if (auth_change_requested(read_buffer) && handle_auth_change_response(read_buffer, proto, dcb)) { + gwbuf_free(read_buffer); return 0; } else diff --git a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc index 561a2a76c..735f4c614 100644 --- a/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc +++ b/server/modules/routing/readwritesplit/rwsplit_route_stmt.cc @@ -831,18 +831,17 @@ RWBackend* RWSplitSession::handle_slave_is_target(uint8_t cmd, uint32_t stmt_id) if (it->second->in_use()) { target = it->second; - MXS_INFO("COM_STMT_FETCH on %s", target->name()); + MXS_INFO("%s on %s", STRPACKETTYPE(cmd), target->name()); } else { MXS_ERROR("Old COM_STMT_EXECUTE target %s not in use, cannot " - "proceed with COM_STMT_FETCH", - it->second->name()); + "proceed with %s", it->second->name(), STRPACKETTYPE(cmd)); } } else { - MXS_WARNING("Unknown statement ID %u used in COM_STMT_FETCH", stmt_id); + MXS_WARNING("Unknown statement ID %u used in %s", stmt_id, STRPACKETTYPE(cmd)); } } else @@ -1226,13 +1225,14 @@ bool RWSplitSession::handle_got_target(GWBUF* querybuf, RWBackend* target, bool MXS_ERROR("Routing query failed."); } - if (success && cmd == MXS_COM_STMT_EXECUTE && !is_locked_to_master()) + if (success && !is_locked_to_master() + && (cmd == MXS_COM_STMT_EXECUTE || cmd == MXS_COM_STMT_SEND_LONG_DATA)) { /** Track the targets of the COM_STMT_EXECUTE statements. This * information is used to route all COM_STMT_FETCH commands * to the same server where the COM_STMT_EXECUTE was done. */ m_exec_map[m_qc.current_route_info().stmt_id()] = target; - MXS_INFO("COM_STMT_EXECUTE on %s: %s", target->name(), target->uri()); + MXS_INFO("%s on %s: %s", STRPACKETTYPE(cmd), target->name(), target->uri()); } return success;