Skip to content

Requests do not time out by default #115

Closed
@nathan-beam

Description

@nathan-beam

Problem

We recently ran into an issue with our application locking up while trying to fetch feature flags. After some investigation, we determined it's because requests made by the Temporal SDK do not time out by default. This behavior contradicts the official documentation here:

...
    # The network timeout in seconds.
    # Optional.
    # Defaults to 10 seconds
    request_timeout_seconds = 10,
...

You can see here and here that the timeout actually defaults to None, and here is passed directly to the Requests module. The Requests module documentation states that

By default, requests do not time out unless a timeout value is set explicitly. Without a timeout, your code may hang for minutes or more.

This is the behavior we were seeing with Flagsmiths intermittent issues this week. Frequently, we would be unable to connect to Flagsmith's servers and would hang until the process was killed by Gunicorn.

Versions

This appears to affect all recent versions of the Flagsmith Python SDK

Solution

A simple fix would be to change (this line )[https://github.com/Flagsmith/flagsmith-python-client/blob/d59b7a3f04f30bd118d1d8c24ba0e6b41804a2d5/flagsmith/flagsmith.py#L52] to

        request_timeout_seconds: typing.Optional[int] = 10,

If the maintainers agree that the documentation is correct, and a 10 second default timeout is the intended behavior, I can make this change. Otherwise, official documentation should be updated to reflect this behavior.

Metadata

Metadata

Assignees

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