-
Notifications
You must be signed in to change notification settings - Fork 265
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conflict between -dbURI and Default -dbTimeout Causes Startup Failure #4496
Comments
While working on resolving the dbTimeout and -dbURI conflict (Issue #4496), I noticed an anomaly concerning the ORION_MONGO_TIMEOUT environment variable in a Docker environment. Setup: version: '3.9'
services:
orion:
image: fiware/orion:3.11.0
depends_on:
- mongodb
ports:
- "1026:1026"
environment:
- ORION_MONGO_URI=mongodb://mongodb:27017
- ORION_MONGO_TIMEOUT=0
- ORION_LOG_LEVEL=DEBUG
mongodb:
image: bitnami/mongodb:4.4
ports:
- "27017:27017" Observation
The functionality does not seem to be affected, as the actual value of ORION_MONGO_TIMEOUT appears to be correctly applied. However, the logging output is misleading, potentially causing confusion about the configuration in use. I'm documenting this here for awareness and to check if it's related to the changes made for Issue #4496, or if it should be addressed separately. |
Thanks for so detailed report and related PR #4497! :) Let me some time to review it and I'll provide feedback. |
Probably the simplest solution is to change the On the one hand, this will "pass" the On the other hard, this will cause that and from the cited driver documentation, in our case (Mongo C driver) from http://mongoc.org/libmongoc/current/mongoc_uri_t.html Thus, the default in the case of not using @goten002 what do you think? Could you adapt your PR #4497 in that way? (the PR would simplify a lot, in fact) |
Thank you very much for the thorough analysis and the proposed solution. I agree that changing the default value of -dbTimeout from 10000 to 0 is the optimal approach, especially considering the Mongo C driver's default behavior effectively mirrors what we intended with the original 10000 ms default. This change simplifies the implementation and avoids the complications associated with using negative values. I appreciate your help and guidance on this matter and will proceed to adjust my PR #4497 accordingly. |
* 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
I would say that after merging PRs #4497 and PR #4501 this issue could be closed. @goten002 what do you think? Thank you for your outstanding contribution! If you want to continue contributing to Orion I'd suggest to have a look to help wanted labeled issues or to the Orion roadmap, for more challenging issues. |
Btw, this issue has made me think it is a good idea to deprecated the old CLIs. This PR has been created about it #4505. |
Bug description
Encountered a startup failure with Fiware Orion version 3.11.0 due to a conflict between the -dbURI parameter and the default value of -dbTimeout. The issue arises when the -dbURI parameter is used without explicitly setting -dbTimeout to zero.
3.11.0
4.4
-dbURI mongodb://mongodb:27017 -logLevel DEBUG
fiware/orion:3.11.0
How to reproduce it
-dbURI
parameter without specifying-dbTimeout
.-dbURI
and other database parameters.Expected Behavior
Orion should start successfully using the
-dbURI
parameter without needing to explicitly set-dbTimeout
to zero, as-dbTimeout
has a default value.Investigation and Analysis
On further investigation, it was found that the
composeMongoUri
function inmongoConnectionPool.cpp
checks iftimeout > 0
to return an error. The default value ofdbTimeout
is 10000, as seen incontextBroker.cpp
, which seems to be causing the issue.Suggested Fix
It appears that the check for
timeout > 0
in the condition withincomposeMongoUri
is unnecessary when-dbURI
is used. A proposed solution would be to modify the conditional check to excludetimeout
whendbURI
is provided. This would prevent the conflict when the defaultdbTimeout
value is used with-dbURI
.Code Reference
The relevant code is located at:
Additional Context
This issue may impact users who are transitioning to the new
-dbURI
parameter and are unaware of the need to explicitly set-dbTimeout
to zero.The text was updated successfully, but these errors were encountered: