WebBrokerAPI: Guard against duplicate listeners in mixed static + xDS deployments (runtime.go)
@senthuran16 is already working on this.
Since May 14, 2026.
- Dominant language
- Go
- Stars
- 71
- Forks
- 111
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 110
Description
Summary
In event-gateway/gateway-runtime/internal/runtime/runtime.go, the Run() method's xDS branch unconditionally calls newManagedServer() for WebSocket and WebSub servers, even when LoadChannels() has already appended servers for those protocols/ports to r.servers. In a mixed static + xDS deployment, the second listener bind attempt will fail on the same port while the runtime still proceeds to mark itself ready.
Expected Behavior
Before creating a new server in the xDS block, the runtime should check r.servers for an existing server matching the protocol/port (e.g., WebSocket → r.cfg.Server.WebSocketPort with r.wsMux, WebSub-HTTP → r.cfg.Server.WebSubHTTPPort with r.websubMux, WebSub-HTTPS → r.cfg.Server.WebSubHTTPSPort). If one already exists, reuse it and skip creating a duplicate. Only call newManagedServer() and append/run a new server when no existing server for that protocol/port is registered.
Relevant Code
File: event-gateway/gateway-runtime/internal/runtime/runtime.go
Approximate lines: 445–487 (xDS server startup block in Run())
References
- PR: https://github.com/wso2/api-platform/pull/1954
- Review comment: https://github.com/wso2/api-platform/pull/1954#discussion_r3239562647
- Related PR: https://github.com/wso2/api-platform/pull/1944
Reported by @senthuran16
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.