wso2 / wso2/api-platform

WebBrokerAPI: Guard against duplicate listeners in mixed static + xDS deployments (runtime.go)

Open
#1,962 0 comments 0 reactions 1 assignee View on GitHub

@senthuran16 is already working on this.

Since May 14, 2026.

Area/EventGateway
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

Reported by @senthuran16

Contributor guide

No contributing guide indexed for this repository

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.