From: Dominik Csapak <d.csapak@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [RFC PATCH http-server] fix #6230: increase allowed post size
Date: Wed, 12 Mar 2025 14:27:38 +0100 [thread overview]
Message-ID: <20250312132738.2268305-1-d.csapak@proxmox.com> (raw)
In some situations, e.g. having a large resource mapping, the UI can
generate a request that is bigger than the current limit of 64KiB.
Our files in pmxcfs can grow up to 1 MiB, so theoretically, a single
mapping can grow to that size. In practice, a single entry will have
much less. In #6230, a user has a mapping with about ~130KiB.
Increase the limit to 512KiB so we have a bit of buffer left.
We have to also increase the 'rbuf_max' size here, otherwise the request
will fail (since the buffer is too small for the request).
Since the post limit and the rbuf_max are tightly coupled, let it
reflect that in the code. To do that sum the post size + max header
size there.
Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
sending as RFC because:
* not sure about the rbuf_max calculation, but we have to increase it
when we increase $limit_max_post. (not sure how much is needed exactly)
* ther are alternative ways to deal with that, but some of those are vastly
more work:
- optimize the pci mapping to reduce the number of bytes we have to
send (e.g. by reducing the property names, or somehow magically
detect devices that belong together)
- add a new api for the mappings that can update the entries without
sending the whole mapping again (not sure if we can make this
backwards compatible)
- ignore the problem and simply tell the users to edit the file
manually (I don't like this one...)
also, I tried to benchmark this, but did not find a tool that does this
in a good way (e.g. apachebench complained about ssl, and i couldn't get
it to work right). @Thomas you did such benchmarks laft according to git
log, do you remember what you used then?
src/PVE/APIServer/AnyEvent.pm | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm
index 8a52836..43ced75 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -52,7 +52,7 @@ use PVE::APIServer::Utils;
my $limit_max_headers = 64;
my $limit_max_header_size = 8*1024;
-my $limit_max_post = 64*1024;
+my $limit_max_post = 512*1024;
my $known_methods = {
GET => 1,
@@ -1891,7 +1891,7 @@ sub accept_connections {
$self->{conn_count}++;
$reqstate->{hdl} = AnyEvent::Handle->new(
fh => $clientfh,
- rbuf_max => 64*1024,
+ rbuf_max => $limit_max_post + ($limit_max_headers * $limit_max_header_size),
timeout => $self->{timeout},
linger => 0, # avoid problems with ssh - really needed ?
on_eof => sub {
--
2.39.5
_______________________________________________
pve-devel mailing list
pve-devel@lists.proxmox.com
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel
reply other threads:[~2025-03-12 13:27 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20250312132738.2268305-1-d.csapak@proxmox.com \
--to=d.csapak@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