[pve-devel] [PATCH pve-http-server] websocket: set $max_payload_size = 132*1024;

Dietmar Maurer dietmar at proxmox.com
Thu Jun 7 10:07:37 CEST 2018



> On June 7, 2018 at 9:54 AM Dominik Csapak <d.csapak at proxmox.com> wrote:
> 
> 
> 2 things, the commit message talks about 32*1024 (=32768)

should be 132*1024

> but the patch sets it to 135168
> neither of which is 131072 (which is 128*1024)

oh, sure - this should be 128*1024 instead - will fix

> 
> is there a reason for why you want it to set 4k higher than what 
> anyevent uses?
> 
> On 06/06/2018 05:39 PM, Dietmar Maurer wrote:
> > AnyEvent checks rbuf_max after calling the callback (too late), so
> > we can receive larger data, because AnyEvent uses MAX_READ_SIZE=131072
> > to fill the buffer.
> > 
> > So a more elegant solution is to set $max_payload_size=32*1024. At lease
> > I am not able to receive rbuf larger than 32*1024 now. But I keep the
> > protection from the previous patch - just to be sure.
> > 
> > Signed-off-by: Dietmar Maurer <dietmar at proxmox.com>
> > ---
> >   PVE/APIServer/AnyEvent.pm | 4 ++--
> >   1 file changed, 2 insertions(+), 2 deletions(-)
> > 
> > diff --git a/PVE/APIServer/AnyEvent.pm b/PVE/APIServer/AnyEvent.pm
> > index 9efd662..f6e04f3 100755
> > --- a/PVE/APIServer/AnyEvent.pm
> > +++ b/PVE/APIServer/AnyEvent.pm
> > @@ -345,7 +345,7 @@ sub websocket_proxy {
> >   	my $remhost;
> >   	my $remport;
> >   
> > -	my $max_payload_size = 65536;
> > +	my $max_payload_size = 132*1024;
> >   
> >   	my $binary;
> >   	if ($wsproto eq 'binary') {
> > @@ -375,7 +375,7 @@ sub websocket_proxy {
> >   	    $reqstate->{proxyhdl} = AnyEvent::Handle->new(
> >   		fh => $fh,
> >   		rbuf_max => $max_payload_size,
> > -		wbuf_max => $max_payload_size*10,
> > +		wbuf_max => $max_payload_size*5,
> >   		timeout => 5,
> >   		on_eof => sub {
> >   		    my ($hdl) = @_;
> > 
> 
> 
> _______________________________________________
> pve-devel mailing list
> pve-devel at pve.proxmox.com
> https://pve.proxmox.com/cgi-bin/mailman/listinfo/pve-devel



More information about the pve-devel mailing list