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

Requests do not time out by default #115

Open
nathan-beam opened this issue Dec 18, 2024 · 1 comment
Open

Requests do not time out by default #115

nathan-beam opened this issue Dec 18, 2024 · 1 comment

Comments

@nathan-beam
Copy link

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.

@matthewelwell
Copy link
Contributor

Hi @nathan-beam , thanks for raising this, and for the detailed issue description.

Firstly, I'd like to apologise for the issues you experienced because of this, and because of the recent intermittent errors.

Regarding the resolution, given that the documentation states that a default timeout of 10 seconds is in place, I certainly think that we should update the SDK to adhere to that. If you're happy to implement that, then please do send over a PR and we'll get it reviewed and merged asap.

Thanks!

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