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

[Bug] (Python) Client SDK fails to recover after flipt server restarts #593

Open
andi4000 opened this issue Dec 17, 2024 · 0 comments
Open

Comments

@andi4000
Copy link

Problem

Flag evaluation on client SDK continues to fail, even after the flipt server has been restarted. Server logs show that the client SDK is polling/fetching flags, but the evaluation call doesn't recover.

Steps to Reproduce

  1. Spin up a flipt server like so:
docker run -p 8080:8080 -v ./flipt-data:/var/opt/flipt docker.flipt.io/flipt/flipt:latest
  1. Add a flag my-flag.

  2. Run the following python client

from time import sleep

from flipt_client import ClientOptions, FliptEvaluationClient

client = FliptEvaluationClient(opts=ClientOptions(update_interval=2))

while True:
    try:
        res = client.evaluate_boolean("my-flag", entity_id="1337")
        print(res)
    except Exception as e:
        print(e)
    sleep(1)
  1. Observe that the python client works as expected, printing the evaluation result every second

  2. Stop the flipt server

  3. Observe the python client correctly logging the following error

server error: failed to make request: Request failed after 3 retries
  1. Restart the flipt server

  2. ⚠️ Despite the flipt server showing incoming fetch requests from the python SDK, the python client continues to fail with the same error message ⚠️

Expected Behaviour

The client SDK should successfully recover and resume normal operation once the flipt server is back online

Nasty Workaround

Wrap evaluate_boolean and evaluate_variant function, handle the (generic) exception and re-initialize FliptEvaluationClient

Environment

  • flipt-client version 0.13.0
  • Python 3.12
  • MBP M2 Pro, macOS 15.2
  • Flipt server:
Version: v1.51.1
Commit: 7d46879a4ba113916a3901cec7dbf0189db8fc90
Build Date: 2024-11-05T22:18:52Z
Go Version: go1.23.2
OS/Arch: linux/arm64

Additional Notes

Happy to help if further clarification or testing is needed! 😄

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

No branches or pull requests

1 participant