Skip to content

WebBrokerAPI: Fix stale WebBrokerApi route handlers after xDS remove/update #1964

@senthuran16

Description

@senthuran16

Summary

AddWebBrokerApiBinding in event-gateway/gateway-runtime/internal/runtime/runtime.go
registers receivers on r.wsMux but never records the route path in bindingPaths.
As a result, RemoveWebBrokerApiBinding cannot remove the handler from the mux and
leaves stale WebSocket routes active after the binding is removed via xDS.

Steps to reproduce

  1. Start the event gateway in xDS (control plane) mode.
  2. Add a WebBrokerApi binding via xDS — a handler is registered on r.wsMux.
  3. Delete or update the binding via xDS — RemoveWebBrokerApiBinding is called.
  4. The route remains active on r.wsMux because the path was never stored in
    bindingPaths and r.websubMux.Remove is called instead of a removal on r.wsMux.

Required changes

  • Record each registered WebBrokerApi path in bindingPaths[wbb.Name] inside
    AddWebBrokerApiBinding.
  • Switch r.wsMux from *http.ServeMux to a removable mux implementation
    (e.g., the existing DynamicMux type, same as r.websubMux) so routes can be
    deregistered.
  • Update RemoveWebBrokerApiBinding to look up paths in bindingPaths, call the
    removal API on r.wsMux, and delete the bindingPaths entry.

Related

Requested by

@senthuran16

Metadata

Metadata

Assignees

Labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions