public inbox for pve-devel@lists.proxmox.com
 help / color / mirror / Atom feed
From: Kefu Chai <k.chai@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [PATCH v4 http-server 0/1] fix pveproxy OOM in websocket and spice proxy handlers
Date: Wed, 17 Jun 2026 20:29:04 +0800	[thread overview]
Message-ID: <20260617122905.3822836-1-k.chai@proxmox.com> (raw)

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





             reply	other threads:[~2026-06-17 12:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-17 12:29 Kefu Chai [this message]
2026-06-17 12:29 ` [PATCH v4 http-server 1/1] fix #7483: apiserver: add backpressure to proxy handlers Kefu Chai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260617122905.3822836-1-k.chai@proxmox.com \
    --to=k.chai@proxmox.com \
    --cc=pve-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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