Skip to content

PyMongo transport incorrectly parses settings from URI #2259

@hariton27sy

Description

@hariton27sy

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions