#53731·milvus

[Bug]: /healthz reports ready before Proxy startup when no health indicators are registered

Author: chyezhCreated Sep 22, 2026Updated Sep 28, 2026
Labelskind/bugarea/kubernetestriage/accepted

Environment

  • Milvus Version: 3.0.2-20260918-4834b88c4-5c759fb; inspected source commit: 4834b88c40ca39f7a2b503590fa100cb6e4d865c.
  • Deployment Mode: Kubernetes cluster, two Proxy pods (r1 and r2) behind Envoy Gateway.
  • MQ: Not independently verified for this report.
  • SDK: Java client; observed user agent grpc-java-netty/1.59.1. Milvus SDK version unknown.
  • OS: Linux containers; distribution not collected.
  • Gateway: Envoy 1.33.3. The relevant gRPC route has no retry policy.

Reproduction

Steps (observed timing issue)

  1. Run two Proxy pods behind a Service and Envoy Gateway, using the probes below.
  2. Run concurrent Search and Insert requests against a loaded collection. Exact workload rate and schema were not collected; this is a startup/readiness issue.
  3. Kill the r2 Proxy container using Chaos Mesh container-kill, leaving r1 running.
  4. Observe the restarted r2 pod's Ready transition, management-port startup, external gRPC listener startup, and Envoy access logs.
  5. The pod becomes Ready before port 19530 is listening. Requests forwarded to r2 receive connection-refused errors while requests to r1 continue succeeding.

Trigger Conditions

  • Observed during a container restart on 2026-09-22; no new disruptive reproduction was performed during diagnosis.
  • Exposure depends on a readiness probe running after the management HTTP server starts but before the Proxy health indicator is registered.
  • The source path deterministically returns success for an empty indicator list; incident frequency has not been measured.

Expected Behavior

/healthz, when used for readiness, must not report success before the enabled component's health indicator is registered and the component is ready to serve. The restarting Proxy should remain NotReady during initialization.

This does not require eliminating errors from requests already in flight when a container is killed, or the brief propagation delay when removing a failed endpoint.

Actual Behavior

The r2 pod became Ready approximately 9 seconds before its external gRPC port started listening.

All times below are UTC on 2026-09-22, using timestamps inside application/access logs rather than ingestion timestamps:

Time Evidence
04:07:15.566 Chaos Mesh applied proxy-kill to r2; injection was recorded as successful.
04:07:15 Kubernetes recorded container termination with exit code 137.
~04:07:15.608 Envoy reported existing upstream connection termination (UC).
04:07:15.610 onward Envoy reported connection refused to r2:19530 (UF), returning gRPC status 14.
04:07:16 Replacement container started within the same pod.
04:07:17.730 Management HTTP server started listening on 9091.
04:07:19 Both Ready and ContainersReady transitioned to True.
04:07:27.979 Connection-refused failures were still observed for r2.
04:07:27.981 Proxy logged that its external gRPC listener was listening on 19530.
04:07:28.038 Successful Search requests to r2 were observed again.
04:07:28.048 Proxy logged successful startup.

The readiness probe is HTTP GET 9091/healthz, with successThreshold: 1. No raw successful probe response or packet capture was retained. The early-success conclusion is supported by the Kubernetes Ready transition, the configured probe, the later listener-start log, concurrent connection-refused errors, and the source path below.

Error Logs

Selected application logs (pod IP omitted):

[2026/09/22 04:07:17.730 +00:00] [INFO] [http/server.go:251] ["management listen"] [addr=:9091]
[2026/09/22 04:07:27.981 +00:00] [INFO] [proxy/listener_manager.go:54] ["Proxy listen on external grpc listener"] [port=19530]
[2026/09/22 04:07:28.048 +00:00] [INFO] [components/proxy.go:62] ["Proxy successfully started"]

Selected Envoy fields from a failed Insert at 04:07:15.610Z:

grpc_code=14
flag=UF
details=upstream_reset_before_response_started{remote_connection_failure|delayed_connect_error:_Connection_refused}
retries=1
t_all=1

Here retries is the access-log field name for %UPSTREAM_REQUEST_ATTEMPT_COUNT%: 1 means one total attempt, not one retry. Clients received UNAVAILABLE: upstream connect error. A healthy r1 backend continued serving successful requests during the incident.

Non-default Configuration

Relevant deployed Kubernetes probe configuration:

yaml
readinessProbe:
  httpGet:
    path: /healthz
    port: 9091
    scheme: HTTP
  periodSeconds: 15
  timeoutSeconds: 3
  failureThreshold: 2
  successThreshold: 1
startupProbe:
  tcpSocket:
    port: 9091
  periodSeconds: 3
  timeoutSeconds: 3
  failureThreshold: 60
  successThreshold: 1

The startup probe only checks the management TCP port. It therefore does not protect against an early-success response from the readiness endpoint.

Analysis Hints

Inspected at commit 4834b88c4:

  1. cmd/roles/roles.go:495-500 sets the expected component count and starts the management HTTP server before starting the Proxy component.
  2. cmd/roles/roles.go:147-150 registers the health indicator only after role.Prepare() succeeds.
  3. internal/distributed/proxy/service.go:500-505 creates the listener manager during Prepare(). The external listener's successful creation is logged before health registration.
  4. internal/http/healthz/healthz_handler.go:87-120 starts with State: "OK" and only changes it when a registered indicator is unhealthy. With no registered indicators, it returns HTTP 200. The expected indicatorNum does not gate success.

Consequently, the interval between management-server startup and component registration exposes a false-positive readiness response. This explains why Kubernetes admitted r2 before its business port was listening.

Suggested fix/validation: require health-indicator registration to be complete before readiness succeeds, preserving intended standby/unregistration semantics. Cover the pre-registration window with a regression test and verify that a restarting Proxy stays NotReady until it can serve. Gateway retries can mitigate eligible connection failures but do not fix incorrect server readiness.

Related: #36083 reported the same startup symptom and was closed in 2024. This report documents its recurrence in the deployed 3.0.2 build with timing and source evidence; the introducing/regressing commit has not been identified.