From 2aa814d117d876de35adccb874c3a38a8c4153de Mon Sep 17 00:00:00 2001 From: George Alexiou Date: Wed, 7 Feb 2024 09:10:45 +0000 Subject: [PATCH 1/2] FIX -dbTimeout conflict with -dbURI (#4496) (#4497) * FIX -dbTimeout conflict with -dbURI * Adjust timeout handling and fixing syntax error * Simplify dbTimeout Handling by Setting Default to 0 * Update CHANGES_NEXT_RELEASE for -dbTimeout Default Value Fix * Adjust Test Expectations for New -dbTimeout Default --- CHANGES_NEXT_RELEASE | 1 + src/app/contextBroker/contextBroker.cpp | 2 +- src/lib/mongoDriver/mongoConnectionPool.cpp | 2 +- test/functionalTest/cases/3658_env_vars/env_vars.test | 2 +- 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index e69de29bb2..41e24c99bf 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -0,0 +1 @@ +- Fix: changed the default value of `-dbTimeout` to 0 to resolve conflict with `-dbURI` (#4496) \ No newline at end of file diff --git a/src/app/contextBroker/contextBroker.cpp b/src/app/contextBroker/contextBroker.cpp index bf81abec8f..71d2a6669f 100644 --- a/src/app/contextBroker/contextBroker.cpp +++ b/src/app/contextBroker/contextBroker.cpp @@ -309,7 +309,7 @@ PaArgument paArgs[] = { "-dbDisableRetryWrites", &dbDisableRetryWrites, "MONGO_DISABLE_RETRY_WRITES", PaBool, PaOpt, false, false, true, DBDISABLERETRYWRITES_DESC }, { "-db", dbName, "MONGO_DB", PaString, PaOpt, _i "orion", PaNL, PaNL, DB_DESC }, - { "-dbTimeout", &dbTimeout, "MONGO_TIMEOUT", PaULong, PaOpt, 10000, 0, UINT_MAX, DB_TMO_DESC }, + { "-dbTimeout", &dbTimeout, "MONGO_TIMEOUT", PaULong, PaOpt, 0, 0, UINT_MAX, DB_TMO_DESC }, { "-dbPoolSize", &dbPoolSize, "MONGO_POOL_SIZE", PaInt, PaOpt, 10, 1, 10000, DBPS_DESC }, { "-ipv4", &useOnlyIPv4, "USEIPV4", PaBool, PaOpt, false, false, true, USEIPV4_DESC }, diff --git a/src/lib/mongoDriver/mongoConnectionPool.cpp b/src/lib/mongoDriver/mongoConnectionPool.cpp index ed0d1db07c..855896753e 100644 --- a/src/lib/mongoDriver/mongoConnectionPool.cpp +++ b/src/lib/mongoDriver/mongoConnectionPool.cpp @@ -407,7 +407,7 @@ static std::string composeMongoUri optionPrefix = "&"; } } - + LM_T(LmtMongo, ("MongoDB connection URI: '%s'", offuscatePassword(uri, passwd).c_str())); return uri; diff --git a/test/functionalTest/cases/3658_env_vars/env_vars.test b/test/functionalTest/cases/3658_env_vars/env_vars.test index 495c359dec..2ede8f83af 100644 --- a/test/functionalTest/cases/3658_env_vars/env_vars.test +++ b/test/functionalTest/cases/3658_env_vars/env_vars.test @@ -95,7 +95,7 @@ Extended Usage: contextBroker [option '-U' (extended usage)] [option '-dbSSL' (enable SSL connection to DB)] ORION_MONGO_SSL FALSE /FALSE/ [option '-dbDisableRetryWrites' (set retryWrite parameter to false in DB connect] ORION_MONGO_DISABLE_RETRY_WRITES FALSE /FALSE/ [option '-db' ] ORION_MONGO_DB 'orion' /'orion'/ - [option '-dbTimeout' ] ORION_MONGO_POOL_SIZE 1 <= 10 /10/ <= 10000 [option '-ipv4' (use ip v4 only)] ORION_USEIPV4 FALSE /FALSE/ [option '-ipv6' (use ip v6 only)] ORION_USEIPV6 FALSE /FALSE/ From 8d8d954653ee2d5e55d73dbe7ae3685465fdab10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ferm=C3=ADn=20Gal=C3=A1n=20M=C3=A1rquez?= Date: Wed, 7 Feb 2024 11:05:56 +0100 Subject: [PATCH 2/2] FIX wrong INFO startup log showing ORION_MONGO_TIMEOUT, ORION_IN_REQ_PAYLOAD_MAX_SIZE and ORION_OUT_REQ_MSG_MAX_SIZE env var values (#4501) --- CHANGES_NEXT_RELEASE | 3 ++- src/app/contextBroker/contextBroker.cpp | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGES_NEXT_RELEASE b/CHANGES_NEXT_RELEASE index 41e24c99bf..1e9166cf9c 100644 --- a/CHANGES_NEXT_RELEASE +++ b/CHANGES_NEXT_RELEASE @@ -1 +1,2 @@ -- Fix: changed the default value of `-dbTimeout` to 0 to resolve conflict with `-dbURI` (#4496) \ No newline at end of file +- Fix: changed the default value of `-dbTimeout` to 0 to resolve conflict with `-dbURI` (#4496) +- Fix: wrong INFO startup log showing ORION_MONGO_TIMEOUT, ORION_IN_REQ_PAYLOAD_MAX_SIZE and ORION_OUT_REQ_MSG_MAX_SIZE env var values (#4496) diff --git a/src/app/contextBroker/contextBroker.cpp b/src/app/contextBroker/contextBroker.cpp index 71d2a6669f..d1cc8a57b2 100644 --- a/src/app/contextBroker/contextBroker.cpp +++ b/src/app/contextBroker/contextBroker.cpp @@ -979,13 +979,17 @@ static void logEnvVars(void) { LM_I(("env var ORION_%s (%s): %d", aP->envName, aP->option, *((int*) aP->varP))); } + else if (aP->type == PaULong) + { + LM_I(("env var ORION_%s (%s): %d", aP->envName, aP->option, *((unsigned long*) aP->varP))); + } else if (aP->type == PaDouble) { LM_I(("env var ORION_%s (%s): %d", aP->envName, aP->option, *((double*) aP->varP))); } else { - LM_I(("env var ORION_%s (%s): %d", aP->envName, aP->option)); + LM_E(("cannot show env var ORION_%s (%s) due to unrecognized type: %d", aP->envName, aP->option, aP->type)); } } }