]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
13 years agoMEDIUM: log: Use linked lists for loggers
William Lallemand [Wed, 12 Oct 2011 15:50:54 +0000 (17:50 +0200)] 
MEDIUM: log: Use linked lists for loggers

This patch settles the 2 loggers limitation.
Loggers are now stored in linked lists.

Using "global log", the global loggers list content is added at the end
of the current proxy list. Each "log" entries are added at the end of
the proxy list.

"no log" flush a logger list.

13 years agoMINOR: config: tolerate server "cookie" setting in non-HTTP mode
Willy Tarreau [Mon, 31 Oct 2011 12:49:26 +0000 (13:49 +0100)] 
MINOR: config: tolerate server "cookie" setting in non-HTTP mode

Up to now, if a cookie value was specified on a server when the proxy was
in TCP mode, it would cause a fatal error. Now we only report a warning,
since the cookie will be ignored. This makes it easier to generate configs
from scripts.

13 years agoBUG/MEDIUM: checks: fix slowstart behaviour when server tracking is in use
Willy Tarreau [Mon, 31 Oct 2011 10:53:20 +0000 (11:53 +0100)] 
BUG/MEDIUM: checks: fix slowstart behaviour when server tracking is in use

Ludovic Levesque reported and diagnosed an annoying bug. When a server is
configured to track another one and has a slowstart interval set, it's
assigned a minimal weight when the tracked server goes back up but keeps
this weight forever.

This is because the throttling during the warmup phase is only computed
in the health checking function.

After several attempts to resolve the issue, the only real solution is to
split the check processing task in two tasks, one for the checks and one
for the warmup. Each server with a slowstart setting has a warmum task
which is responsible for updating the server's weight after a down to up
transition. The task does not run in othe situations.

In the end, the fix is neither complex nor long and should be backported
to 1.4 since the issue was detected there first.

13 years agoCLEANUP: rename possibly confusing struct field "tracked"
Willy Tarreau [Fri, 28 Oct 2011 13:35:33 +0000 (15:35 +0200)] 
CLEANUP: rename possibly confusing struct field "tracked"

When reading the code, the "tracked" member of a server makes one
think the server is tracked while it's the opposite, it's a pointer
to the server being tracked. This is particularly true in constructs
such as :

if (srv->tracked) {

Since it's the second time I get caught misunderstanding it, let's
rename it to "track" to avoid the confusion.

13 years agoBUG/MINOR: fix a segfault when parsing a config with undeclared peers
Willy Tarreau [Fri, 28 Oct 2011 12:16:49 +0000 (14:16 +0200)] 
BUG/MINOR: fix a segfault when parsing a config with undeclared peers

Baptiste Assmann reported that a config where a non-existing peers
section is referenced by a stick-table causes a segfault after displaying
the error. This is caused by the freeing of the peers. Setting it to NULL
after displaying the error fixes the issue.

13 years agoMEDIUM: tune.http.maxhdr makes it possible to configure the maximum number of HTTP...
Willy Tarreau [Mon, 24 Oct 2011 17:14:41 +0000 (19:14 +0200)] 
MEDIUM: tune.http.maxhdr makes it possible to configure the maximum number of HTTP headers

For a long time, the max number of headers was taken as a part of the buffer
size. Since the header size can be configured at runtime, it does not make
much sense anymore.

Nothing was making it necessary to have a static value, so let's turn this into
a tunable with a default value of 101 which equals what was previously used.

13 years agoOPTIM/MINOR: move the hdr_idx pools out of the proxy struct
Willy Tarreau [Mon, 24 Oct 2011 16:15:04 +0000 (18:15 +0200)] 
OPTIM/MINOR: move the hdr_idx pools out of the proxy struct

It makes no sense to have one pointer to the hdr_idx pool in each proxy
struct since these pools do not depend on the proxy. Let's have a common
pool instead as it is already the case for other types.

13 years agoBUILD/MINOR: silent a build warning in src/pipe.c (fcntl)
Willy Tarreau [Mon, 24 Oct 2011 15:09:22 +0000 (17:09 +0200)] 
BUILD/MINOR: silent a build warning in src/pipe.c (fcntl)

13 years agoOPTIM/MINOR: make it possible to change pipe size (tune.pipesize)
Willy Tarreau [Sun, 23 Oct 2011 19:14:29 +0000 (21:14 +0200)] 
OPTIM/MINOR: make it possible to change pipe size (tune.pipesize)

By default, pipes are the default size for the system. But sometimes when
using TCP splicing, it can improve performance to increase pipe sizes,
especially if it is suspected that pipes are not filled and that many
calls to splice() are performed. This has an impact on the kernel's
memory footprint, so this must not be changed if impacts are not understood.

13 years agoOPTIM/MINOR: move struct sockaddr_storage to the tail of structs
Willy Tarreau [Fri, 21 Oct 2011 16:51:57 +0000 (18:51 +0200)] 
OPTIM/MINOR: move struct sockaddr_storage to the tail of structs

Struct sockaddr_storage is huge (128 bytes) and severely impacts the
cache. It also displaces other struct members, causing them to have
larger relative offsets. By moving these few occurrences to the end
of the structs which host them, we can reduce the code size by no less
than 2 kB !

13 years agoDOC: indicate that cookie "prefix" and "indirect" should not be mixed
Willy Tarreau [Mon, 17 Oct 2011 10:24:55 +0000 (12:24 +0200)] 
DOC: indicate that cookie "prefix" and "indirect" should not be mixed

When prefix and indirect are used together, a client which connects to
a server with a cookie will never get any cookie update from this server,
which will be removed by the "indirect" option.

13 years agoMINOR: halog: add support for matching queued requests
Willy Tarreau [Thu, 13 Oct 2011 11:28:36 +0000 (13:28 +0200)] 
MINOR: halog: add support for matching queued requests

-Q outputs all requests which went through at least one queue.
-QS outputs all requests which went through a server queue.

13 years agoBUG/MINOR: fix options forwardfor if-none when an alternative header name is specified
Sagi Bashari [Sat, 8 Oct 2011 20:48:48 +0000 (22:48 +0200)] 
BUG/MINOR: fix options forwardfor if-none when an alternative header name is specified

13 years agoMINOR: remove the client/server side distinction in SI addresses
Willy Tarreau [Fri, 23 Sep 2011 08:54:59 +0000 (10:54 +0200)] 
MINOR: remove the client/server side distinction in SI addresses

Stream interfaces used to distinguish between client and server addresses
because they were previously of different types (sockaddr_storage for the
client, sockaddr_in for the server). This is not the case anymore, and this
distinction is confusing at best and has caused a number of regressions to
be introduced in the process of converting everything to full-ipv6. We can
now remove this and have a much cleaner code.

13 years agoBUG/MINOR: don't use a wrong port when connecting to a server with mapped ports
Willy Tarreau [Fri, 23 Sep 2011 08:27:12 +0000 (10:27 +0200)] 
BUG/MINOR: don't use a wrong port when connecting to a server with mapped ports

Nick Chalk reported that a connection to a server which has no port specified
used twice the port number. The reason is that the port number was taken from
the wrong part of the address, the client's destination address was used as the
base port instead of the server's configured address.

Thanks to Nick for his helpful diagnostic.

13 years agoBUILD: halog: make halog build on solaris
Willy Tarreau [Fri, 16 Sep 2011 13:00:48 +0000 (15:00 +0200)] 
BUILD: halog: make halog build on solaris

Solaris' "rm" command does not support -v. Also, specify CC=gcc
because "cc" generally is not gcc there.

13 years agoMINOR: acl: add new matches for header/path/url length
Willy Tarreau [Fri, 16 Sep 2011 06:32:32 +0000 (08:32 +0200)] 
MINOR: acl: add new matches for header/path/url length

This patch introduces hdr_len, path_len and url_len for matching these
respective parts lengths against integers. This can be used to detect
abuse or empty headers.

13 years agoBUG/MEDIUM: don't trim last spaces from headers consisting only of spaces
Willy Tarreau [Fri, 16 Sep 2011 06:11:26 +0000 (08:11 +0200)] 
BUG/MEDIUM: don't trim last spaces from headers consisting only of spaces

Commit 588bd4 fixed header parsing so that trailing spaces were not part
of the returned string. Unfortunately, if a header only had spaces, the
last spaces were trimmed past the beginning of the value, causing a negative
length to be returned.

A quick code review shows that there should be no impact since the only
places where the vlen is used are either compared to a specific value or
with explicit contents (eg: digits).

This must be backported to 1.4.

13 years agoDOC: acl is http_first_req, not http_req_first
Willy Tarreau [Fri, 16 Sep 2011 05:53:52 +0000 (07:53 +0200)] 
DOC: acl is http_first_req, not http_req_first

Doc was entered without correctly copying the ACL name.

13 years agoBUILD/MINOR: fix the source URL in the spec file
Willy Tarreau [Sun, 11 Sep 2011 14:01:53 +0000 (16:01 +0200)] 
BUILD/MINOR: fix the source URL in the spec file

As reported by Avi Brender, the soruce URL was still pointing to v1.3.

13 years ago[RELEASE] Released version 1.5-dev7
Willy Tarreau [Sat, 10 Sep 2011 21:43:11 +0000 (23:43 +0200)] 
[RELEASE] Released version 1.5-dev7

Released version 1.5-dev7 with the following main changes :
    - [BUG] fix binary stick-tables
    - [MINOR] http: *_dom matching header functions now also split on ":"
    - [BUG] checks: fix support of Mysqld >= 5.5 for mysql-check
    - [MINOR] acl: add srv_conn acl to count connections on a     specific backend server
    - [MINOR] check: add redis check support
    - [DOC] small fixes to clearly distinguish between keyword     and variables
    - [MINOR] halog: add support for termination code matching (-tcn/-TCN)
    - [DOC] Minor spelling fixes and grammatical enhancements
    - [CLEANUP] dumpstats: make symbols static where possible
    - [MINOR] Break out dumping table
    - [MINOR] Break out processing of clear table
    - [MINOR] Allow listing of stick table by key
    - [MINOR] Break out all stick table socat command parsing
    - [MINOR] More flexible clearing of stick table
    - [MINOR] Allow showing and clearing by key of ipv6 stick tables
    - [MINOR] Allow showing and clearing by key of integer stick tables
    - [MINOR] Allow showing and clearing by key of string stick tables
    - [CLEANUP] Remove assigned but unused variables
    - [CLEANUP] peers.h: fix declarations
    - [CLEANUP] session.c: Make functions static where possible
    - [MINOR] Add active connection list to server
    - [MINOR] Allow shutdown of sessions when a server becomes unavailable
    - [MINOR] Add down termination condition
    - [MINOR] Make appsess{,ion}_refresh static
    - [MINOR] Add rdp_cookie pattern fetch function
    - [CLEANUP] Remove unnecessary casts
    - [MINOR] Add non-stick server option
    - [MINOR] Consistently use error in tcp_parse_tcp_req()
    - [MINOR] Consistently free expr on error in cfg_parse_listen()
    - [MINOR] Free rdp_cookie_name on denint()
    - [MINOR] Free tcp rules on denint()
    - [MINOR] Free stick table pool on denint()
    - [MINOR] Free stick rules on denint()
    - [MEDIUM] Fix stick-table replication on soft-restart
    - [MEDIUM] Correct ipmask() logic
    - [MINOR] Correct type in table dump examples
    - [MINOR] Fix build error in stream_int_register_handler()
    - [MINOR] Use DPRINTF in assign_server()
    - [BUG] checks: http-check expect could fail a check on multi-packet responses
    - [DOC] fix minor typo in the "dispatch" doc
    - [BUG] proto_tcp: fix address binding on remote source
    - [MINOR] http: don't report the "haproxy" word on the monitoring response
    - [REORG] http: move HTTP error codes back to proto_http.h
    - [MINOR] http: make the "HTTP 200" status code configurable.
    - [MINOR] http: partially revert the chunking optimization for now
    - [MINOR] stream_sock: always clear BF_EXPECT_MORE upon complete transfer
    - [CLEANUP] stream_sock: remove unneeded FL_TCP and factor out test
    - [MEDIUM] http: add support for "http-no-delay"
    - [OPTIM] http: optimize chunking again in non-interactive mode
    - [OPTIM] stream_sock: avoid fast-forwarding of partial data
    - [OPTIM] stream_sock: don't use splice on too small payloads
    - [MINOR] config: make it possible to specify a cookie even without a server
    - [BUG] stats: support url-encoded forms
    - [MINOR] config: automatically compute a default fullconn value
    - [CLEANUP] config: remove some left-over printf debugging code from previous patch
    - [DOC] add missing entry or stick store-response
    - [MEDIUM] http: add support for 'cookie' and 'set-cookie' patterns
    - [BUG] halog: correctly handle truncated last line
    - [MINOR] halog: make SKIP_CHAR stop on field delimiters
    - [MINOR] halog: add support for HTTP log matching (-H)
    - [MINOR] halog: gain back performance before SKIP_CHAR fix
    - [OPTIM] halog: cache some common fields positions
    - [OPTIM] halog: check once for correct line format and reuse the pointer
    - [OPTIM] halog: remove many 'if' by using a function pointer for the filters
    - [OPTIM] halog: remove support for tab delimiters in input data
    - [BUG] session: risk of crash on out of memory (1.5-dev regression)
    - [MINOR] session: try to emit a 500 response on memory allocation errors
    - [OPTIM] stream_sock: reduce the default number of accepted connections at once
    - [BUG] stream_sock: disable listener when system resources are exhausted
    - [MEDIUM] proxy: add a PAUSED state to listeners and move socket tricks out of proxy.c
    - [BUG] stream_sock: ensure orphan listeners don't accept too many connections
    - [MINOR] listeners: add listen_full() to mark a listener full
    - [MINOR] listeners: add support for queueing resource limited listeners
    - [MEDIUM] listeners: put listeners in queue upon resource shortage
    - [MEDIUM] listeners: queue proxy-bound listeners at the proxy's
    - [MEDIUM] listeners: don't stop proxies when global maxconn is reached
    - [MEDIUM] listeners: don't change listeners states anymore in maintain_proxies
    - [CLEANUP] proxy: rename a few proxy states (PR_STIDLE and PR_STRUN)
    - [MINOR] stats: report a "WAITING" state for sockets waiting for resource
    - [MINOR] proxy: make session rate-limit more accurate
    - [MINOR] sessions: only wake waiting listeners up if rate limit is OK
    - [BUG] proxy: peers must only be stopped once, not upon every call to maintain_proxies
    - [CLEANUP] proxy: merge maintain_proxies() operation inside a single loop
    - [MINOR] task: new function task_schedule() to schedule a wake up
    - [MAJOR] proxy: finally get rid of maintain_proxies()
    - [BUG] proxy: stats frontend and peers were missing many initializers
    - [MEDIUM] listeners: add a global listener management task
    - [MINOR] proxy: make findproxy() return proxies from numeric IDs too
    - [DOC] fix typos, "#" is a sharp, not a dash
    - [MEDIUM] stats: add support for changing frontend's maxconn at runtime
    - [MEDIUM] checks: group health checks methods by values and save option bits
    - [MINOR] session-counters: add the ability to clear the counters
    - [BUG] check: http-check expect + regex would crash in defaults section
    - [MEDIUM] http: make x-forwarded-for addition conditional
    - [REORG] build: move syscall redefinition to specific places
    - [CLEANUP] update the year in the copyright banner
    - [BUG] possible crash in 'show table' on stats socket
    - [BUG] checks: use the correct destination port for sending checks
    - [BUG] backend: risk of picking a wrong port when mapping is used with crossed families
    - [MINOR] make use of set_host_port() and get_host_port() to get rid of family mismatches
    - [DOC] fixed a few "sensible" -> "sensitive" errors
    - [MINOR] make use of addr_to_str() and get_host_port() to replace many inet_ntop()
    - [BUG] http: trailing white spaces must also be trimmed after headers
    - [MINOR] stats: display "<NONE>" instead of the frontend name when unknown
    - [MINOR] http: take a capture of too large requests and responses
    - [MINOR] http: take a capture of truncated responses
    - [MINOR] http: take a capture of bad content-lengths.
    - [DOC] add a few old and uncommitted docs
    - [CLEANUP] cfgparse: fix reported options for the "bind" keyword
    - [MINOR] halog: add -hs/-HS to filter by HTTP status code range
    - [MINOR] halog: support backslash-escaped quotes
    - [CLEANUP] remove dirty left-over of a debugging message
    - [MEDIUM] stats: disable complex socket reservation for stats socket
    - [CLEANUP] remove a useless test in manage_global_listener_queue()
    - [MEDIUM] stats: add the "set maxconn" setting to the command line interface
    - [MEDIUM] add support for global.maxconnrate to limit the per-process conn rate.
    - [MINOR] stats: report the current and max global connection rates
    - [MEDIUM] stats: add the ability to adjust the global maxconnrate
    - [BUG] peers: don't pre-allocate 65000 connections to each peer
    - [MEDIUM] don't limit peers nor stats socket to maxconn nor maxconnrate
    - [BUG] peers: the peer frontend must not emit any log
    - [CLEANUP] proxy: make pause_proxy() perform the required controls and emit the logs
    - [BUG] peers: don't keep a peers section which has a NULL frontend
    - [BUG] peers: ensure the peers are resumed if they were paused
    - [MEDIUM] stats: add the ability to enable/disable/shutdown a frontend at runtime
    - [MEDIUM] session: make session_shutdown() an independant function
    - [MEDIUM] stats: offer the possibility to kill a session from the CLI
    - [CLEANUP] stats: centralize tests for backend/server inputs on the CLI
    - [MEDIUM] stats: offer the possibility to kill sessions by server
    - [MINOR] halog: do not consider byte 0x8A as end of line
    - [MINOR] frontend: ensure debug message length is always initialized
    - [OPTIM] halog: make fgets parse more bytes by blocks
    - [OPTIM] halog: add assembly version of the field lookup code
    - [MEDIUM] poll: add a measurement of idle vs work time
    - [CLEANUP] startup: report only the basename in the usage message
    - [MINOR] startup: add an option to change to a new directory
    - [OPTIM] task: don't scan the run queue if we know it's empty
    - [BUILD] stats: stdint is not present on solaris
    - [DOC] update the README file to reflect new naming rules for patches
    - [MINOR] stats: report the number of requests intercepted by the frontend
    - [DOC] update ROADMAP file

13 years ago[DOC] update ROADMAP file
Willy Tarreau [Sat, 10 Sep 2011 21:40:59 +0000 (23:40 +0200)] 
[DOC] update ROADMAP file

13 years ago[MINOR] stats: report the number of requests intercepted by the frontend
Willy Tarreau [Sat, 10 Sep 2011 21:29:44 +0000 (23:29 +0200)] 
[MINOR] stats: report the number of requests intercepted by the frontend

These requests are mainly monitor requests, as well as stats requests when
the stats are processed by the frontend. Having this counter helps explain
the difference in number of sessions that is sometimes observed between a
frontend and a backend.

13 years ago[DOC] update the README file to reflect new naming rules for patches
Willy Tarreau [Sat, 10 Sep 2011 20:48:36 +0000 (22:48 +0200)] 
[DOC] update the README file to reflect new naming rules for patches

Those will be in effect after 1.5-dev7 is released.

13 years ago[BUILD] stats: stdint is not present on solaris
Willy Tarreau [Sat, 10 Sep 2011 18:38:15 +0000 (20:38 +0200)] 
[BUILD] stats: stdint is not present on solaris

It was added with commit cec9a227 to use uint32_t, though it does
not exist on solaris 8 but is not needed either.

13 years ago[OPTIM] task: don't scan the run queue if we know it's empty
Willy Tarreau [Sat, 10 Sep 2011 18:08:49 +0000 (20:08 +0200)] 
[OPTIM] task: don't scan the run queue if we know it's empty

It happens quite often in fact, so let's save those precious cycles.

13 years ago[MINOR] startup: add an option to change to a new directory
Willy Tarreau [Sat, 10 Sep 2011 17:26:56 +0000 (19:26 +0200)] 
[MINOR] startup: add an option to change to a new directory

Passing -C <dir> causes haproxy to chdir to <dir> before loading
any file. The argument may be passed anywhere on the command line.
A typical use case is :

  $ haproxy -C /etc/haproxy -f global.cfg -f haproxy.cfg

13 years ago[CLEANUP] startup: report only the basename in the usage message
Willy Tarreau [Sat, 10 Sep 2011 17:20:23 +0000 (19:20 +0200)] 
[CLEANUP] startup: report only the basename in the usage message

Don't write the full path to the program, just the program name.

13 years ago[MEDIUM] poll: add a measurement of idle vs work time
Willy Tarreau [Sat, 10 Sep 2011 14:56:42 +0000 (16:56 +0200)] 
[MEDIUM] poll: add a measurement of idle vs work time

We now measure the work and idle times in order to report the idle
time in the stats. It's expected that we'll be able to use it at
other places later.

13 years ago[OPTIM] halog: add assembly version of the field lookup code
Willy Tarreau [Sat, 10 Sep 2011 10:26:35 +0000 (12:26 +0200)] 
[OPTIM] halog: add assembly version of the field lookup code

Gcc tries to be a bit too smart in these small loops and the result is
that on i386 we waste a lot of time there. By recoding these loops in
assembly, we save up to 23% total processing time on i386! The savings
on x86_64 are much lower, probably because there are more registers and
gcc has to do less tricks. However, those savings vary a lot between gcc
versions and even cause harm on some of them (eg: 4.4) because gcc does
not know how to optimize the code once inlined.

However, by recoding field_start() in C to try to match the assembly
code as much as possible, we can significantly reduce its execution
time without risking the negative impacts. Thus, the assembly version
is less interesting there but still worth being used on some compilers.

13 years ago[OPTIM] halog: make fgets parse more bytes by blocks
Willy Tarreau [Sat, 10 Sep 2011 08:25:05 +0000 (10:25 +0200)] 
[OPTIM] halog: make fgets parse more bytes by blocks

By adding a "landing area" at the end of the buffer, it becomes safe to
parse more bytes at once. On 32-bit this makes fgets run about 4% faster
but it does not save anything on 64-bit.

13 years ago[MINOR] http: *_dom matching header functions now also split on ":"
Finn Arne Gangstad [Fri, 9 Sep 2011 14:09:50 +0000 (16:09 +0200)] 
[MINOR] http: *_dom matching header functions now also split on ":"

*_dom is mostly used for matching Host headers, and host headers may
include port numbers. To avoid having to create multiple rules with
and without :<port-number> in hdr_dom rules, change the *_dom
matching functions to also handle : as a delimiter.

Typically there are rules like this in haproxy.cfg:

  acl is_foo  hdr_dom(host) www.foo.com

Most clients send "Host: www.foo.com" in their HTTP header, but some
send "Host: www.foo.com:80" (which is allowed), and the above
rule will now work for those clients as well.

[Note: patch was edited before merge, any unexpected bug is mine /willy]

13 years ago[MINOR] frontend: ensure debug message length is always initialized
Willy Tarreau [Fri, 9 Sep 2011 09:21:06 +0000 (11:21 +0200)] 
[MINOR] frontend: ensure debug message length is always initialized

If the socket family ever changes from AF_INET*/AF_UNIX, we'd have a problem.

13 years ago[MINOR] halog: do not consider byte 0x8A as end of line
Willy Tarreau [Fri, 9 Sep 2011 06:21:55 +0000 (08:21 +0200)] 
[MINOR] halog: do not consider byte 0x8A as end of line

A bug in the algorithm used to find an LF in multiple bytes at once
made byte 0x80 trigger detection of byte 0x00, thus 0x8A matches byte
0x0A. In practice, this issue never happens since byte 0x8A won't be
displayed in logs (or it will be encoded). This could still possibly
happen in mixed logs.

13 years ago[MEDIUM] stats: offer the possibility to kill sessions by server
Willy Tarreau [Wed, 7 Sep 2011 21:48:48 +0000 (23:48 +0200)] 
[MEDIUM] stats: offer the possibility to kill sessions by server

It's now possible to issue "shutdown sessions server <back/srv>" and have
all this server's sessions immediately killed.

13 years ago[CLEANUP] stats: centralize tests for backend/server inputs on the CLI
Willy Tarreau [Wed, 7 Sep 2011 21:41:01 +0000 (23:41 +0200)] 
[CLEANUP] stats: centralize tests for backend/server inputs on the CLI

The tests were repeated many times. Let's put them at one single place.

13 years ago[MEDIUM] stats: offer the possibility to kill a session from the CLI
Willy Tarreau [Wed, 7 Sep 2011 21:21:03 +0000 (23:21 +0200)] 
[MEDIUM] stats: offer the possibility to kill a session from the CLI

It's now possible to issue "shutdown session 0xXXXXXXXX" and have this
session immediately killed. Useful for long-running fantoms.

13 years ago[MEDIUM] session: make session_shutdown() an independant function
Willy Tarreau [Wed, 7 Sep 2011 21:01:56 +0000 (23:01 +0200)] 
[MEDIUM] session: make session_shutdown() an independant function

We already had the ability to kill a connection, but it was only
for the checks. Now we can do this for any session, and for this we
add a specific flag "K" to the logs.

13 years ago[MEDIUM] stats: add the ability to enable/disable/shutdown a frontend at runtime
Willy Tarreau [Wed, 7 Sep 2011 20:37:44 +0000 (22:37 +0200)] 
[MEDIUM] stats: add the ability to enable/disable/shutdown a frontend at runtime

The stats socket now allows the admin to disable, enable or shutdown a frontend.
This can be used when a bug is discovered in a configuration and it's desirable
to fix it but the rules in place don't allow to change a running config. Thus it
becomes possible to kill the frontend to release the port and start a new one in
a separate process.

This can also be used to temporarily make haproxy return TCP resets to incoming
requests to pretend the service is not bound. For instance, this may be useful
to quickly flush a very deep SYN backlog.

The frontend check and lookup code was factored with the "set maxconn" usage.

13 years ago[BUG] peers: ensure the peers are resumed if they were paused
Willy Tarreau [Wed, 7 Sep 2011 19:33:14 +0000 (21:33 +0200)] 
[BUG] peers: ensure the peers are resumed if they were paused

Upon an incoming soft restart request, we first pause all frontends and
peers. If the caller changes its mind and asks us to resume (eg: failed
binding), we must resume all the frontends and peers. Unfortunately the
peers were not resumed.

The code was arranged to avoid code duplication (which used to hide the
issue till now).

13 years ago[BUG] peers: don't keep a peers section which has a NULL frontend
Willy Tarreau [Wed, 7 Sep 2011 19:24:49 +0000 (21:24 +0200)] 
[BUG] peers: don't keep a peers section which has a NULL frontend

If a peers section has no peer named as the local peer, we must destroy
it, otherwise a NULL peer frontend remains in the lists and a segfault
can happen upon a soft restart.

We also now report the missing peer name in order to help troubleshooting.

13 years ago[CLEANUP] proxy: make pause_proxy() perform the required controls and emit the logs
Willy Tarreau [Wed, 7 Sep 2011 17:14:57 +0000 (19:14 +0200)] 
[CLEANUP] proxy: make pause_proxy() perform the required controls and emit the logs

It avoids duplicated code in the caller.

13 years ago[BUG] peers: the peer frontend must not emit any log
Willy Tarreau [Wed, 7 Sep 2011 16:41:08 +0000 (18:41 +0200)] 
[BUG] peers: the peer frontend must not emit any log

Peers' frontends must have logging disabled by default, which was not
the case, so logs were randomly emitted upon restart, sometimes causing
a new process to fail to replace the old one.

13 years ago[MEDIUM] don't limit peers nor stats socket to maxconn nor maxconnrate
Willy Tarreau [Wed, 7 Sep 2011 16:00:47 +0000 (18:00 +0200)] 
[MEDIUM] don't limit peers nor stats socket to maxconn nor maxconnrate

The peers and the stats socket are control sockets, they must not be
limited by traffic rules.

13 years ago[BUG] peers: don't pre-allocate 65000 connections to each peer
Willy Tarreau [Wed, 7 Sep 2011 15:40:39 +0000 (17:40 +0200)] 
[BUG] peers: don't pre-allocate 65000 connections to each peer

This made sense a long time ago but since the maxconn is dynamically
computed from the tracking tables, it does not make any sense anymore
and will harm future changes.

13 years ago[MEDIUM] stats: add the ability to adjust the global maxconnrate
Willy Tarreau [Wed, 7 Sep 2011 14:13:44 +0000 (16:13 +0200)] 
[MEDIUM] stats: add the ability to adjust the global maxconnrate

Using "set rate-limit connections global <xxx>" on the CLI, we can now
adjust the per-process connection rate limiting (equal to global.maxconnrate).

13 years ago[MINOR] stats: report the current and max global connection rates
Willy Tarreau [Wed, 7 Sep 2011 13:26:48 +0000 (15:26 +0200)] 
[MINOR] stats: report the current and max global connection rates

The HTML page reports the current process connection rate, and the
"show info" command on the stats socket also reports the conn rate
limit and the max conn rate that was once reached.

Note that the max value can be cleared using "clear counters".

13 years ago[MEDIUM] add support for global.maxconnrate to limit the per-process conn rate.
Willy Tarreau [Wed, 7 Sep 2011 13:17:21 +0000 (15:17 +0200)] 
[MEDIUM] add support for global.maxconnrate to limit the per-process conn rate.

This one enforces a per-process connection rate limit, regardless of what
may be set per frontend. It can be a way to limit the CPU usage of a process
being severely attacked.

The side effect is that the global process connection rate is now measured
for each incoming connection, so it will be possible to report it.

13 years ago[MEDIUM] stats: add the "set maxconn" setting to the command line interface
Willy Tarreau [Wed, 7 Sep 2011 12:38:31 +0000 (14:38 +0200)] 
[MEDIUM] stats: add the "set maxconn" setting to the command line interface

This option permits to change the global maxconn setting within the
limit that was set by the initial value, which is now reported as the
hard maxconn value. This allows to immediately accept more concurrent
connections or to stop accepting new ones until the value passes below
the indicated setting.

The main use of this option is on systems where many haproxy instances
are loaded and admins need to re-adjust resource sharing at run time
to regain a bit of fairness between processes.

13 years ago[CLEANUP] remove a useless test in manage_global_listener_queue()
Willy Tarreau [Wed, 7 Sep 2011 12:26:33 +0000 (14:26 +0200)] 
[CLEANUP] remove a useless test in manage_global_listener_queue()

The test for the empty list was done twice.

13 years ago[MEDIUM] stats: disable complex socket reservation for stats socket
Willy Tarreau [Wed, 7 Sep 2011 10:13:34 +0000 (12:13 +0200)] 
[MEDIUM] stats: disable complex socket reservation for stats socket

The way the unix socket is initialized is awkward. Some of the settings are put
in the sockets itself, other ones in the backend. And more importantly the
global.maxsock value is adjusted so that the stats socket evades the global
maxconn value. This complexifies maxsock computations for nothing, since the
stats socket is not supposed to receive hundreds of concurrent connections when
the global maxconn is very low. What is needed however is to ensure that there
are always connections left for the stats socket even when traffic sockets are
saturated, but this guarantee is not offered anymore by current code.

So as of now, the stats socket is subject to the global maxconn limitation just
as any other socket until a reservation mechanism is implemented.

13 years ago[CLEANUP] remove dirty left-over of a debugging message
Willy Tarreau [Wed, 7 Sep 2011 09:55:40 +0000 (11:55 +0200)] 
[CLEANUP] remove dirty left-over of a debugging message

This debug message was added in commit e9b2602a and not noticed once
committed.

13 years ago[MINOR] halog: support backslash-escaped quotes
Willy Tarreau [Tue, 6 Sep 2011 06:11:27 +0000 (08:11 +0200)] 
[MINOR] halog: support backslash-escaped quotes

Some syslog servers escape quotes, which make the resulting logs unusable
for URL processing since the parser looks for the first field beginning
with a quote. It now supports also fields starting with backslash and
quote in order to address this. No performance impact was measured.

13 years ago[MINOR] halog: add -hs/-HS to filter by HTTP status code range
Willy Tarreau [Mon, 5 Sep 2011 00:07:23 +0000 (02:07 +0200)] 
[MINOR] halog: add -hs/-HS to filter by HTTP status code range

The code was merged with the error code checking which is very similar and
which shares the same information. The new test adds about 1% slowdown to
error checking but makes it more reliable when facing wrongly formated
status codes.

13 years ago[CLEANUP] cfgparse: fix reported options for the "bind" keyword
Willy Tarreau [Sun, 4 Sep 2011 23:17:06 +0000 (01:17 +0200)] 
[CLEANUP] cfgparse: fix reported options for the "bind" keyword

13 years ago[DOC] add a few old and uncommitted docs
Willy Tarreau [Sun, 4 Sep 2011 23:04:44 +0000 (01:04 +0200)] 
[DOC] add a few old and uncommitted docs

These docs were still lying in my directory uncommitted. They're not
very important but can be useful for developers who seek info about
internals.

13 years ago[MINOR] http: take a capture of bad content-lengths.
Willy Tarreau [Fri, 2 Sep 2011 18:33:27 +0000 (20:33 +0200)] 
[MINOR] http: take a capture of bad content-lengths.

Sometimes a bad content-length header is encountered and this causes
an abort. It's hard to debug without a trace, so let's take a capture
of the contents when this happens.

13 years ago[MINOR] http: take a capture of truncated responses
Willy Tarreau [Fri, 2 Sep 2011 18:16:24 +0000 (20:16 +0200)] 
[MINOR] http: take a capture of truncated responses

If a server starts to respond but stops before the body, then we
capture the truncated response. We don't do this on the request
because it would happen too often upon stupid attacks.

13 years ago[MINOR] http: take a capture of too large requests and responses
Willy Tarreau [Fri, 2 Sep 2011 18:04:57 +0000 (20:04 +0200)] 
[MINOR] http: take a capture of too large requests and responses

It's hard to prove a request or response is too large if there is no
capture, so let's take a snapshot of those too.

13 years ago[MINOR] stats: display "<NONE>" instead of the frontend name when unknown
Willy Tarreau [Fri, 2 Sep 2011 15:33:05 +0000 (17:33 +0200)] 
[MINOR] stats: display "<NONE>" instead of the frontend name when unknown

"show sess" should display "<NONE>" instead of the frontend's name as
the backend's.

13 years ago[BUG] http: trailing white spaces must also be trimmed after headers
Willy Tarreau [Thu, 1 Sep 2011 20:22:28 +0000 (22:22 +0200)] 
[BUG] http: trailing white spaces must also be trimmed after headers

Trailing spaces after headers were not trimmed, only the leading ones
were. An issue was detected today with a content-length value which
was padded with spaces and which was rejected. Recent updates to the
http-bis draft made it a lot more clear that such spaces must be ignored,
so this is what this patch does.

It should be backported to 1.4.

13 years ago[MINOR] make use of addr_to_str() and get_host_port() to replace many inet_ntop()
Willy Tarreau [Sun, 4 Sep 2011 22:36:48 +0000 (00:36 +0200)] 
[MINOR] make use of addr_to_str() and get_host_port() to replace many inet_ntop()

Many inet_ntop calls were partially right, which was hard to detect given
the complex combinations. Some of them were relying on the listener's proto
instead of the address itself, which could have been different when dealing
with an accept-proxy connection.

The new addr_to_str() function does the dirty job and returns the family, which
makes it particularly suited to calls from switch/case statements. A large number
of if/else statements were removed and the stats output could even be cleaned up
in the case of session dump.

As a side effect of doing this, the resulting code is smaller by almost 1kB.
All changed parts have been tested and provided expected output.

13 years ago[DOC] fixed a few "sensible" -> "sensitive" errors
Willy Tarreau [Sun, 28 Aug 2011 07:45:47 +0000 (09:45 +0200)] 
[DOC] fixed a few "sensible" -> "sensitive" errors

Similar words in different languages meaning different things...
Reported by Bryce Jasmer.

13 years ago[MINOR] make use of set_host_port() and get_host_port() to get rid of family mismatches
Willy Tarreau [Sat, 27 Aug 2011 10:29:07 +0000 (12:29 +0200)] 
[MINOR] make use of set_host_port() and get_host_port() to get rid of family mismatches

This also simplifies the code and makes it more auditable.

13 years ago[BUG] backend: risk of picking a wrong port when mapping is used with crossed families
Willy Tarreau [Sat, 27 Aug 2011 10:07:49 +0000 (12:07 +0200)] 
[BUG] backend: risk of picking a wrong port when mapping is used with crossed families

A similar issue as the previous one causes port mapping to fail in some
combinations of client and server address families. Using the macros fixes
the issue.

13 years ago[BUG] checks: use the correct destination port for sending checks
Willy Tarreau [Sat, 27 Aug 2011 09:51:36 +0000 (11:51 +0200)] 
[BUG] checks: use the correct destination port for sending checks

In the number of switch/case statements added for IPv6 changes,
one was wrong and caused the check port to be ignored for outgoing
connection because the socket's family was not taken at the right
place. Use the set_host_port() macro instead to fix the issue.

The same cleanup could be performed at a number of other places
and should follow shortly.

Special thanks to Stephane Bakhos of Techboom for reporting a
detailed analysis of this bug.

13 years ago[BUG] possible crash in 'show table' on stats socket
Willy Tarreau [Wed, 24 Aug 2011 06:23:34 +0000 (08:23 +0200)] 
[BUG] possible crash in 'show table' on stats socket

Patch d5b9fd95 was missing an initialisation of "ctx.table.target", which caused
"show table" to segfault if it was issued after a "show errors" (target pointer == -1).

13 years ago[CLEANUP] update the year in the copyright banner
Willy Tarreau [Mon, 22 Aug 2011 22:23:54 +0000 (00:23 +0200)] 
[CLEANUP] update the year in the copyright banner

It was still 2010 !

13 years ago[REORG] build: move syscall redefinition to specific places
Willy Tarreau [Mon, 22 Aug 2011 15:12:02 +0000 (17:12 +0200)] 
[REORG] build: move syscall redefinition to specific places

Some older libc don't define splice() and and don't define _syscall*()
either, which causes build errors if splicing is enabled.

To solve this, we now split the syscall redefinition into two layers :
  - one file per syscall (epoll, splice)
  - one common file to declare the _syscall*() macros

The code is cleaner because files using the syscalls just have to include
their respective file. It's not adviced to merge multiple syscall families
into a same file if all are not intended to be used simultaneously, because
defining unused static functions causes warnings to be emitted during build.

As a result, the new USE_MY_SPLICE parameter was added in order to be able
to define the splice() syscall separately.

13 years ago[MEDIUM] http: make x-forwarded-for addition conditional
Willy Tarreau [Fri, 19 Aug 2011 20:57:24 +0000 (22:57 +0200)] 
[MEDIUM] http: make x-forwarded-for addition conditional

If "option forwardfor" has the "if-none" argument, then the header is
only added when the request did not already have one. This option has
security implications, and should not be set blindly.

13 years ago[BUG] check: http-check expect + regex would crash in defaults section
Willy Tarreau [Fri, 19 Aug 2011 18:04:17 +0000 (20:04 +0200)] 
[BUG] check: http-check expect + regex would crash in defaults section

Manoj Kumar reported a case where haproxy would crash upon start-up. The
cause was an "http-check expect" statement declared in the defaults section,
which caused a NULL regex to be used during the check. This statement is not
allowed in defaults sections precisely because this requires saving a copy
of the regex in the default proxy. But the check was not made to prevent it
from being declared there, hence the issue.

Instead of adding code to detect its abnormal use, we decided to implement
it. It was not that much complex because the expect_str part was not used
with regexes, so it could hold the string form of the regex in order to
compile it again for every backend (there's no way to clone regexes).

This patch has been tested and works. So it's both a bugfix and a minor
feature enhancement.

It should be backported to 1.4 though it's not critical since the config
was not supposed to be supported.

13 years ago[MINOR] Use DPRINTF in assign_server()
Simon Horman [Fri, 12 Aug 2011 23:03:52 +0000 (08:03 +0900)] 
[MINOR] Use DPRINTF in assign_server()

Use DPRINTF in assign_server() rather than open-coding its logic.

13 years ago[MINOR] Fix build error in stream_int_register_handler()
Simon Horman [Fri, 12 Aug 2011 23:03:51 +0000 (08:03 +0900)] 
[MINOR] Fix build error in stream_int_register_handler()

There is no parameter or variable fct in stream_int_register_handler()
so the build fails when DPRINTF is active.

13 years ago[MINOR] Correct type in table dump examples
Simon Horman [Fri, 12 Aug 2011 23:03:50 +0000 (08:03 +0900)] 
[MINOR] Correct type in table dump examples

When dumping tables the table type is displayed
as a type name  not an integer.

13 years ago[MEDIUM] Correct ipmask() logic
Simon Horman [Fri, 12 Aug 2011 23:03:49 +0000 (08:03 +0900)] 
[MEDIUM] Correct ipmask() logic

The netmask applied to table entries as configured using ipmask() is
stored in arg_p->data.ip not arg_i (which will be 1 if the netmask is set).

13 years ago[MEDIUM] Fix stick-table replication on soft-restart
Simon Horman [Fri, 12 Aug 2011 23:03:48 +0000 (08:03 +0900)] 
[MEDIUM] Fix stick-table replication on soft-restart

"[MINOR] session: add a pointer to the new target into the session" (664beb8)
introduced a regression by changing the type of a peer's target from
TARG_TYPE_PROXY to TARG_TYPE_NONE. The effect of this is that during
a soft-restart the new process no longer tries to connect to the
old process to replicate its stick tables.

This patch sets the type of a peer's target as TARG_TYPE_PROXY and
replication on soft-restart works once again.

13 years ago[MINOR] session-counters: add the ability to clear the counters
Willy Tarreau [Fri, 12 Aug 2011 23:45:16 +0000 (01:45 +0200)] 
[MINOR] session-counters: add the ability to clear the counters

Sometimes it can be useful to reset a counter : one condition increments
it and another one resets it. It can be used to better detect abuses.

13 years ago[MINOR] halog: add support for termination code matching (-tcn/-TCN)
Hervé COMMOWICK [Wed, 10 Aug 2011 15:42:41 +0000 (17:42 +0200)] 
[MINOR] halog: add support for termination code matching (-tcn/-TCN)

It is now possible to filter by termination code with -tcn <termcode>, to be
able to track one kind of errors, for example after counting it with -tc.
Use -TCN <termcode> gives you the opposite.

13 years ago[MEDIUM] checks: group health checks methods by values and save option bits
Willy Tarreau [Sat, 6 Aug 2011 15:05:02 +0000 (17:05 +0200)] 
[MEDIUM] checks: group health checks methods by values and save option bits

Adding health checks has become a real pain, with cross-references to all
checks everywhere because they're all a single bit. Since they're all
exclusive, let's change this to have a check number only. We reserve 4
bits allowing up to 16 checks (15+tcp), only 7 of which are currently
used. The code has shrunk by almost 1kB and we saved a few option bits.

The "dispatch" option has been moved to px->options, making a few tests
a bit cleaner.

13 years ago[DOC] small fixes to clearly distinguish between keyword
Hervé COMMOWICK [Fri, 5 Aug 2011 16:48:51 +0000 (18:48 +0200)] 
[DOC] small fixes to clearly distinguish between keyword
and variables

Variables needs to be presented inside <> to be distinguished from keywords

13 years ago[MINOR] check: add redis check support
Hervé COMMOWICK [Fri, 5 Aug 2011 14:23:48 +0000 (16:23 +0200)] 
[MINOR] check: add redis check support

This patch provides a new "option redis-check" statement to enable server health checks based on redis PING request (http://www.redis.io/commands/ping).

13 years ago[MINOR] acl: add srv_conn acl to count connections on a
Hervé COMMOWICK [Fri, 5 Aug 2011 10:09:44 +0000 (12:09 +0200)] 
[MINOR] acl: add srv_conn acl to count connections on a
specific backend server

These ACLs are used to check the number of active connections on the specified server in the specified backend.

13 years ago[MEDIUM] stats: add support for changing frontend's maxconn at runtime
Willy Tarreau [Tue, 2 Aug 2011 09:49:05 +0000 (11:49 +0200)] 
[MEDIUM] stats: add support for changing frontend's maxconn at runtime

The new "set maxconn frontend XXX" statement on the stats socket allows
the admin to change a frontend's maxconn value. If some connections are
queued, they will immediately be accepted up to the new limit. If the
limit is lowered, new connections acceptation might be delayed. This can
be used to temporarily reduce or increase the impact of a specific frontend's
traffic on the whole process.

13 years ago[DOC] fix typos, "#" is a sharp, not a dash
Willy Tarreau [Tue, 2 Aug 2011 09:32:07 +0000 (11:32 +0200)] 
[DOC] fix typos, "#" is a sharp, not a dash

That's what happens when the same text is copy-pasted over and over...

13 years ago[MINOR] proxy: make findproxy() return proxies from numeric IDs too
Willy Tarreau [Tue, 2 Aug 2011 09:25:54 +0000 (11:25 +0200)] 
[MINOR] proxy: make findproxy() return proxies from numeric IDs too

Sometimes it's useful to be able to search a proxy by its numeric ID,
so let's add support for names such as #<id>.

13 years ago[MEDIUM] listeners: add a global listener management task
Willy Tarreau [Mon, 1 Aug 2011 18:57:55 +0000 (20:57 +0200)] 
[MEDIUM] listeners: add a global listener management task

This global task is used to periodically check for end of resource shortage
and to try to enable queued listeners again. This is important in case some
temporary system-wide shortage is encountered, so that we don't have to wait
for an existing connection to be released before checking the queue again.

For situations where listeners are queued due to the global maxconn being
reached, the task is woken up at least every second. For situations where
a system resource shortage is detected (memory, sockets, ...) the task is
woken up at least every 100 ms. That way, recovery from severe events can
still be achieved under acceptable conditions.

13 years ago[BUG] proxy: stats frontend and peers were missing many initializers
Willy Tarreau [Thu, 28 Jul 2011 23:49:03 +0000 (01:49 +0200)] 
[BUG] proxy: stats frontend and peers were missing many initializers

This was revealed with one of the very latest patches which caused
the listener_queue not to be initialized on the stats socket frontend.
And in fact a number of other ones were missing too. This is getting so
boring that now we'll always make use of the same function to initialize
any proxy. Doing so has even saved about 500 bytes on the binary due to
the avoided code redundancy.

No backport is needed.

13 years ago[MAJOR] proxy: finally get rid of maintain_proxies()
Willy Tarreau [Mon, 25 Jul 2011 14:33:49 +0000 (16:33 +0200)] 
[MAJOR] proxy: finally get rid of maintain_proxies()

This function is finally not needed anymore, as it has been replaced with
a per-proxy task that is scheduled when some limits are encountered on
incoming connections or when the process is stopping. The savings should
be noticeable on configs with a large number of proxies. The most important
point is that the rate limiting is now enforced in a clean and solid way.

13 years ago[MINOR] task: new function task_schedule() to schedule a wake up
Willy Tarreau [Mon, 25 Jul 2011 12:30:42 +0000 (14:30 +0200)] 
[MINOR] task: new function task_schedule() to schedule a wake up

This function is used when a task should be woken up at most at a given
date. This will be used with rate shapers.

13 years ago[CLEANUP] proxy: merge maintain_proxies() operation inside a single loop
Willy Tarreau [Mon, 25 Jul 2011 09:54:17 +0000 (11:54 +0200)] 
[CLEANUP] proxy: merge maintain_proxies() operation inside a single loop

This will help transforming the processing into per-proxy tasks.

13 years ago[BUG] proxy: peers must only be stopped once, not upon every call to maintain_proxies
Willy Tarreau [Mon, 25 Jul 2011 09:16:24 +0000 (11:16 +0200)] 
[BUG] proxy: peers must only be stopped once, not upon every call to maintain_proxies

Peers were stopped on every call to maintain_proxies when stopping=1,
while they should only be stopped once upon call to soft_stop(). This
bug has little impact, mostly increased CPU usage. It's not needed to
backport it.

13 years ago[MINOR] sessions: only wake waiting listeners up if rate limit is OK
Willy Tarreau [Mon, 25 Jul 2011 06:37:44 +0000 (08:37 +0200)] 
[MINOR] sessions: only wake waiting listeners up if rate limit is OK

Instead of waking a listener up then making it sleep, we only wake them up
if we know their rate limit is fine. In the future we could improve on top
of that by deciding to wake a proxy-specific task in XX milliseconds to
take care of enabling the listeners again.

13 years ago[MINOR] proxy: make session rate-limit more accurate
Willy Tarreau [Mon, 25 Jul 2011 06:30:51 +0000 (08:30 +0200)] 
[MINOR] proxy: make session rate-limit more accurate

Patch d9bbe17b used to limit the rate-limit to off-by-one to avoid
a busy loop when the limit is reached. Now that the listeners are
automatically disabled and queued when a limit is reached, we don't
need this workaround anymore and can bring back the most accurate
computation.

13 years ago[MINOR] stats: report a "WAITING" state for sockets waiting for resource
Willy Tarreau [Mon, 25 Jul 2011 06:16:20 +0000 (08:16 +0200)] 
[MINOR] stats: report a "WAITING" state for sockets waiting for resource

This is useful when enabling socket-stats to know that a socket is being
waiting for some resource (RAM, global connections, etc...).

13 years ago[CLEANUP] proxy: rename a few proxy states (PR_STIDLE and PR_STRUN)
Willy Tarreau [Mon, 25 Jul 2011 06:11:52 +0000 (08:11 +0200)] 
[CLEANUP] proxy: rename a few proxy states (PR_STIDLE and PR_STRUN)

Those states have been replaced with PR_STFULL and PR_STREADY respectively,
as it is what matches them the best now. Also, two occurrences of PR_STIDLE
in peers.c have been removed as this did not provide any form of error recovery
anyway.

13 years ago[MEDIUM] listeners: don't change listeners states anymore in maintain_proxies
Willy Tarreau [Mon, 25 Jul 2011 05:37:28 +0000 (07:37 +0200)] 
[MEDIUM] listeners: don't change listeners states anymore in maintain_proxies

Now maintain_proxies() only changes proxies states and does not affect their
listeners anymore since they are autonomous. A proxy will switch between the
PR_STIDLE and PR_STRUN states depending whether it's saturated or not. Next
step will consist in renaming PR_STIDLE to PR_STFULL. This state is now only
used to report the proxy state in the stats.

13 years ago[MEDIUM] listeners: don't stop proxies when global maxconn is reached
Willy Tarreau [Mon, 25 Jul 2011 05:08:45 +0000 (07:08 +0200)] 
[MEDIUM] listeners: don't stop proxies when global maxconn is reached

Now we don't have to stop proxies anymore since their listeners will be
queued if they attempt to accept a connection past the global limits.

13 years ago[MEDIUM] listeners: queue proxy-bound listeners at the proxy's
Willy Tarreau [Sun, 24 Jul 2011 21:55:06 +0000 (23:55 +0200)] 
[MEDIUM] listeners: queue proxy-bound listeners at the proxy's

All listeners that are limited by a proxy-specific resource are now
queued at the proxy's and not globally. This allows finer-grained
wakeups when releasing resource.

13 years ago[MEDIUM] listeners: put listeners in queue upon resource shortage
Willy Tarreau [Sun, 24 Jul 2011 20:58:00 +0000 (22:58 +0200)] 
[MEDIUM] listeners: put listeners in queue upon resource shortage

When an accept() fails because of a connection limit or a memory shortage,
we now disable it and queue it so that it's dequeued only when a connection
is released. This has improved the behaviour of the process near the fd limit
as now a listener with a no connection (eg: stats) will not loop forever
trying to get its connection accepted.

The solution is still not 100% perfect, as we'd like to have this used when
proxy limits are reached (use a per-proxy list) and for safety, we'd need
to have dedicated tasks to periodically re-enable them (eg: to overcome
temporary system-wide resource limitations when no connection is released).

13 years ago[MINOR] listeners: add support for queueing resource limited listeners
Willy Tarreau [Sun, 24 Jul 2011 20:03:52 +0000 (22:03 +0200)] 
[MINOR] listeners: add support for queueing resource limited listeners

When a listeners encounters a resource shortage, it currently stops until
one re-enables it. This is far from being perfect as it does not yet handle
the case where the single connection from the listener is rejected (eg: the
stats page).

Now we'll have a special status for resource limited listeners and we'll
queue them into one or multiple lists. That way, each time we have to stop
a listener because of a resource shortage, we can enqueue it and change its
state, so that it is dequeued once more resources are available.

This patch currently does not change any existing behaviour, it only adds
the basic building blocks for doing that.