You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
ba-proxy-agent: close idle connections to mitigate memory leaks
The ba-proxy-agent currently experiences increasing memory consumption,
leading to daily or weekly restarts. Previous mitigation attempts were
insufficient, and the issue has been isolated to high memory usage on
the agent connection side.
This CL mitigates the issue by enforcing a timeout on idle connections.
Since the root cause remains elusive, forcefully closing unused
connections prevents memory accumulation from persistent links.
Implementation details:
* Introduced `lastActivityTime` property to agent connections, which
updates upon usage.
* Added a background routine to monitor connection activity.
* Configured the routine to explicitly close connections that remain
idle for more than 30 seconds.
Copy file name to clipboardExpand all lines: agent/agent.go
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -73,6 +73,7 @@ var (
73
73
injectBanner=flag.String("inject-banner", "", "HTML snippet to inject in served webpages")
74
74
bannerHeight=flag.String("banner-height", "40px", "Height of the injected banner. This is ignored if no banner is set.")
75
75
shimWebsockets=flag.Bool("shim-websockets", false, "Whether or not to replace websockets with a shim")
76
+
websocketShimTimeout=flag.Duration("websocket-shim-timeout", 60*time.Minute, "Timeout for websocket shim connections to expire due to inactivity.")
76
77
shimPath=flag.String("shim-path", "", "Path under which to handle websocket shim requests")
77
78
healthCheckPath=flag.String("health-check-path", "/", "Path on backend host to issue health checks against. Defaults to the root.")
78
79
healthCheckFreq=flag.Int("health-check-interval-seconds", 0, "Wait time in seconds between health checks. Set to zero to disable health checks. Checks disabled by default.")
monitoringEndpoint=flag.String("monitoring-endpoint", "staging-monitoring.sandbox.googleapis.com:443", "The endpoint to which to write metrics. Eg: monitoring.googleapis.com corresponds to Cloud Monarch.")
49
50
monitoringResourceType=flag.String("monitoring-resource-type", "gce_instance", "The monitoring resource type. Eg: gce_instance")
50
51
monitoringResourceLabels=flag.String("monitoring-resource-labels", "instance-id=fake-instance-id,instance-zone=us-west1-a", "Comma separated key value pairs for the purpose of monitoring configuration. Eg: 'instance-id=my-instance-id,instance-zone=us-west1-a")
52
+
websocketShimTimeout=flag.Duration("websocket-shim-timeout", 60*time.Minute, "Timeout for websocket shim connections to expire due to inactivity.")
0 commit comments