open-feature / open-feature/flagd

[BUG] FlagSyncService failure not reflected in Healthchecks

Open
#1,614 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug Needs Triage
Dominant language
Go
Stars
997
Forks
136
Avg merge
4d 8h
Merged PRs (30d)
11

Description

Observed behavior

Hello! I'm not sure if this is one or two bugs (or my lack of understanding about health checks), but they appear to be related.

When using Flagd with an HTTP sync target and the connection to the target times out, requests to the In-process Resolver on port 8013 are refused. However, the /healthz endpoint on 8014 still reports healthy.

  • HTTP: 200 OK (No response body)
  • gRPC: status: SERVING

Additionally, when Flagd is in this sync failure state, it does not restart gracefully using systemctl restart flagd. It must terminate the process with pkill -9 flagd, otherwise the Flagd process will continue to "run".

2025-03-28T07:03:47.479-0500        info        cmd/start.go:124        flagd version: v0.12.1 (82dc4e4c6c229e42ecb723f4866ba343be9d2b89), built at: 2025-02-04        {"component": "start"}
2025-03-28T07:03:47.480-0500        info        flag-sync/sync_service.go:87        starting flag sync service on port 8015        {"component": "FlagSyncService"}
2025-03-28T07:03:47.482-0500        info        ofrep/ofrep_service.go:58        ofrep service listening at 8016        {"component": "OFREPService"}
2025-03-28T07:03:47.483-0500        info        flag-evaluation/connect_service.go:249        metrics and probes listening at 8014        {"component": "service"}
2025-03-28T07:03:47.483-0500        info        flag-evaluation/connect_service.go:229        Flag IResolver listening at [::]:8013        {"component": "service"}
2025-03-28T07:03:47.484-0500        info        flag-sync/sync_service.go:155        shutting down gRPC sync service        {"component": "FlagSyncService"}
2025-03-28T07:03:47.484-0500        info        ofrep/ofrep_service.go:69        shutting down ofrep service        {"component": "OFREPService"}
2025-03-28T07:03:52.486-0500        warn        flag-sync/sync_service.go:113        timeout while waiting for all sync sources to complete their initial sync. continuing sync service        {"component": "FlagSyncService"}
2025-03-28T07:03:52.486-0500        warn        flag-sync/sync_service.go:122        error from sync server start: grpc: the server has been stopped        {"component": "FlagSyncService"}
Expected Behavior

When the Sync Service inside Flagd is not running or can not connect to the sync target, I expect the /healthz endpoint to return a non-200 for HTTP requests, and NOT_SERVING for gRPC health queries.

Steps to reproduce

Run Flagd with an HTTP sync target that allows the TCP connection to be opened, but times out waiting for an HTTP response.

flagd --uri=http://localhost:8500/v1/kv/config.json?raw=true

In our case, we pull the config from Consul's KV using a local Consul Agent, but the agent isn't connected to the rest of the cluster.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with flag-sync/sync_service.go and the health-check handling exposed on /healthz and the gRPC health endpoint. Reproduce the timeout with the provided flagd command, then trace how sync-service startup and shutdown affect resolver and health status. Done means a failed or stopped sync service reports non-200 and NOT_SERVING, and flagd can be restarted cleanly.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
backend, observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.