> De: "Cyril Bonté" <[email protected]>
> À: [email protected]
> Cc: [email protected]
> Envoyé: Mercredi 29 Mars 2017 12:36:01
> Objet: Re: 100% cpu usage with compression in haproxy.cfg
> Hi all,
> 
> > De: [email protected]
> > À: [email protected]
> > Envoyé: Mercredi 29 Mars 2017 11:52:10
> > Objet: 100% cpu usage with compression in haproxy.cfg
> > 
> > i have upgraded to haproxy 1.7.4
> > 
> > when i add  the compression algo & type configs in frontend,
> > haproxy
> > raises up to 100%.
> > this happens also with 1.7.1.
> > when i comment those two lines out, everything is working like a
> > charm, even compression is working. so i expect i don't need this
> > config option at all - only when i want to disable or set some
> > differenzt algo/compression options....
> 
> I've just hit the issue today on a"public lab" server and haproxy
> 1.8-dev (1.8-dev0-827385-303).

I won't have time to investigate it more for the next hours, but I can 
reproduce it easily in HTTP/1.0 (in my logs, the issue occured when a bot came 
with HTTP/1.0 requests).

Let's take such a simple PHP script (bug.php) :
<?php
for ($i = 0; $i < 16384; $i++) {
        echo ("X");
}
?>
Requesting the web server without haproxy, the response is :
$echo -ne "GET /bug.php HTTP/1.0\r\nHost: localhost\r\n\r\n" | nc localhost 80
HTTP/1.1 200 OK
Date: Wed, 29 Mar 2017 11:15:32 GMT
Server: Apache/2.4.10 (Debian)
Vary: Accept-Encoding
Connection: close
Content-Type: text/html; charset=UTF-8

XXXXXXXXXXXXXXXXXX...

Here, we don't have any Content-Length, which will produce a 100% cpu loop when 
the request is made through haproxy.
I add Christopher Faulet to the thread, maybe those details will help.

> I have a connection eating the CPU for more than 8h. Here is the
> session dump :
> 0x387d9f0: [29/Mar/2017:04:12:42.844109] id=16025 proto=tcpv4
> source=XXX.XXX.XXX.XXX:61913
>   flags=0x4ce, conn_retries=3, srv_conn=0x37e1e10, pend_pos=(nil)
>   frontend=http (id=2 mode=http), listener=http (id=1)
>   addr=192.168.0.2:4080
>   backend=intense-nocache (id=5 mode=http) addr=127.0.0.1:38462
>   server=www (id=1) addr=127.0.0.1:80
>   task=0x387d970 (state=0x20 nice=0 calls=-1372075361 exp=<NEVER>,
>   running age=8h12m)
>   txn=0x387cbc0 flags=0x18700800 meth=1 status=200 req.st=MSG_DONE
>   rsp.st=MSG_BODY waiting=0
>   si[0]=0x387dc28 (state=EST flags=0x0c endp0=CONN:0x3870900
>   exp=<NEVER>, et=0x000)
>   si[1]=0x387dc50 (state=EST flags=0x11c endp1=CONN:0x3876a30
>   exp=<NEVER>, et=0x000)
>   co0=0x3870900 ctrl=tcpv4 xprt=RAW data=STRM
>   target=LISTENER:0xcb5530
>       flags=0x00203300 fd=1 fd.state=22 fd.cache=0 updt=0
>   co1=0x3876a30 ctrl=tcpv4 xprt=RAW data=STRM target=SERVER:0x37e1e10
>       flags=0x00203300 fd=3 fd.state=22 fd.cache=0 updt=0
>   req=0x387da00 (f=0x29840000 an=0x28000 pipe=0 tofwd=0 total=282)
>       an_exp=<NEVER> rex=<NEVER> wex=<NEVER>
>       buf=0x729c60 data=0x729c74 o=0 p=0 req.next=0 i=0 size=0
>   res=0x387da40 (f=0x80008000 an=0x8000000 pipe=0 tofwd=0
>   total=15376)
>       an_exp=<NEVER> rex=<NEVER> wex=<NEVER>
>       buf=0x3884df0 data=0x3884e04 o=0 p=0 rsp.next=539 i=15360
>       size=16384
> 
> > 
> > frontend www
> >     bind 46.16.74.36:80
> >     capture request header Host len 32
> >     capture request header User-Agent len 64
> > 
> >     # ?? 100% CPU
> >     compression algo gzip
> >     compression type text/html text/plain text/javascript
> >     application/javascript application/xml...
> > 
> > this is haproxy -vv
> > 
> > HA-Proxy version 1.7.4 2017/03/27
> > Copyright 2000-2017 Willy Tarreau <[email protected]>
> > 
> > Build options :
> >   TARGET  = linux2628
> >   CPU     = generic
> >   CC      = gcc
> >   CFLAGS  = -O2 -g -fno-strict-aliasing
> >   -Wdeclaration-after-statement
> >   OPTIONS = USE_ZLIB=1 USE_OPENSSL=yes USE_PCRE=yes
> > 
> > Default settings :
> >   maxconn = 2000, bufsize = 16384, maxrewrite = 1024, maxpollevents
> >   =
> >   200
> > 
> > Encrypted password support via crypt(3): yes
> > Built with zlib version : 1.2.3.4
> > Running on zlib version : 1.2.8
> > Compression algorithms supported : identity("identity"),
> > deflate("deflate"), raw-deflate("deflate"), gzip("gzip")
> > Built with OpenSSL version : OpenSSL 1.0.2g  1 Mar 2016
> > Running on OpenSSL version : OpenSSL 1.0.2g  1 Mar 2016
> > OpenSSL library supports TLS extensions : yes
> > OpenSSL library supports SNI : yes
> > OpenSSL library supports prefer-server-ciphers : yes
> > Built with PCRE version : 8.12 2011-01-15
> > Running on PCRE version : 8.38 2015-11-23
> > PCRE library supports JIT : no (USE_PCRE_JIT not set)
> > Built without Lua support
> > Built with transparent proxy support using: IP_TRANSPARENT
> > IPV6_TRANSPARENT IP_FREEBIND
> > 
> > Available polling systems :
> >       epoll : pref=300,  test result OK
> >        poll : pref=200,  test result OK
> >      select : pref=150,  test result OK
> > Total: 3 (3 usable), will use epoll.
> > 
> > Available filters :
> >         [COMP] compression
> >         [TRACE] trace
> >         [SPOE] spoe
> > 
> > 
> 
> 

Reply via email to