Skip to content

gorouter drops hash-based route registrations — hash_balance no longer parsed when sent as a JSON string (regression introduced in v0.386.0 / #535) #585

Description

@a18e

Current behavior

Since v0.386.0, gorouter fails to unmarshal router.register NATS messages for any route configured with hash-based load balancing (loadbalancing: hash) that includes a hash_balance factor. The message is rejected as a validation error and dropped, so the endpoint is never registered — the route becomes unreachable (404 / stale until TTL expiry) even though the app and the registration message are healthy.

Observed log (gorouter.subscriber):

{"message":"validation-error","source":"gorouter.subscriber","data":{
  "error":"json: cannot unmarshal string into Go struct field RegistryMessageOpts.options.hash_balance of type float64",
  "payload":"{\"host\":\"10.0.73.2\",\"port\":0,\"tls_port\":61000,\"uris\":[\"...cf...sapcloud.io\"],\"protocol\":\"http1\",\"app\":\"e2483c52-...\",...,\"options\":{\"loadbalancing\":\"hash\",\"hash_header\":\"http-header-name\",\"hash_balance\":\"1.2\"}}",
  "subject":"router.register"}}

Desired behavior

gorouter should again accept hash_balance when it arrives as a JSON string, matching the wire format that Cloud Controller and route-emitter actually produce.

Fix WIP: #584

Affected Version

v0.386.0 through v0.393.0 (latest). Introduced by commit 02a2a93 (PR #535); last unaffected release: v0.385.0.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions