]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
17 years ago[BUILD] Removed "/" after '$(DESTDIR)' in install targets
Christian Wiese [Wed, 12 Mar 2008 16:19:16 +0000 (18:19 +0200)] 
[BUILD] Removed "/" after '$(DESTDIR)' in install targets

SBINDIR, MANDIR and DOCDIR use an absolute path

17 years ago[BUILD] Added 'install-doc' make target
Christian Wiese [Wed, 12 Mar 2008 15:24:49 +0000 (17:24 +0200)] 
[BUILD] Added 'install-doc' make target

This change is also introducing a new make variable called DOCDIR,
which is set to "$(PREFIX)/doc/haproxy" by default.

17 years ago[BUILD] Added 'install-bin' make target
Christian Wiese [Wed, 12 Mar 2008 14:21:05 +0000 (16:21 +0200)] 
[BUILD] Added 'install-bin' make target

17 years ago[BUILD] Added 'install-man' make target for installing the man page
Christian Wiese [Wed, 12 Mar 2008 13:57:54 +0000 (15:57 +0200)] 
[BUILD] Added 'install-man' make target for installing the man page

This change is also introducing a new variable in the Makefile called
MANDIR, which is set to "$PREFIX/share/man" by default.

17 years ago[BUILD] Added support for 'make install'
Christian Wiese [Wed, 12 Mar 2008 13:25:35 +0000 (15:25 +0200)] 
[BUILD] Added support for 'make install'

To be flexible while installing haproxy following variables have been
added to the Makefile:
- DESTDIR useful i.e. while installing in a sandbox (not set by default)
- PREFIX  defines the default install prefix (default: /usr/local)
- SBINDIR defines the dir the haproxy binary gets installed
  (default: $PREFIX/sbin)

17 years ago[BUILD] ensure that users don't build without setting the target anymore.
Willy Tarreau [Tue, 11 Mar 2008 05:37:39 +0000 (06:37 +0100)] 
[BUILD] ensure that users don't build without setting the target anymore.

Too often, people report performance issues on Linux 2.6 because they don't
use the available optimizations. We need to ensure that people are aware of
the available features, and for this, we must force them to choose a target
OS (or "generic"), but at least prevent them from blindly building for a
generic target.

17 years ago[MAJOR] implementation of the "leastconn" load balancing algorithm
Willy Tarreau [Mon, 10 Mar 2008 21:04:20 +0000 (22:04 +0100)] 
[MAJOR] implementation of the "leastconn" load balancing algorithm

The new "leastconn" LB algorithm selects the server which has the
least established or pending connections. The weights are considered,
so that a server with a weight of 20 will get twice as many connections
as the server with a weight of 10.

The algorithm respects the minconn/maxconn settings, as well as the
slowstart since it is a dynamic algorithm. It also correctly supports
backup servers (one and all).

It is generally suited for protocols with long sessions (such as remote
terminals and databases), as it will ensure that upon restart, a server
with no connection will take all new ones until its load is balanced
with others.

A test configuration has been added in order to ease regression testing.

17 years ago[BUG] option allbackups was not working anymore in roundrobin mode
Willy Tarreau [Sat, 8 Mar 2008 20:42:54 +0000 (21:42 +0100)] 
[BUG] option allbackups was not working anymore in roundrobin mode

Commit 3168223a7b33a1d5aad1e11b8f2ad917645d7f27 broke option
"allbackups" in roundrobin mode due to an erroneous structure
member replacement in backend.c. The PR_O_USE_ALL_BK flag was
not tested in the right member anymore.

This bug uncoverred another one, by which all backup servers would
be used whatever the option's value, if all of them had been seen
as simultaneously failed at one moment.

This patch fixes the two stupid errors. Correctness has been tested
using the test-fwrr.cfg config example.

17 years ago[BUG] str2sun could leak a small buffer in case of error during parsing
Willy Tarreau [Fri, 7 Mar 2008 09:07:04 +0000 (10:07 +0100)] 
[BUG] str2sun could leak a small buffer in case of error during parsing

Matt Farnsworth reported a memory leak in str2sun() in case a too large
socket path is passed. The bug is very minor because it only happens
once during config parsing, but has to be fixed nevertheless. The patch
Matt provided could even be improved by completely removing the useless
strdup() in this function.

17 years ago[CLEANUP] report dlmalloc's source path only if explictly specified
Willy Tarreau [Fri, 7 Mar 2008 09:02:14 +0000 (10:02 +0100)] 
[CLEANUP] report dlmalloc's source path only if explictly specified

There's no point in reporting dlmalloc's source path if it was the
default one.

17 years ago[CLEANUP] update .gitignore to ignore more temporary files
Willy Tarreau [Fri, 7 Mar 2008 08:39:37 +0000 (09:39 +0100)] 
[CLEANUP] update .gitignore to ignore more temporary files

17 years ago[MINOR] silent gcc for a wrong warning
Willy Tarreau [Tue, 4 Mar 2008 05:38:57 +0000 (06:38 +0100)] 
[MINOR] silent gcc for a wrong warning

gcc believes that avoididx may be used uninitialized, which is wrong.

17 years ago[MAJOR] proto_uxst rework -> SNMP support
Krzysztof Piotr Oledzki [Sun, 2 Mar 2008 01:42:14 +0000 (02:42 +0100)] 
[MAJOR] proto_uxst rework -> SNMP support

Currently there is a ~16KB limit for a data size passed via unix socket.
It is caused by a trivial bug ttat is going to fixed soon, however
in most cases there is no need to dump a full stats.

This patch makes possible to select a scope of dumped data by extending
current "show stat" to "show stat [<iid> <type> <sid>]":
 - iid is a proxy id, -1 to dump all proxies
 - type selects type of dumpable objects: 1 for frontend, 2 for backend, 4 for
   server, -1 for all types. Values can be ORed, for example:
     1+2=3   -> frontend+backend.
     1+2+4=7 -> frontend+backend+server.
 - sid is a service id, -1 to dump everything from the selected proxy.

To do this I implemented a new session flag (SN_STAT_BOUND), added three
variables in data_ctx.stats (iid, type, sid), modified dumpstats.c and
completely revorked the process_uxst_stats: now it waits for a "\n"
terminated string, splits args and uses them. BTW: It should be quite easy
to add new commands, for example to enable/disable servers, the only problem
I can see is a not very lucky config name (*stats* socket). :|

During the work I also fixed two bug:
 - s->flags were not initialized for proto_uxst
 - missing comma if throttling not enabled (caused by a stupid change in
     "Implement persistent id for proxies and servers")

Other changes:
 - No more magic type valuse, use STATS_TYPE_FE/STATS_TYPE_BE/STATS_TYPE_SV
 - Don't memset full s->data_ctx (it was clearing s->data_ctx.stats.{iid/type/sid},
    instead initialize stats.sv & stats.sv_st (stats.px and stats.px_st were already
    initialized)

With all that changes it was extremely easy to write a short perl plugin
for a perl-enabled net-snmp (also included in this patch).

29385 is my PEN (Private Enterprise Number) and I'm willing to donate
the SNMPv2-SMI::enterprises.29385.106.* OIDs for HAProxy if there
is nothing assigned already.

17 years ago[MEDIUM]: Prevent redispatcher from selecting the same server, version #3
Krzysztof Piotr Oledzki [Fri, 22 Feb 2008 02:50:19 +0000 (03:50 +0100)] 
[MEDIUM]: Prevent redispatcher from selecting the same server, version #3

When haproxy decides that session needs to be redispatched it chose a server,
but there is no guarantee for it to be a different one. So, it often
happens that selected server is exactly the same that it was previously, so
a client ends up with a 503 error anyway, especially when one sever has
much bigger weight than others.

Changes from the previous version:
 - drop stupid and unnecessary SN_DIRECT changes

 - assign_server(): use srvtoavoid to keep the old server and clear s->srv
    so SRV_STATUS_NOSRV guarantees that t->srv == NULL (again)
    and get_server_rr_with_conns has chances to work (previously
    we were passing a NULL here)

 - srv_redispatch_connect(): remove t->srv->cum_sess and t->srv->failed_conns
   incrementing as t->srv was guaranteed to be NULL

 - add avoididx to get_server_rr_with_conns. I hope I correctly understand this code.

 - fix http_flush_cookie_flags() and move it to assign_server_and_queue()
   directly. The code here was supposed to set CK_DOWN and clear CK_VALID,
   but: (TX_CK_VALID | TX_CK_DOWN) == TX_CK_VALID == TX_CK_MASK so:
if ((txn->flags & TX_CK_MASK) == TX_CK_VALID)
txn->flags ^= (TX_CK_VALID | TX_CK_DOWN);
   was really a:
if ((txn->flags & TX_CK_MASK) == TX_CK_VALID)
txn->flags &= TX_CK_VALID

   Now haproxy logs "--DI" after redispatching connection.

 - defer srv->redispatches++ and s->be->redispatches++ so there
   are called only if a conenction was redispatched, not only
   supposed to.

 - don't increment lbconn if redispatcher selected the same sarver

 - don't count unsuccessfully redispatched connections as redispatched
   connections

 - don't count redispatched connections as errors, so:

 - the number of connections effectively served by a server is:
 srv->cum_sess - srv->failed_conns - srv->retries - srv->redispatches
   and
 SUM(servers->failed_conns) == be->failed_conns

 - requires the "Don't increment server connections too much + fix retries" patch

 - needs little more testing and probably some discussion so reverting to the RFC state

Tests #1:
 retries 4
 redispatch

i) 1 server(s): b (wght=1, down)
  b) sessions=5, lbtot=1, err_conn=1, retr=4, redis=0
  -> request failed

ii) server(s): b (wght=1, down), u (wght=1, down)
  b) sessions=4, lbtot=1, err_conn=0, retr=3, redis=1
  u) sessions=1, lbtot=1, err_conn=1, retr=0, redis=0
  -> request FAILED

iii) 2 server(s): b (wght=1, down), u (wght=1, up)
  b) sessions=4, lbtot=1, err_conn=0, retr=3, redis=1
  u) sessions=1, lbtot=1, err_conn=0, retr=0, redis=0
  -> request OK

iv) 2 server(s): b (wght=100, down), u (wght=1, up)
  b) sessions=4, lbtot=1, err_conn=0, retr=3, redis=1
  u) sessions=1, lbtot=1, err_conn=0, retr=0, redis=0
  -> request OK

v) 1 server(s): b (down for first 4 SYNS)
  b) sessions=5, lbtot=1, err_conn=0, retr=4, redis=0
  -> request OK

Tests #2:
 retries 4

i) 1 server(s): b (down)
  b) sessions=5, lbtot=1, err_conn=1, retr=4, redis=0
  -> request FAILED

17 years ago[BUG] Don't increment server connections too much + fix retries
Krzysztof Piotr Oledzki [Mon, 4 Feb 2008 01:10:09 +0000 (02:10 +0100)] 
[BUG] Don't increment server connections too much + fix retries

Commit 98937b875798e10fac671d109355cde29d2a411a while fixing
one bug introduced another one. With "retries 4" and
"option redispatch" haproxy tries to connect 4 times to
one server server and 1 time to a second one. However
logs showed 5 connections to the first server (the
last one was counted twice) and 2 to the second.

This patch also fixes srv->retries and be->retries increments.

Now I get: 3 retries and 1 error in a first server (4 cum_sess)
and 1 error in a second server (1 cum_sess) with:
 retries 4
 option redispatch

and: 4 retries and 1 error (5 cum_sess) with:
 retries 4

So, the number of connections effectively served by a server is:
 srv->cum_sess - srv->failed_conns - srv->retries

17 years ago[MINOR] Implement persistent id for proxies and servers
Krzysztof Piotr Oledzki [Sat, 23 Feb 2008 00:19:10 +0000 (01:19 +0100)] 
[MINOR] Implement persistent id for proxies and servers

This patch adds a possibility to set a persistent id for a proxy/server.
Now, even if some proxies/servers are inserted/deleted/moved, iids and
sids can be still used reliable.

Some people add servers with tricky names (BACKEND or FRONTEND for example).
So I also added one more field ('type') to distinguish between a
backend (0), frontend (1) and server (2) without complicated logic:
if name==BACKEND and sid==0 then type is BACKEND else type is SERVER,
etc for a FRONTEND. It also makes possible to have one frontend with more
than one IP (a patch coming soon) with independed stats - for example to
differs between remote and local traffic.

Finally, I added documentation about the CSV format.

This patch depends on '[MEDIUM] Implement "track [<backend>/]<server>"'

17 years ago[MEDIUM] Implement "track [<backend>/]<server>"
Krzysztof Piotr Oledzki [Mon, 18 Feb 2008 00:26:35 +0000 (01:26 +0100)] 
[MEDIUM] Implement "track [<backend>/]<server>"

This patch implements ability to set the current state of one server
by tracking another one. It:
 - adds two variables: *tracknext, *tracked to struct server
 - implements findserver(), similar to findproxy()
 - adds "track" keyword accepting both "proxy/server" and "server" (assuming current proxy)
 - verifies if both checks and tracking is not enabled at the same time
 - changes set_server_down() to notify tracking server
 - creates set_server_up(), set_server_disabled(), set_server_enabled() by
   moving the code from process_chk() and adding notifications
 - changes stats to show a name of tracked server instead of Chk/Dwn/Dwntime(html)
   or by adding new variable (csv)

Changes from the previuos version:
 - it is possibile to track independently of the declaration order
 - one extra comma bug is fixed
 - new condition to check if there is no disable-on-404 inconsistency

17 years ago[BUILD] ensure that makefile understands USE_DLMALLOC=1
Willy Tarreau [Tue, 19 Feb 2008 09:53:32 +0000 (10:53 +0100)] 
[BUILD] ensure that makefile understands USE_DLMALLOC=1

USE_DLMALLOC=1 was ignored since last makefile update. It's better
to keep it running for existing setups.

17 years ago[BUG] do not apply timeout.connect in checks if unset
Willy Tarreau [Sun, 17 Feb 2008 10:34:10 +0000 (11:34 +0100)] 
[BUG] do not apply timeout.connect in checks if unset

tv_bound() does not consider infinite timeouts, so we must
check that timeout.connect is set before applying it to the
checks.

17 years ago[BUG] appsession lookup in URL does not work
Ryan Warnick [Sun, 17 Feb 2008 10:24:35 +0000 (11:24 +0100)] 
[BUG] appsession lookup in URL does not work

We've been trying to use the latest release (1.3.14.2) of haproxy  to do
sticky sessions.  Cookie insertion is not an option for us, although we
would much rather use it, as we are trying to work around a problem where
cookies are unreliable.  The appsession functionality only partially worked
(it wouldn't read the session id out of a query string) until we made the
following code change to the get_srv_from_appsession function in
proto_http.c.

17 years ago[TESTS] add test-pollers.cfg to easily report pollers in use
Willy Tarreau [Sat, 16 Feb 2008 19:02:48 +0000 (20:02 +0100)] 
[TESTS] add test-pollers.cfg to easily report pollers in use

17 years ago[BUG] timeout.check was not pre-set to eternity
Willy Tarreau [Fri, 15 Feb 2008 10:15:34 +0000 (11:15 +0100)] 
[BUG] timeout.check was not pre-set to eternity

If timeout.check was not set, check were using 0 as the timeout, causing
odd behaviours.

17 years ago[BUG] failed conns were sometimes incremented in the frontend!
Willy Tarreau [Mon, 10 Dec 2007 14:25:35 +0000 (15:25 +0100)] 
[BUG] failed conns were sometimes incremented in the frontend!

17 years ago[OPTIM] GCC4's builtin_expect() is suboptimal
Willy Tarreau [Sun, 27 Jan 2008 01:21:53 +0000 (02:21 +0100)] 
[OPTIM] GCC4's builtin_expect() is suboptimal

GCC4 is stupid (unbelievable news!).

When some code uses __builtin_expect(x != 0, 1), it really performs
the check of x != 0 then tests that the result is not zero! This is
a double check when only one was expected. Some performance drops
of 10% in the HTTP parser code have been observed due to this bug.

GCC 3.4 is fine though.

A solution consists in expecting that the tested value is 1. In
this case, it emits the correct code, but it's still not optimal
it seems. Finally the best solution is to ignore likely() and to
pray for the compiler to emit correct code. However, we still have
to fix unlikely() to remove the test there too, and to fix all
code which passed pointers overthere to pass integers instead.

17 years ago[OPTIM] used unsigned ints for HTTP state and message offsets
Willy Tarreau [Sat, 26 Jan 2008 23:34:10 +0000 (00:34 +0100)] 
[OPTIM] used unsigned ints for HTTP state and message offsets

State and offsets within http_msg were incorrectly set to signed int.
Turning them into unsigned slightly improved performance while reducing
code size.

17 years ago[BUILD] backend.c and checks.c did not build without tproxy !
Willy Tarreau [Thu, 14 Feb 2008 19:28:18 +0000 (20:28 +0100)] 
[BUILD] backend.c and checks.c did not build without tproxy !

missing #ifdefs. The right patch this time!

17 years agoRevert "[BUILD] backend.c and checks.c did not build without tproxy !"
Willy Tarreau [Thu, 14 Feb 2008 19:25:24 +0000 (20:25 +0100)] 
Revert "[BUILD] backend.c and checks.c did not build without tproxy !"

This reverts commit 3c3c0122f84d72eae1c4ef4b1826bfdbef7d95e6.
This commit was buggy as it also removed previous tproxy changes !

17 years ago[BUILD] backend.c and checks.c did not build without tproxy !
Willy Tarreau [Wed, 13 Feb 2008 21:22:56 +0000 (22:22 +0100)] 
[BUILD] backend.c and checks.c did not build without tproxy !

missing #ifdefs.

17 years ago[DOC] add a configuration entry for "server ... redir <prefix>"
Willy Tarreau [Wed, 13 Feb 2008 00:07:57 +0000 (01:07 +0100)] 
[DOC] add a configuration entry for "server ... redir <prefix>"

17 years ago[TESTS] add a test case for the server redirection mechanism
Willy Tarreau [Tue, 12 Feb 2008 23:57:06 +0000 (00:57 +0100)] 
[TESTS] add a test case for the server redirection mechanism

17 years ago[MEDIUM] completely implement the server redirection method
Willy Tarreau [Tue, 12 Feb 2008 23:45:24 +0000 (00:45 +0100)] 
[MEDIUM] completely implement the server redirection method

Now when a server has "redir <prefix>" on its config line, any HEAD or GET
request addressing it will lead to a 302 with Location set to "<prefix>"
immediately followed by the relative URI of the incoming request. This makes
it very easy to send redirect to browsers to check remote static servers, as
well as to provide redirection for remote sites when the local one is down.

17 years ago[MINOR] add configuration support for "redir" server keyword
Willy Tarreau [Tue, 12 Feb 2008 22:16:33 +0000 (23:16 +0100)] 
[MINOR] add configuration support for "redir" server keyword

The servers now support the "redir" keyword, making it possible to
return a 302 with the specified prefix in front of the request instead
of connecting to them. This is generally useful for multi-site load
balancing but may also serve in order to achieve very high traffic
rate.

The keyword has only been added to the config parser and to structures,
it's not used yet.

17 years ago[DOC] applied small fixes from early readers
Willy Tarreau [Thu, 31 Jan 2008 14:28:22 +0000 (15:28 +0100)] 
[DOC] applied small fixes from early readers

17 years ago[DOC] fix erroneous "useallbackups" option in the doc
Willy Tarreau [Wed, 30 Jan 2008 09:47:10 +0000 (10:47 +0100)] 
[DOC] fix erroneous "useallbackups" option in the doc

17 years ago[BUILD] update MacOS Makefile to build on newer versions
Willy Tarreau [Sun, 10 Feb 2008 16:00:13 +0000 (17:00 +0100)] 
[BUILD] update MacOS Makefile to build on newer versions

This update from Dan Zinngrabe enables building on MacOS 10.4 and 10.5.

17 years ago[DOC] Update a "contrib" file with a hint about a scheme used for formathing subjects
Krzysztof Piotr Oledzki [Sun, 3 Feb 2008 23:00:15 +0000 (00:00 +0100)] 
[DOC] Update a "contrib" file with a hint about a scheme used for formathing subjects

With each new patch I had to search for the e-mail from Willy
describing the schem used for formathing subjects. No more. ;)

17 years ago[MINOR] report correct section type for unknown keywords.
Willy Tarreau [Tue, 22 Jan 2008 15:44:08 +0000 (16:44 +0100)] 
[MINOR] report correct section type for unknown keywords.

An unknown keyword was always reported in section "listen" for any
section type (defaults, listen, frontend, backend, ...).

17 years ago[DOC] minor cleanup of the doc and notice to contributors
Willy Tarreau [Tue, 22 Jan 2008 11:25:31 +0000 (12:25 +0100)] 
[DOC] minor cleanup of the doc and notice to contributors

17 years ago[MEDIUM]: rework checks handling
Krzysztof Piotr Oledzki [Mon, 21 Jan 2008 00:54:06 +0000 (01:54 +0100)] 
[MEDIUM]: rework checks handling

This patch adds two new variables: fastinter and downinter.
When server state is:
 - non-transitionally UP -> inter (no change)
 - transitionally UP (going down), unchecked or transitionally DOWN (going up) -> fastinter
 - down -> downinter

It allows to set something like:
        server sr6 127.0.51.61:80 cookie s6 check inter 10000 downinter 20000 fastinter 500 fall 3 weight 40
In the above example haproxy uses 10000ms between checks but as soon as
one check fails fastinter (500ms) is used. If server is down
downinter (20000) is used or fastinter (500ms) if one check pass.
Fastinter is also used when haproxy starts.

New "timeout.check" variable was added, if set haproxy uses it as an additional
read timeout, but only after a connection has been already established. I was
thinking about using "timeout.server" here but most people set this
with an addition reserve but still want checks to kick out laggy servers.
Please also note that in most cases check request is much simpler
and faster to handle than normal requests so this timeout should be smaller.

I also changed the timeout used for check connections establishing.

Changes from the previous version:
 - use tv_isset() to check if the timeout is set,
 - use min("timeout connect", "inter") but only if "timeout check" is set
   as this min alone may be to short for full (connect + read) check,
 - debug code (fprintf) commented/removed
 - documentation

Compile tested only (sorry!) as I'm currently traveling but changes
are rather small and trivial.

17 years ago[BUG]: Restore clearing t->logs.bytes
Krzysztof Piotr Oledzki [Sun, 20 Jan 2008 22:27:02 +0000 (23:27 +0100)] 
[BUG]: Restore clearing t->logs.bytes

Commit 8b3977ffe36190e45fb974bf813bfbd935ac99a1 removed "t->logs.bytes_in = 0;"
but instead it should change it into "t->logs.bytes_out = 0;" as since
583bc966064e248771e75c253dddec7351afd8a2 counters are incremented not set.

It should be incremented in session_process_counters while sending data to a
client:
        bytes = s->rep->total - s->logs.bytes_out;
        s->logs.bytes_out = s->rep->total;

However, if we increment (set) s->logs.bytes_out while processing
"logasap", statistics get wrong values added for headers: 0 or even
negative if haproxy adds some headers itself.

To test it, please enable logasap and download one empty file and look at
stats. Without my fix information available on that page are invalid, for
example:

# pxname,svname,qcur,qmax,scur,smax,slim,stot,bin,bout,dreq,dresp,ereq,econ,eresp,wretr,wredis,status,weight,act,bck,chkfail,chkdown,lastchg,downtime,qlimit,pid,iid,sid,throttle,lbtot,
www,b,0,0,0,1,,1,24,-92,,0,,0,0,0,,UP,1,1,0,0,0,3121,0,,1,2,1,,1,
www,BACKEND,0,0,0,1,0,1,24,-92,0,0,,0,0,0,0,UP,1,1,0,,0,3121,0,,1,2,0,,1,

17 years ago[MINOR] fix configuration hint about timeouts
Willy Tarreau [Sun, 20 Jan 2008 22:25:06 +0000 (23:25 +0100)] 
[MINOR] fix configuration hint about timeouts

Do not talk about "clitimeout", "contimeout" or "srvtimeout"
anymore.

17 years ago[MINOR] use s->frt_addr as the server's address in transparent proxy
Willy Tarreau [Sat, 19 Jan 2008 12:46:35 +0000 (13:46 +0100)] 
[MINOR] use s->frt_addr as the server's address in transparent proxy

There's no point trying to check original dest addr with only one
method when doing transparent proxy as in full transparent mode,
the real destination address is required. Let's copy the one from
the frontend.

17 years ago[BUG] fix truncated responses with sepoll
Willy Tarreau [Fri, 18 Jan 2008 16:20:13 +0000 (17:20 +0100)] 
[BUG] fix truncated responses with sepoll

Due to the way Linux delivers EPOLLIN and EPOLLHUP, a closed connection
received after some server data sometimes results in truncated responses
if the client disconnects before server starts to respond. The reason
is that the EPOLLHUP flag is processed as an indication of end of
transfer while some data may remain in the system's socket buffers.

This problem could only be triggered with sepoll, although nothing should
prevent it from happening with normal epoll. In fact, the work factoring
performed by sepoll increases the risk that this bug appears.

The fix consists in making FD_POLL_HUP and FD_POLL_ERR sticky and that
they are only checked if FD_POLL_IN is not set, meaning that we have
read all pending data.

That way, the problem is definitely fixed and sepoll still remains about
17% faster than epoll since it can take into account all information
returned by the kernel.

17 years ago[BUILD] code did not build in full debug mode
Willy Tarreau [Fri, 18 Jan 2008 11:18:15 +0000 (12:18 +0100)] 
[BUILD] code did not build in full debug mode

17 years ago[BUG] log response byte count, not request
Willy Tarreau [Fri, 18 Jan 2008 10:16:32 +0000 (11:16 +0100)] 
[BUG] log response byte count, not request

Due to a shameless copy-paste typo, the number of bytes logged was
from the request and not the response. This bug has been present
for a long time.

17 years ago[DOC] added documentation about HTTP header manipulations
Willy Tarreau [Thu, 17 Jan 2008 19:35:34 +0000 (20:35 +0100)] 
[DOC] added documentation about HTTP header manipulations

This section has been inserted before the logging section.

17 years ago[DOC] document all req* and rsp* keywords.
Willy Tarreau [Thu, 17 Jan 2008 18:01:39 +0000 (19:01 +0100)] 
[DOC] document all req* and rsp* keywords.

17 years ago[DOC] all server parameters have been documented
Willy Tarreau [Thu, 17 Jan 2008 11:05:32 +0000 (12:05 +0100)] 
[DOC] all server parameters have been documented

17 years ago[DOC] added "server", "source" and "stats" keywords
Willy Tarreau [Wed, 16 Jan 2008 15:17:06 +0000 (16:17 +0100)] 
[DOC] added "server", "source" and "stats" keywords

The documentation now lists all keywords except the req* and rsp*. The
"server" keyword has been documented for mandatory parameters. Specific
settings are still waiting to be written in a dedicated section.

17 years ago[BUG] build failed on CONFIG_HAP_LINUX_TPROXY without CONFIG_HAP_CTTPROXY
Willy Tarreau [Mon, 14 Jan 2008 15:36:15 +0000 (16:36 +0100)] 
[BUG] build failed on CONFIG_HAP_LINUX_TPROXY without CONFIG_HAP_CTTPROXY

changed #ifdef

17 years ago[MEDIUM] fix server health checks source address selection
Willy Tarreau [Sun, 13 Jan 2008 17:40:14 +0000 (18:40 +0100)] 
[MEDIUM] fix server health checks source address selection

The source address selection for health checks did not consider
the new transparent proxy method. Rely on the same unified function
as the other connect() calls.

This patch also fixes a bug by which the proxy's source address was
ignored if cttproxy was used.

17 years ago[BUG] fix overlapping server flags
Willy Tarreau [Sun, 13 Jan 2008 17:12:24 +0000 (18:12 +0100)] 
[BUG] fix overlapping server flags

Server flags SRV_GOINGDOWN, SRV_WARMINGUP were overlapping
SRV_TPROXY_*.

17 years ago[BUG] use backend's source and not server's source with tproxy
Willy Tarreau [Sun, 13 Jan 2008 17:10:06 +0000 (18:10 +0100)] 
[BUG] use backend's source and not server's source with tproxy

copy-paste typo.

17 years ago[MINOR] add transparent proxy support for balabit's Tproxy v4
Willy Tarreau [Sun, 13 Jan 2008 16:37:16 +0000 (17:37 +0100)] 
[MINOR] add transparent proxy support for balabit's Tproxy v4

Balabit's TPROXY version 4 which replaces CTTPROXY provides a similar
API to the previous proxy, but relies on IP_FREEBIND instead of
IP_TRANSPARENT. Let's add it.

17 years ago[MEDIUM] add non-local bind to connect() on Linux
Willy Tarreau [Sun, 13 Jan 2008 15:31:17 +0000 (16:31 +0100)] 
[MEDIUM] add non-local bind to connect() on Linux

Using some Linux kernel patches which add the IP_TRANSPARENT
SOL_IP option , it is possible to bind to a non-local address
on without having resort to any sort of NAT, thus causing no
performance degradation.

This is by far faster and cleaner than the previous CTTPROXY
method. The code has been slightly changed in order to remain
compatible with CTTPROXY as a fallback for the new method when
it does not work.

It is not needed anymore to specify the outgoing source address
for connect, it can remain 0.0.0.0.

17 years ago[MEDIUM] support fully transparent proxy on Linux (USE_LINUX_TPROXY)
Willy Tarreau [Sun, 13 Jan 2008 13:49:51 +0000 (14:49 +0100)] 
[MEDIUM] support fully transparent proxy on Linux (USE_LINUX_TPROXY)

Using some Linux kernel patches, it is possible to redirect non-local
traffic to local sockets when IP forwarding is enabled. In order to
enable this option, we introduce the "transparent" option keyword on
the "bind" command line. It will make the socket reachable by remote
sources even if the destination address does not belong to the machine.

17 years ago[BUG] connect_server: server might not exist when sending error report
Willy Tarreau [Sat, 12 Jan 2008 21:22:34 +0000 (22:22 +0100)] 
[BUG] connect_server: server might not exist when sending error report

In connect_server(), we may send an alert with the server name while
the server might not exist, eg in dispatch mode.

17 years ago[DOC] added documentation for "option tcplog" to "use_backend"
Willy Tarreau [Fri, 11 Jan 2008 15:28:18 +0000 (16:28 +0100)] 
[DOC] added documentation for "option tcplog" to "use_backend"

- options tcplog, tcpsplice and transparent have been documented.
- keywords "srvtimeout", "timeout queue", "timeout server" and
  "timeout tarpit" have been documented
- keywords "transparent" and "use_backend" have been documented

Only "server", "source" and "stats *" remain undocumented

17 years ago[DOC] document options nolinger to ssl-hello-chk
Willy Tarreau [Tue, 8 Jan 2008 18:50:52 +0000 (19:50 +0100)] 
[DOC] document options nolinger to ssl-hello-chk

Options nolinger, persist, smtpchk and ssl-hello-chk have been
documented. All keywords and options up to and including option
tcpka are now documented.

17 years ago[BUG] fix typo in redispatched connection
Willy Tarreau [Sun, 6 Jan 2008 22:46:19 +0000 (23:46 +0100)] 
[BUG] fix typo in redispatched connection

a copy-paste typo was present in the reconnection code responsible
for respatching. The client's FSM would not be re-evaluated if an
error occurred. It looks harmless but better fix it.

17 years ago[MEDIUM] add a turn-around state of one second after a connection failure
Willy Tarreau [Sun, 6 Jan 2008 22:34:21 +0000 (23:34 +0100)] 
[MEDIUM] add a turn-around state of one second after a connection failure

Several users have complained that when haproxy gets a connection
failure due to an active reject from a server, it immediately
retries, often leading to the same situation being repeated until
the retry counter reaches zero.

Now if a connection error shows up, a turn-around state of 1 second
is applied before retrying. This is performed by faking a connection
timeout in order not to touch much code. However, a cleaner method
would involve an extra state.

17 years ago[MEDIUM]: Count retries and redispatches also for servers, fix redistribute_pending...
Krzysztof Piotr Oledzki [Sun, 6 Jan 2008 15:36:16 +0000 (16:36 +0100)] 
[MEDIUM]: Count retries and redispatches also for servers, fix redistribute_pending, extend logs, %d->%u cleanup

This patch extends a little previously added functionality to also
count retries and redispatches for servers. Now it is possible to know
which server causes redispatches as it is not always the same that takes
most retries.

While working with the code I found that redistribute_pending() does not increment
srv->redispatches && be->redispatches. I don't know how to test it but
I think the fix is correct. If not I can withdraw it.

I also extended logs to show how many retries were done and if redispatching
was necessary ('+'). I'm using an additional session flag SN_REDISP to match
redispatched connections. I had to rearrange all defines in session.h to make
more room for it.

The documentation about logs was also fixed a little (sorry, english only),
as current version uses totally different format. BTW: examples are still
outdated, maybe next time...

Finally, I changed %d -> %u for retries/redispatches as those variables
are declared as unsigned.

17 years ago[BUG] increment server connections for each connect()
Willy Tarreau [Mon, 10 Dec 2007 14:05:42 +0000 (15:05 +0100)] 
[BUG] increment server connections for each connect()

It was abnormal to see more connect errors than connect attempts.
This was caused by the fact that the server's connection count was
not incremented for failed connect() attempts.

Now the per-server connections are correctly incremented for each
connect() attempt. This includes the retries too. The number of
connections effectively served by a server will then be :

   srv->cum_sess - srv->errors - srv->warnings

17 years ago[MINOR] tarpit timeout is also allowed in backends
Willy Tarreau [Sun, 6 Jan 2008 12:40:03 +0000 (13:40 +0100)] 
[MINOR] tarpit timeout is also allowed in backends

Since the tarpit action may be set in backends too, its timeout
must be configurable there.

17 years ago[MEDIUM] introduce "timeout http-request" in frontends
Willy Tarreau [Sun, 6 Jan 2008 12:24:40 +0000 (13:24 +0100)] 
[MEDIUM] introduce "timeout http-request" in frontends

In order to offer DoS protection, it may be required to lower the maximum
accepted time to receive a complete HTTP request without affecting the client
timeout. This helps protecting against established connections on which
nothing is sent. The client timeout cannot offer a good protection against
this abuse because it is an inactivity timeout, which means that if the
attacker sends one character every now and then, the timeout will not
trigger. With the HTTP request timeout, no matter what speed the client
types, the request will be aborted if it does not complete in time.

17 years ago[OPTIM] introduce global parameter "tune.maxaccept"
Willy Tarreau [Sun, 6 Jan 2008 10:22:57 +0000 (11:22 +0100)] 
[OPTIM] introduce global parameter "tune.maxaccept"

This new parameter makes it possible to override the default
number of consecutive incoming connections which can be
accepted on a socket. By default it is not limited on single
process mode, and limited to 8 in multi-process mode.

17 years ago[MINOR] add support for the "backlog" parameter
Willy Tarreau [Sun, 6 Jan 2008 09:55:10 +0000 (10:55 +0100)] 
[MINOR] add support for the "backlog" parameter

Add the "backlog" parameter to frontends, to give hints to
the system about the approximate listen backlog desired size.

In order to protect against SYN flood attacks, one solution is
to increase the system's SYN backlog size. Depending on the
system, sometimes it is just tunable via a system parameter,
sometimes it is not adjustable at all, and sometimes the system
relies on hints given by the application at the time of the
listen() syscall. By default, HAProxy passes the frontend's
maxconn value to the listen() syscall. On systems which can
make use of this value, it can sometimes be useful to be able
to specify a different value, hence this backlog parameter.

17 years ago[DOC] document options forwardfor to logasap
Willy Tarreau [Sun, 6 Jan 2008 07:57:02 +0000 (08:57 +0100)] 
[DOC] document options forwardfor to logasap

Options forwardfor, http_proxy, httpchk, httpclose, httplog and logasap
have been documented.

17 years ago[STATS] add support for "show info" on the unix socket
Willy Tarreau [Thu, 3 Jan 2008 09:19:15 +0000 (10:19 +0100)] 
[STATS] add support for "show info" on the unix socket

It is sometimes required to know some informations such as the
process uptime when consulting statistics. This patch adds the
"show info" command to query those informations on the UNIX
socket.

17 years ago[BUILD] major rework of the GNU Makefile
Willy Tarreau [Wed, 2 Jan 2008 19:48:34 +0000 (20:48 +0100)] 
[BUILD] major rework of the GNU Makefile

The build process was getting annoying under some conditions,
especially on platforms which are used to set CFLAGS, as well
as those which set a lot of complex defines. The new Makefile
takes care of this situation by not mixing TARGET, CPU and user
values, and by making privileging the pre-setting of common
variables with the ability to override them.

Now CFLAGS and LDFLAGS are set by default and may be overridden
without the risk of breaking useful defines. Options are better
dealt with, and as a bonus, it was possible to merge the FreeBSD
and OpenBSD targets into the common GNU Makefile.

The report of build options by "haproxy -vv" has been slightly
adapted to the new mode. Options implied by architecture are not
reported, only user-specified options are. It is also possible to
add options which will not be reported in order not to mangle the
output when specifying dirty informations such as URLs...

The Makefile was copiously documented and it should be easier to
build for any target now. Backwards compatibility with older
build processes was kept, and warnings are emitted for deprecated
build options.

17 years ago[DOC] document more options
Willy Tarreau [Fri, 28 Dec 2007 16:42:56 +0000 (17:42 +0100)] 
[DOC] document more options

All options up to and including "forceclose" have been documented.

17 years ago[DOC] large update to the configuration manual
Willy Tarreau [Thu, 27 Dec 2007 17:26:09 +0000 (18:26 +0100)] 
[DOC] large update to the configuration manual

Keywords from "errorloc" to "monitor-uri" inclusive have been added.
Some fixes applied too.

17 years ago[MEDIUM]: Inversion for options
Krzysztof Oledzki [Tue, 25 Dec 2007 01:40:22 +0000 (02:40 +0100)] 
[MEDIUM]: Inversion for options

This patch adds a possibility to invert most of available options by
introducing the "no" keyword, available as an additional prefix.
If it is found arguments are shifted left and an additional flag (inv)
is set.

It allows to use all options from a current defaults section, except
the selected ones, for example:

-- cut here --
defaults
        contimeout      4200
        clitimeout      50000
        srvtimeout      40000
        option contstats

listen stats 1.2.3.4:80
no option contstats
-- cut here --

Currenly inversion works only with the "option" keyword.

The patch also moves last_checks calculation at the end of the readcfgfile()
function and changes "PR_O_FORCE_CLO | PR_O_HTTP_CLOSE" into "PR_O_FORCE_CLO"
in cfg_opts so it is possible to invert forceclose without breaking httpclose
(and vice versa) and to invert tcpsplice in one proxy but to keep a proper
last_checks value when tcpsplice is used in another proxy. Now, the code
checks for PR_O_FORCE_CLO everywhere it checks for PR_O_HTTP_CLOSE.

I also decided to depreciate "redisp" and "redispatch" keywords as it is IMHO
better to use "option redispatch" which can be inverted.

Some useful documentation were added and at the same time I sorted
(alfabetically) all valid options both in the code and the documentation.

17 years ago[DOC] big update to the configuration manual
Willy Tarreau [Mon, 24 Dec 2007 15:55:16 +0000 (16:55 +0100)] 
[DOC] big update to the configuration manual

New in this version is a small intro to HTTP, then a detailed
explanation of the following keywords :

  acl, appsession, balance, bind, block, capture cookie,
  capture request header, capture response header, clitimeout,
  contimeout, cookie, default_backend, disabled, enabled, errorfile,
  http-check disable-on-404, monitor fail, option contstats,
  timeout client, timeout clitimeout, timeout connect,
  timeout contimeout.

Others will be alphabetically added.

17 years ago[BUG] hot reconfiguration failed because of a wrong error check
Willy Tarreau [Thu, 20 Dec 2007 22:05:50 +0000 (23:05 +0100)] 
[BUG] hot reconfiguration failed because of a wrong error check

The error check in return of start_proxies checked for exact ERR_RETRYABLE
but did not consider the return as a bit field. The function returned both
ERR_RETRYABLE and ERR_ALERT, hence the problem.

17 years ago[BUG] transparent proxy address was ignored in backend
Willy Tarreau [Fri, 14 Dec 2007 18:54:43 +0000 (19:54 +0100)] 
[BUG] transparent proxy address was ignored in backend

When the "source x.x.x.x usesrc y.y.y.y" statement was present in a
backend, the y.y.y.y address was fetched from the server instead of
the backend.

17 years ago[RELEASE] Released version 1.3.14 v1.3.14
Willy Tarreau [Thu, 6 Dec 2007 00:25:44 +0000 (01:25 +0100)] 
[RELEASE] Released version 1.3.14

