Skip to content
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

PyMongo transport incorrectly parses settings from URI #2259

Open
hariton27sy opened this issue Mar 14, 2025 · 1 comment
Open

PyMongo transport incorrectly parses settings from URI #2259

hariton27sy opened this issue Mar 14, 2025 · 1 comment

Comments

@hariton27sy
Copy link

The pymongo parser is used here and it converts timeouts values (ex. sockettimeoutms) from ms into seconds.

parsed = uri_parser.parse_uri(hostname, port)

Then these parameters are passed as keywords argument into __init__ method of MongoClient, but there is another iteration of converting arguments:

https://github.com/mongodb/mongo-python-driver/blob/4353278dc8655f7c12e624e9c9b774bc66c2060b/pymongo/synchronous/mongo_client.py#L824-L826

As a result timeout arguments, which are passed through connection URI, are double divided and we get timeouts 0.01 seconds instead of 10 for example.

The simpliest solution is to add `validate=False when parsing uri on the kombu side:

parsed = uri_parser.parse_uri(hostname, port, validate=False)

Disadvantage of this approach that transport may retry establishing connection with incorrectly passed configuration, while client will raise an Exception

@auvipy
Copy link
Member

auvipy commented Mar 20, 2025

thank your for identifying and reporting it. would you mind improving the implementation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants