[Bug]: A gateway shows as inactive while another platform-api replica still holds its session
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- docker, go, postgresql
- Ambito
- api, backend, distributed-systems
Direzione di ricerca
Start with platform-api/internal/handler/websocket.go around line 170 and trace how session closure updates the gateway's active state. Check how gateway sessions are represented across replicas and whether the shared Postgres-backed state can determine if any session remains. Done means isActive stays true when another replica still has a live session; add or update coverage for the two-replica case.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Please select the area the issue is related to
Platform API
Please select the aspect the issue is related to
Aspect/API (API backends, definitions, contracts, interfaces, OpenAPI)
Description
With more than one platform-api replica, a gateway is reported as inactive ("isActive": false) while it still has a live session on another replica.
When a gateway's WebSocket session closes, the replica that held it marks the whole gateway inactive if that replica has no other session for it (platform-api/internal/handler/websocket.go:170, len(h.manager.GetConnections(gateway.ID)) == 0). GetConnections only knows this replica's in-memory sessions, so a session the gateway holds on another replica is not counted.
A gateway can have two active tokens, and so two controllers connected at once, each possibly on a different replica. In that case, when one session ends, the gateway shows inactive while the other is still connected and serving. The console shows such a gateway as "Not Active" and greys out its Deploy button (seen on the Deploy page for an inactive gateway).
Since #4315 (revoking a token closes the sessions opened with it), revoking one of the two tokens also triggers this.
Expected: isActive stays true while any replica holds a session for the gateway.
Actual: it becomes false as soon as one replica loses its last session for that gateway.
Related: #1185 (reconnect not updating the state, single replica; closed).
Steps to Reproduce
- Run two platform-api replicas, P1 and P2, on one shared Postgres database, each on its own ports.
- Register a gateway (
POST /api/v0.9/gateways) and mint two tokens for it (POST /api/v0.9/gateways/<id>/tokenstwice). - Start one gateway controller with token 1, connected to P1, and a second controller for the same gateway with token 2, connected to P2.
GET /api/v0.9/gateways/<id>returns"isActive": true; P1 and P2 each hold one session for the gateway.- Stop the first controller (
docker stop <controller-1>). P1 logsWebSocket connection closedfor its session. GET /api/v0.9/gateways/<id>returns"isActive": falseat 2, 8 and 30 seconds after the stop. The second controller is still running and connected to P2, which still holds its session.
Severity Level of the Issue
Severity/Major (Important functionality is broken. Should be prioritized. Doesn't need immediate attention)
Environment Details (with versions)
- Source:
mainata9992d2fe. - Two platform-api replicas built from source, sharing a
postgres:17-alpinedatabase (schema fromschema.postgres.sql). - Gateway controllers and runtimes built from that commit (version 2026.09.24).
- macOS with Rancher Desktop.
- Lingua principale
- Go
- Stelle
- 85
- Fork
- 137
- Merge medio
- 1g 12h
- PR unite (30g)
- 247
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Nessuna guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di wso2/api-platform
-
Area/DeveloperPortal Aspect/UI Severity/Minor Type/Bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
wso2/api-platform#4369 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: host-rewrite policy documentation lists fewer allowed host characters than the policy acceptsApertaArea/Policies Aspect/Other Severity/Trivial Type/Bug
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 91/100
wso2/api-platform#4355 ·
I maintainer di solito rispondono entro 1 giorno
-
Area/Gateway Aspect/API Severity/Minor Type/Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
wso2/api-platform#4348 ·
I maintainer di solito rispondono entro 1 giorno
-
Aspect/AI Aspect/API. Severity/Major
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
wso2/api-platform#4343 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: content-length-guardrail policy accepts a non-string streamingJsonPath at API creationApertaArea/Policies Aspect/Configuration Severity/Minor Type/Bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
wso2/api-platform#4330 ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di wso2/api-platform
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
-
needs discussion
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
openfga/openfga.dev#1436 · 1 commento ·
I maintainer di solito rispondono entro 2 giorni
-
都道府県を指定すると区名から始まる住所に市名を補わないAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
digital-go-jp/abr-geocoder#457 ·
I maintainer di solito rispondono entro 3 giorni
-
benchmark
Difficoltà 1/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
mozilla-ai/cq#601 ·
I maintainer di solito rispondono entro 1 giorno