Released version 1.3.14 with the following main changes :
    - New option http_proxy (Alexandre Cassen)
    - add support for "maxqueue" to limit server queue overload (Elijah Epifanov)
    - Check for duplicated conflicting proxies (Krzysztof Oledzki)
    - stats: report server and backend cumulated downtime (Krzysztof Oledzki)
    - use backends only with use_backend directive (Krzysztof Oledzki)
    - Handle long lines properly (Krzysztof Oledzki)
    - Implement and use generic findproxy and relax duplicated proxy check (Krzysztof Oledzki)
    - continous statistics (Krzysztof Oledzki)
    - add support for logging via a UNIX socket (Robert Tsai)
    - fix error checking in strl2ic/strl2uic()
    - fix calls to localtime()
    - provide easier-to-use ultoa_* functions
    - provide easy-to-use limit_r and LIM2A* macros
    - add a simple test for the status page
    - move error codes to common/errors.h
    - silent warning about LIST_* being redefined on OpenBSD
    - add socket address length to the protocols
    - group PR_O_BALANCE_* bits into a checkable value
    - externalize the "balance" option parser to backend.c
    - introduce the "url_param" balance method
    - make default_backend work in TCP mode too
    - disable warning about localtime_r on Solaris
    - adjust error messages about conflicting proxies
    - avoid calling some layer7 functions if not needed
    - simplify error path in event_accept()
    - add an options field to the listeners
    - added a new state to listeners
    - unbind_listener() must use fd_delete() and not close()
    - add a generic unbind_listener() primitive
    - add a generic delete_listener() primitive
    - add a generic unbind_all_listeners() primitive
    - create proto_tcp and move initialization of proxy listeners
    - stats: report numerical process ID, proxy ID and server ID
    - relative_pid was not initialized
    - missing header names in raw stats output
    - fix missing parenthesis in check_response_for_cacheability
    - small optimization on session_process_counters()
    - merge ebtree version 3.0
    - make ebtree headers multiple-include compatible
    - ebtree: include config.h for REGPRM*
    - differentiate between generic LB params and map-specific ones
    - add a weight divisor to the struct proxy
    - implement the Fast Weighted Round Robin (FWRR) algo
    - include filltab25.c to experiment on FWRR for dynamic weights
    - merge test-fwrr.cfg to validate dynamic weights
    - move the load balancing algorithm to be->lbprm.algo
    - change server check result to a bit field
    - implement "http-check disable-on-404" for graceful shutdown
    - secure the calling conditions of ->set_server_status_{up,down}
    - report disabled servers as "NOLB" when they are still UP
    - document the "http-check disable-on-404" option
    - http-check disable-on-404 is not limited to HTTP mode
    - add a test file for disable-on-404
    - use distinct bits per load-balancing algorithm type
    - implement the slowstart parameter for servers
    - document the server's slowstart parameter
    - stats: report the server warm up status in a "throttle" column
    - fix 2 minor issues on AIX
    - add the "nbsrv" ACL verb
    - add the "fail" condition to monitor requests
    - remove a warning from gcc due to htons() in standard.c
    - fwrr: ensure that we never overflow in placements
    - store the build options to report with -vv
    - fix the status return of the init script (R.I. Pienaar)
    - stats: real time monitoring script for unix socket (Prizee)
    - document "nbsrv" and "monitor fail"
    - restrict the set of allowed characters for identifiers
    - implement a time parsing function
    - add support for time units in the configuration
    - add a bit of documentation about timers
    - introduce separation between contimeout, and tarpit + queue
    - introduce the "timeout" keyword
    - grouped all timeouts in one structure
    - slowstart is in ms, not seconds
    - slowstart: ensure we don't start with a null weight
    - report the number of times each server was selected
    - fix build on AIX due to recent log changes
    - fix build on Solaris due to recent log changes

17 years ago[BUILD] fix build on Solaris due to recent log changes
Willy Tarreau [Wed, 5 Dec 2007 23:53:51 +0000 (00:53 +0100)] 
[BUILD] fix build on Solaris due to recent log changes

Solaris, as well as many other unixes doesn't know about sun_len
for UNIX domain sockets. It does not honnor the __SOCKADDR_COMMON
macro either. After looking at MacOS-X man (which is the same as
BSD man), OpenBSD man, and examples on the net, it appears that
those which support sun_len do not actually use it, or at least
ignore it as long as it's zero. Since all the sockaddr structures
are zeroed prior to being filled, it causes no problem not to set
sun_len, and this fixes build on other platforms.

Another problem on Solaris was that the "sun" name is already
defined as a macro returning a number, so it was necessary to
rename it.

17 years ago[BUILD] fix build on AIX due to recent log changes
Willy Tarreau [Wed, 5 Dec 2007 10:11:55 +0000 (11:11 +0100)] 
[BUILD] fix build on AIX due to recent log changes

17 years ago[MEDIUM] add support for logging via a UNIX socket
Robert Tsai [Wed, 5 Dec 2007 09:47:29 +0000 (10:47 +0100)] 
[MEDIUM] add support for logging via a UNIX socket

The code in haproxy-1.3.13.1 only supports syslogging to an internet
address. The attached patch:

 - Adds support for syslogging to a UNIX domain socket (e.g., /dev/log).
   If the address field begins with '/' (absolute file path), then
   AF_UNIX is used to construct the socket. Otherwise, AF_INET is used.

 - Achieves clean single-source build on both Mac OS X and Linux
   (sockaddr_in.sin_len and sockaddr_un.sun_len field aren't always present).

For handling sendto() failures in send_log(), it appears that the existing
code is fine (no need to close/recreate socket) for both UDP and UNIX-domain
syslog server. So I left things alone (did not close/recreate socket).
Closing/recreating socket after each failure would also work, but would lead
to increased amount of unnecessary socket creation/destruction if syslog is
temporarily unavailable for some reason (especially for verbose loggers).

Please consider this patch for inclusion into the upstream haproxy codebase.

17 years ago[STATS] report the number of times each server was selected
Willy Tarreau [Wed, 5 Dec 2007 09:34:49 +0000 (10:34 +0100)] 
[STATS] report the number of times each server was selected

One user reported that an indicator was missing in the statistics:
the number of times each server was selected by load balancing. It
is in fact the total number of sessions assigned to a server by the
load balancing algorithm. It should directly reflect the weight for
"fair" algorithms such as round-robin, since it will not account for
persistant connections.

It should help a lot tuning each server's weight depending on the
load it receives.

17 years ago[MEDIUM] slowstart: ensure we don't start with a null weight
Willy Tarreau [Mon, 3 Dec 2007 01:04:00 +0000 (02:04 +0100)] 
[MEDIUM] slowstart: ensure we don't start with a null weight

Because of a divide, it was possible to have a null weight during
a slowstart, which is pretty annoying, especially with a single
server and a long slowstart.

Also, fix the way we report the values in the stats page to avoid
confusion.

17 years ago[BUG] slowstart is in ms, not seconds
Willy Tarreau [Mon, 3 Dec 2007 00:51:45 +0000 (01:51 +0100)] 
[BUG] slowstart is in ms, not seconds

17 years ago[CLEANUP] grouped all timeouts in one structure
Willy Tarreau [Mon, 3 Dec 2007 00:38:36 +0000 (01:38 +0100)] 
[CLEANUP] grouped all timeouts in one structure

All known timeouts in a proxy have been grouped into a
"timeout" sub-structure.

17 years ago[MEDIUM] introduce the "timeout" keyword
Willy Tarreau [Mon, 3 Dec 2007 00:30:13 +0000 (01:30 +0100)] 
[MEDIUM] introduce the "timeout" keyword

A new "timeout" keyword replaces old "{con|cli|srv}timeout", and
provides the ability to independantly set the following timeouts :

  - client
  - tarpit
  - queue
  - connect
  - server
  - appsession

Additionally, the "clitimeout", "contimeout" and "srvtimeout" values
are supported but deprecated. No warning is emitted yet when they are
used since the option is very new.

Other timeouts should follow soon now.

17 years ago[MEDIUM] introduce separation between contimeout, and tarpit + queue
Willy Tarreau [Sun, 2 Dec 2007 23:36:16 +0000 (00:36 +0100)] 
[MEDIUM] introduce separation between contimeout, and tarpit + queue

Now the connect timeout, tarpit timeout and queue timeout are
distinct. In order to retain compatibility with older versions,
if either queue or tarpit is left unset both in the proxy and
in the default proxy, then it is inherited from the connect
timeout as before.

17 years ago[DOC] add a bit of documentation about timers
Willy Tarreau [Sun, 2 Dec 2007 21:27:38 +0000 (22:27 +0100)] 
[DOC] add a bit of documentation about timers

17 years ago[MEDIUM] add support for time units in the configuration
Willy Tarreau [Sun, 2 Dec 2007 21:15:14 +0000 (22:15 +0100)] 
[MEDIUM] add support for time units in the configuration

It is not always handy to manipulate large values exprimed
in milliseconds for timeouts. Also, some values are entered
in seconds (such as the stats refresh interval). This patch
adds support for time units. It knows about 'us', 'ms', 's',
'm', 'h', and 'd'. It automatically converts each value into
the caller's expected unit. Unit-less values are still passed
unchanged.

The unit must be passed as a suffix to the number. For instance:

     clitimeout 15m

If any character is not understood, an error is returned.

17 years ago[MINOR] implement a time parsing function
Willy Tarreau [Sun, 2 Dec 2007 21:00:35 +0000 (22:00 +0100)] 
[MINOR] implement a time parsing function

This new function accepts inputs in various default units, from
the microsecond to the day. It detects suffixes after numbers
and performs the appropriate conversions between the user's unit
and the program's unit, considering a unit-less number in the
default unit.

17 years ago[MEDIUM] restrict the set of allowed characters for identifiers
Willy Tarreau [Sun, 2 Dec 2007 17:45:09 +0000 (18:45 +0100)] 
[MEDIUM] restrict the set of allowed characters for identifiers

In order to avoid issues in the future, we want to restrict
the set of allowed characters for identifiers. Starting from
now, only A-Z, a-z, 0-9, '-', '_', '.' and ':' will be allowed
for a proxy, a server or an ACL name.

A test file has been added to check the restriction.

17 years ago[DOC] document "nbsrv" and "monitor fail"
Willy Tarreau [Sun, 2 Dec 2007 16:31:20 +0000 (17:31 +0100)] 
[DOC] document "nbsrv" and "monitor fail"

17 years ago[TESTS] stats: real time monitoring script for unix socket.
Willy Tarreau [Sun, 2 Dec 2007 13:11:36 +0000 (14:11 +0100)] 
[TESTS] stats: real time monitoring script for unix socket.

Julien Antony and Matthieu Huguet of Prizee provided this convenient
script to monitor activity via the unix socket. It requires presence
of the "socat" utility. Example of usage :

lb1:/home/scripts# ./stats_haproxy.sh -s prizee_media,FRONTEND
189 session/s (avg: 189 )       1040 concurrent sessions
182 session/s (avg: 185 )       1022 concurrent sessions
164 session/s (avg: 178 )       1015 concurrent sessions
175 session/s (avg: 177 )       1015 concurrent sessions
226 session/s (avg: 187 )       1031 concurrent sessions
252 session/s (avg: 198 )       1056 concurrent sessions
273 session/s (avg: 208 )       1072 concurrent sessions
268 session/s (avg: 216 )       1080 concurrent sessions
271 session/s (avg: 222 )       1131 concurrent sessions
241 session/s (avg: 224 )       1128 concurrent sessions
215 session/s (avg: 223 )       1136 concurrent sessions
206 session/s (avg: 221 )       1140 concurrent sessions

17 years ago[MINOR] fix the status return of the init script
Willy Tarreau [Sun, 2 Dec 2007 13:02:52 +0000 (14:02 +0100)] 
[MINOR] fix the status return of the init script

R.I. Pienaar reported to me that the init script provided with
haproxy did not correctly report the status of the rhstatus()
function. In fact this was caused by the "exit $RETVAL" instead
of "exit $?" at the end.

17 years ago[MINOR] store the build options to report with -vv
Willy Tarreau [Sun, 2 Dec 2007 10:28:59 +0000 (11:28 +0100)] 
[MINOR] store the build options to report with -vv

Sometimes it is useful to find out how a given binary version was
built. The build compiler and options are now provided for this,
and it's possible to get them with the -vv option.

17 years ago[CLEANUP] fwrr: ensure that we never overflow in placements
Willy Tarreau [Sun, 2 Dec 2007 10:01:23 +0000 (11:01 +0100)] 
[CLEANUP] fwrr: ensure that we never overflow in placements

Now we can compute the max place depending on the number of servers,
maximum weight and weight scale. The formula has been stored as a
comment so that it's easy to choose between smooth weight ramp up
and high number of servers. The default scale has been set to 16,
which permits 4000 servers with a granularity of 6% in the worst
case (weight=1).

17 years ago[CLEANUP] remove a warning from gcc due to htons() in standard.c
Willy Tarreau [Sun, 2 Dec 2007 09:55:56 +0000 (10:55 +0100)] 
[CLEANUP] remove a warning from gcc due to htons() in standard.c

Due to the fact that htons is defined as a macro, it's dangerous
to call it with auto-incremented arguments such as htons(f(++x)) :

src/standard.c: In function 'url2sa':
src/standard.c:291: warning: operation on 'curr' may be undefined

The solution is simply to store the intermediate result an pass it
to htons() at once.

17 years ago[MEDIUM] add the "fail" condition to monitor requests
Willy Tarreau [Fri, 30 Nov 2007 19:51:32 +0000 (20:51 +0100)] 
[MEDIUM] add the "fail" condition to monitor requests

Under certain circumstances, it is very useful to be able to fail some
monitor requests. One specific case is when the number of servers in
the backend falls below a certain level. The new "monitor fail" construct
followed by either "if"/"unless" <condition> makes it possible to specify
ACL-based conditions which will make the monitor return 503 instead of
200. Any number of conditions can be passed. Another use may be to limit
the requests to local networks only.

17 years ago[MEDIUM] add the "nbsrv" ACL verb
Willy Tarreau [Fri, 30 Nov 2007 19:48:53 +0000 (20:48 +0100)] 
[MEDIUM] add the "nbsrv" ACL verb

The new "nbsrv" ACL verb matches the number of active servers in a backend.
By default, it applies to the backend where it is declared, but optionally
it can receive the name of another backend as an argument in parenthesis.

It counts the number of enabled active servers first, then the number of
enabled backup servers.

17 years ago[BUILD] fix 2 minor issues on AIX
Willy Tarreau [Fri, 30 Nov 2007 17:38:35 +0000 (18:38 +0100)] 
[BUILD] fix 2 minor issues on AIX

AIX does not know about MSG_DONTWAIT. Fortunately, nearly all sockets
are already set to O_NONBLOCK, so it's not even required to change the
code.  It was only necessary to add this fcntl to the log socket which
lacked it.  The MSG_DONTWAIT value has been defined to zero when unset
in order to make the code cleaner and more portable.

Also, on AIX, "hz" is defined, which causes a problem with one function
parameter in time.c. It's enough to rename the parameter there. Last,
fix a missing #include <string.h> in proxy.c.

17 years ago[MINOR] stats: report the server warm up status in a "throttle" column
Willy Tarreau [Fri, 30 Nov 2007 17:16:29 +0000 (18:16 +0100)] 
[MINOR] stats: report the server warm up status in a "throttle" column

A new "throttle" column has been added to HTML and RAW stats to indicate
in percent, the level of throttling due to server warmup. The column is
empty at 100%.