Ah, I just find a problem in this snip

```
+                                       if ((unsigned)(txn->status - 400) <
100)
+                                               stream_inc_http_err_ctr(s);
```
calling `stream_inc_http_err_ctr` may cause the http_err_cnt be increased
twice for other stick counter tracked by `http-request track-sc`. for
example:

```
frontend fe
    bind *:7001
    stick-table type ip size 100 expire 10m store http_req_cnt,http_err_cnt
    http-request track-sc1 src
    http-response track-sc2 status table dummy
    default_backend be

backend be
    server b1 127.0.0.1:8000

backend dummy
    stick-table type integer size 100 expire 10m store
http_req_cnt,http_err_cnt
```
the `http_err_cnt` in table `fe` will be increased twice for every 4xx
response.

we should only increase the err counter for the current stick counter entry.

On Tue, Jul 26, 2016 at 8:34 PM, Willy Tarreau <[email protected]> wrote:

> On Tue, Jul 26, 2016 at 06:24:50PM +0800, Ruoshan Huang wrote:
> > >
> > > If you're fine with this, I'll simply merge them with the change above,
> > > it's clean enough, no need to respin. Please just confirm that it's
> fine
> > > for you as well.
> > >
> > >
> > Yes, please ship it.
> > Thank you so much.
>
> OK now merged. I tested this config on it :
>
>         http-response track-sc0 status
>         stick-table type integer size 200k store http_req_cnt,http_err_cnt
>
> and it works pretty fine :
>
> $ echo "show table l" | socat - /tmp/sock1
> # table: l, type: integer, size:204800, used:3
> 0x7ef7b0: key=302 use=0 exp=0 http_req_cnt=1 http_err_cnt=0
> 0x7ef718: key=404 use=0 exp=0 http_req_cnt=1 http_err_cnt=1
> 0x7ef070: key=200 use=0 exp=0 http_req_cnt=2 http_err_cnt=0
>
> That's cool :-)
>
> Thanks,
> Willy
>



-- 
Good day!
ruoshan

Reply via email to