From c3564af9cf24176bca2f9882beabd95225e483c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Canna=C3=B2?= Date: Sun, 22 Mar 2026 16:11:59 +0100 Subject: [PATCH] Fix timeout_ms validation and write path section name consistency 1. Validate timeout_ms against the CHECK constraint (100..100000000) and skip routes with invalid or missing values with an error message. Previously, omitting timeout_ms defaulted to 0, which silently failed the SQLite CHECK constraint and dropped the route. 2. Update Write_Restapi_to_configfile to emit 'restapi_routes:' instead of 'restapi:' so save-then-reload cycles use the preferred section name consistently. --- lib/ProxySQL_Config.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ProxySQL_Config.cpp b/lib/ProxySQL_Config.cpp index d4dcc6cac..08b3e4b18 100644 --- a/lib/ProxySQL_Config.cpp +++ b/lib/ProxySQL_Config.cpp @@ -414,7 +414,7 @@ int ProxySQL_Config::Write_Restapi_to_configfile(std::string& data) { return -1; } else { if (sqlite_resultset) { - data += "restapi:\n(\n"; + data += "restapi_routes:\n(\n"; bool isNext = false; for (auto r : sqlite_resultset->rows) { if (isNext) @@ -478,6 +478,10 @@ int ProxySQL_Config::Read_Restapi_from_configfile() { if (route.lookupValue("interval_ms", timeout_ms) == false) { route.lookupValue("timeout_ms", timeout_ms); } + if (timeout_ms < 100 || timeout_ms > 100000000) { + proxy_error("Admin: detected a restapi route in config file with invalid or missing timeout_ms (must be 100..100000000, got %d)\n", timeout_ms); + continue; + } if (route.lookupValue("method", method)==false) { proxy_error("Admin: detected a restapi route in config file without a mandatory method\n"); continue;