public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
* [PATCH v4 http-server 0/1] fix pveproxy OOM in websocket and spice proxy handlers
@ 2026-06-17 12:29 Kefu Chai
  2026-06-17 12:29 ` [PATCH v4 http-server 1/1] fix #7483: apiserver: add backpressure to " Kefu Chai
  0 siblings, 1 reply; 2+ messages in thread
From: Kefu Chai @ 2026-06-17 12:29 UTC (permalink / raw)
  To: pve-devel

see v2's cover letter [1] for the problem description and the approach.

Changes since v3:

* fix a reference-cycle leak in apply_read_backpressure(): it now reads
  the resume callback off the source handle instead of taking it as an
  argument, so the proxy readers no longer pass themselves in. a reader
  that references its own variable is a self-referential closure, an
  uncollectable cycle that pinned $reqstate on every disconnect. this
  also lets response_stream() drop the manual `$on_read = undef` it kept
  only to break that same cycle.

* split the drain and the teardown in handle_proxy_eof() into separate
  eval blocks. the websocket reader dies on a malformed trailing frame
  left in rbuf, and v3's single eval let that die skip
  client_do_disconnect() and leak the connection.

* deduplicate the on_error handlers into a shared handle_proxy_error();
  the three proxy on_error bodies were copy-paste of each other.

checked locally with an out-of-tree synthetic AnyEvent setup (not part
of this series): reverting the eval split leaks a connection on a reader
die, and reverting the reference-cycle fix leaves $reqstate uncollected
after disconnect.

[1] https://lore.proxmox.com/pve-devel/20260413125650.2569621-1-k.chai@proxmox.com/

Kefu Chai (1):
  fix #7483: apiserver: add backpressure to proxy handlers

 src/PVE/APIServer/AnyEvent.pm | 197 +++++++++++++++++++++++-----------
 1 file changed, 135 insertions(+), 62 deletions(-)

-- 
2.47.3





^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-17 12:30 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-17 12:29 [PATCH v4 http-server 0/1] fix pveproxy OOM in websocket and spice proxy handlers Kefu Chai
2026-06-17 12:29 ` [PATCH v4 http-server 1/1] fix #7483: apiserver: add backpressure to " Kefu Chai

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal