]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
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.

13 years ago[MINOR] listeners: add listen_full() to mark a listener full
Willy Tarreau [Sun, 24 Jul 2011 17:23:38 +0000 (19:23 +0200)] 
[MINOR] listeners: add listen_full() to mark a listener full

This is just a cleanup which removes calls to EV_FD_CLR() and state
setting everywhere in the code.

13 years ago[BUG] stream_sock: ensure orphan listeners don't accept too many connections
Willy Tarreau [Sun, 24 Jul 2011 17:16:52 +0000 (19:16 +0200)] 
[BUG] stream_sock: ensure orphan listeners don't accept too many connections

For listeners that are not bound to a frontend, the limit on the
number of accepted connections is tested at the end of the accept()
loop, but we don't break out of the loop, meaning that if more
connections than what the listener allows are available and if this
is less than the proxy's limits and within the size of a batch, then
they could be accepted. In practice, this problem currently cannot
appear since all listeners are bound to a frontend, and it's a very
minor issue anyway.

1.4 has the same issue (which cannot happen there either), but there
is some code after it, so it's the code cleanup which revealed it.

13 years ago[MEDIUM] proxy: add a PAUSED state to listeners and move socket tricks out of proxy.c
Willy Tarreau [Sun, 24 Jul 2011 16:28:10 +0000 (18:28 +0200)] 
[MEDIUM] proxy: add a PAUSED state to listeners and move socket tricks out of proxy.c

Managing listeners state is difficult because they have their own state
and can at the same time have theirs dictated by their proxy. The pause
is not done properly, as the proxy code is fiddling with sockets. By
introducing new functions such as pause_listener()/resume_listener(), we
make it a bit more obvious how/when they're supposed to be used. The
listen_proxies() function was also renamed to resume_proxies() since
it's only used for pause/resume.

This patch is the first in a series aiming at getting rid of the maintain_proxies
mess. In the end, proxies should not call enable_listener()/disable_listener()
anymore.

13 years ago[BUG] stream_sock: disable listener when system resources are exhausted
Willy Tarreau [Fri, 22 Jul 2011 14:56:33 +0000 (16:56 +0200)] 
[BUG] stream_sock: disable listener when system resources are exhausted

When an accept() returns -1 ENFILE du to system limits, it leaves the
connection pending in the backlog and epoll() comes back immediately
afterwards trying to make it accept it again. This causes haproxy to
remain at 100% CPU until something makes an accept() possible again.
Now upon such resource shortage, we mark the listener FULL so that we
only enable it again once at least one connection has been released.
In fact we only do that if there are some active connections on this
proxy, so that it has a chance to be marked not full again. This makes
haproxy remain idle when all resources are used, which helps a lot
releasing those resource as fast as possible.

Backport to 1.4 might be desirable but difficult and tricky.

13 years ago[OPTIM] stream_sock: reduce the default number of accepted connections at once
Willy Tarreau [Fri, 22 Jul 2011 19:59:59 +0000 (21:59 +0200)] 
[OPTIM] stream_sock: reduce the default number of accepted connections at once

By default on a single process, we accept 100 connections at once. This is too
much on recent CPUs where the cache is constantly thrashing, because we visit
all those connections several times. We should batch the processing slightly
less so that all the accepted session may remain in cache during their initial
processing.

Lowering the batch size from 100 to 32 has changed the connection rate for
concurrencies between 5-10k from 67 kcps to 94 kcps on a Core i5 660 (4M L3),
and forward rates from 30k to 39.5k.

Tests on this hardware show that values between 10 and 30 seem to do the job fine.

13 years ago[MINOR] session: try to emit a 500 response on memory allocation errors
Willy Tarreau [Fri, 22 Jul 2011 15:36:27 +0000 (17:36 +0200)] 
[MINOR] session: try to emit a 500 response on memory allocation errors

When we fail to create a session because of memory shortage, let's at
least try to send a 500 message directly on the socket. Even if we don't
have any buffers left, the kernel's orphans management will take care of
delivering the message as long as there are socket buffers left.

13 years ago[BUG] session: risk of crash on out of memory (1.5-dev regression)
Willy Tarreau [Tue, 19 Jul 2011 22:17:39 +0000 (00:17 +0200)] 
[BUG] session: risk of crash on out of memory (1.5-dev regression)

Patch af5149 introduced an issue which can be detected only on out of
memory conditions : a LIST_DEL() may be performed on an uninitialized
struct member instead of a LIST_INIT() during the accept() phase,
causing crashes and memory corruption to occur.

This issue was detected and diagnosed by the Exceliance R&D team.

This is 1.5-specific and very recent, so no existing deployment should
be impacted.

14 years ago[MINOR] Free stick rules on denint()
Simon Horman [Fri, 15 Jul 2011 04:14:11 +0000 (13:14 +0900)] 
[MINOR] Free stick rules on denint()

The motivation for this is that when soft-restart is merged
it will be come more important to free all relevant memory in deinit()

Discovered using valgrind.

14 years ago[MINOR] Free stick table pool on denint()
Simon Horman [Fri, 15 Jul 2011 04:14:10 +0000 (13:14 +0900)] 
[MINOR] Free stick table pool on denint()

The motivation for this is that when soft-restart is merged
it will be come more important to free all relevant memory in deinit()

Discovered using valgrind.

14 years ago[MINOR] Free tcp rules on denint()
Simon Horman [Fri, 15 Jul 2011 04:14:09 +0000 (13:14 +0900)] 
[MINOR] Free tcp rules on denint()

The motivation for this is that when soft-restart is merged
it will be come more important to free all relevant memory in deinit()

Discovered using valgrind.

14 years ago[MINOR] Free rdp_cookie_name on denint()
Simon Horman [Fri, 15 Jul 2011 04:14:08 +0000 (13:14 +0900)] 
[MINOR] Free rdp_cookie_name on denint()

The motivation for this is that when soft-restart is merged
it will be come more important to free all relevant memory in deinit()

Discovered using valgrind.

14 years ago[MINOR] Consistently free expr on error in cfg_parse_listen()
Simon Horman [Fri, 15 Jul 2011 04:14:07 +0000 (13:14 +0900)] 
[MINOR] Consistently free expr on error in cfg_parse_listen()

It seems to me that without this change cfg_parse_listen()
may leak memory.

14 years ago[MINOR] Consistently use error in tcp_parse_tcp_req()
Simon Horman [Fri, 15 Jul 2011 04:14:06 +0000 (13:14 +0900)] 
[MINOR] Consistently use error in tcp_parse_tcp_req()

It seems to me that without this change tcp_parse_tcp_req()
may leak memory.

14 years ago[OPTIM] halog: remove support for tab delimiters in input data
Willy Tarreau [Sun, 10 Jul 2011 20:11:17 +0000 (22:11 +0200)] 
[OPTIM] halog: remove support for tab delimiters in input data

Haproxy does not use tabs when sending logs, and checking for them
wastes no less than 4% of CPU cycles. Better get rid of these tests.

14 years ago[OPTIM] halog: remove many 'if' by using a function pointer for the filters
Willy Tarreau [Sun, 10 Jul 2011 19:39:35 +0000 (21:39 +0200)] 
[OPTIM] halog: remove many 'if' by using a function pointer for the filters

There were too many filters, we were losing time in all the "if" statements.
By moving all the filters to independant functions, we made the code cleaner
and slightly faster (3%).

One minor bug was found, the -tc and -st options did not report the number
of output lines, but always zero.

14 years ago[OPTIM] halog: check once for correct line format and reuse the pointer
Willy Tarreau [Sun, 10 Jul 2011 17:47:48 +0000 (19:47 +0200)] 
[OPTIM] halog: check once for correct line format and reuse the pointer

Almost all filters first check the line format, which takes a lot of code
and requires parsing back and forth. By centralizing this test, we can
save about 15-20 more percent of performance for all filters.

Also, the test was wrong, it was checking that the source IP address was
starting with a digit, which is not always true with local IPv6 addresses.
Instead, we now check that the next field (accept field) starts with an
opening bracket and is followed by a digit between 0 and 3 (day of the
month). Doing this has contributed a 2% speedup because all other field
calculations were relative to a closer field.

14 years ago[OPTIM] halog: cache some common fields positions
Willy Tarreau [Sun, 10 Jul 2011 16:53:44 +0000 (18:53 +0200)] 
[OPTIM] halog: cache some common fields positions

Since many fields are relative and some are used a lot, try to cache them
the first time they're used in order to avoid skipping them twice. The
status counts with HTTP pre-check enabled has sped up by 40%.

14 years ago[MINOR] halog: gain back performance before SKIP_CHAR fix
Willy Tarreau [Sun, 10 Jul 2011 16:15:08 +0000 (18:15 +0200)] 
[MINOR] halog: gain back performance before SKIP_CHAR fix

The SKIP_CHAR fix caused a measurable performance drop. Since we can
consider all chars below 0x20 as delimiters, we can avoid a cache lookup
which requires a char to pointer conversion.

14 years ago[MINOR] halog: add support for HTTP log matching (-H)
Willy Tarreau [Sun, 10 Jul 2011 15:27:40 +0000 (17:27 +0200)] 
[MINOR] halog: add support for HTTP log matching (-H)

Now it's possible to restrict analysis to HTTP-looking logs when passing -H.
-H -v gives the opposite (most likely TCP logs).

14 years ago[MINOR] halog: make SKIP_CHAR stop on field delimiters
Willy Tarreau [Sun, 10 Jul 2011 15:25:33 +0000 (17:25 +0200)] 
[MINOR] halog: make SKIP_CHAR stop on field delimiters

The SKIP_CHAR() macro did not consider field delimiters, causing the timer parser
to be able to search timers at wrong places when fed with TCP logs.

14 years ago[BUG] halog: correctly handle truncated last line
Willy Tarreau [Sat, 9 Jul 2011 12:28:01 +0000 (14:28 +0200)] 
[BUG] halog: correctly handle truncated last line

If last line is truncated (eg: truncated file), then halog would loop on
it forever.

14 years ago[MEDIUM] http: add support for 'cookie' and 'set-cookie' patterns
Willy Tarreau [Fri, 1 Jul 2011 14:16:17 +0000 (16:16 +0200)] 
[MEDIUM] http: add support for 'cookie' and 'set-cookie' patterns

This is used to perform cookie-based stickiness with table replication
between multiple masters and across restarts. This partially overrides
some of the appsession capabilities.

14 years ago[DOC] add missing entry or stick store-response
Willy Tarreau [Fri, 1 Jul 2011 09:33:25 +0000 (11:33 +0200)] 
[DOC] add missing entry or stick store-response

14 years ago[MINOR] Add non-stick server option
Simon Horman [Sat, 25 Jun 2011 00:39:49 +0000 (09:39 +0900)] 
[MINOR] Add non-stick server option

Never add connections allocated to this sever to a stick-table.
This may be used in conjunction with backup to ensure that
stick-table persistence is disabled for backup servers.

14 years ago[CLEANUP] Remove unnecessary casts
Simon Horman [Fri, 24 Jun 2011 06:11:37 +0000 (15:11 +0900)] 
[CLEANUP] Remove unnecessary casts

There is no need to cast when going to or from void *

14 years ago[MINOR] Add rdp_cookie pattern fetch function
Simon Horman [Fri, 24 Jun 2011 05:50:20 +0000 (14:50 +0900)] 
[MINOR] Add rdp_cookie pattern fetch function

This pattern fetch function extracts the value of the rdp cookie <name> as
a string and uses this value to match. This enables implementation of
persistence based on the mstshash cookie. This is typically done if there
is no msts cookie present.

This differs from "balance rdp-cookie" in that any balancing algorithm may
be used and thus the distribution of clients to backend servers is not
linked to a hash of the RDP cookie. It is envisaged that using a balancing
algorithm such as "balance roundrobin" or "balance leastconnect" will lead
to a more even distribution of clients to backend servers than the hash
used by "balance rdp-cookie".

Example :
listen tse-farm
    bind 0.0.0.0:3389
    # wait up to 5s for an RDP cookie in the request
    tcp-request inspect-delay 5s
    tcp-request content accept if RDP_COOKIE
    # apply RDP cookie persistence
    persist rdp-cookie
    # Persist based on the mstshash cookie
    # This is only useful makes sense if
    # balance rdp-cookie is not used
    stick-table type string size 204800
    stick on rdp_cookie(mstshash)
    server srv1 1.1.1.1:3389
    server srv1 1.1.1.2:3389

14 years ago[MINOR] Make appsess{,ion}_refresh static
Simon Horman [Fri, 24 Jun 2011 05:49:57 +0000 (14:49 +0900)] 
[MINOR] Make appsess{,ion}_refresh static

apsession_refresh() and apsess_refressh are only used inside apsession.c
and thus can be made static.

The only use of apsession_refresh() is appsession_task_init().
These functions have been re-ordered to avoid the need for
a forward-declaration of apsession_refresh().

14 years ago[MINOR] Add down termination condition
Simon Horman [Tue, 21 Jun 2011 05:34:59 +0000 (14:34 +0900)] 
[MINOR] Add down termination condition

If a connection is closed by because the backend became unavailable
then log 'D' as the termination condition.

Signed-off-by: Simon Horman <horms@verge.net.au>
14 years ago[MINOR] Allow shutdown of sessions when a server becomes unavailable
Simon Horman [Tue, 21 Jun 2011 05:34:58 +0000 (14:34 +0900)] 
[MINOR] Allow shutdown of sessions when a server becomes unavailable

This adds the "on-marked-down shutdown-sessions" statement on "server" lines,
which causes all sessions established on a server to be killed at once when
the server goes down. The task's priority is reniced to the highest value
(1024) so that servers holding many tasks don't cause a massive slowdown due
to the wakeup storm.

14 years ago[MINOR] Add active connection list to server
Simon Horman [Tue, 21 Jun 2011 05:34:57 +0000 (14:34 +0900)] 
[MINOR] Add active connection list to server

The motivation for this is to allow iteration of all the connections
of a server without the expense of iterating over the global list
of connections.

The first use of this will be to implement an option to close connections
associated with a server when is is marked as being down or in maintenance
mode.

14 years ago[CLEANUP] session.c: Make functions static where possible
Simon Horman [Wed, 8 Jun 2011 00:19:07 +0000 (09:19 +0900)] 
[CLEANUP] session.c: Make functions static where possible

14 years ago[CLEANUP] peers.h: fix declarations
Simon Horman [Wed, 8 Jun 2011 00:18:51 +0000 (09:18 +0900)] 
[CLEANUP] peers.h: fix declarations

* The declaration of peer_session_create() does
  not match its definition. As it is only
  used inside of peers.c make it static.

* Make the declaration of peers_register_table()
  match its definition.

* Also, make all functions in peers.c that
  are not also in peers.h static

14 years ago[CLEANUP] Remove assigned but unused variables
Simon Horman [Tue, 7 Jun 2011 02:07:50 +0000 (11:07 +0900)] 
[CLEANUP] Remove assigned but unused variables

gcc (Debian 4.6.0-2) 4.6.1 20110329 (prerelease)
Copyright (C) 2011 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

...
src/proto_http.c:3029:14: warning: variable â\80\98del_clâ\80\99 set but not used [-Wunused-but-set-variable]
In file included from ebtree/eb64tree.c:23:0:
ebtree/eb64tree.h: In function â\80\98__eb64_lookupâ\80\99:
ebtree/eb64tree.h:128:6: warning: variable â\80\98node_bitâ\80\99 set but not used [-Wunused-but-set-variable]
ebtree/eb64tree.h: In function â\80\98__eb64i_lookupâ\80\99:
ebtree/eb64tree.h:180:6: warning: variable â\80\98node_bitâ\80\99 set but not used [-Wunused-but-set-variable]
In file included from ebtree/ebpttree.h:26:0,
                 from ebtree/ebimtree.c:23:
ebtree/eb64tree.h: In function â\80\98__eb64_lookupâ\80\99:
ebtree/eb64tree.h:128:6: warning: variable â\80\98node_bitâ\80\99 set but not used [-Wunused-but-set-variable]
ebtree/eb64tree.h: In function â\80\98__eb64i_lookupâ\80\99:
ebtree/eb64tree.h:180:6: warning: variable â\80\98node_bitâ\80\99 set but not used [-Wunused-but-set-variable]
In file included from ebtree/ebpttree.h:26:0,
                 from ebtree/ebistree.h:25,
                 from ebtree/ebistree.c:23:
ebtree/eb64tree.h: In function â\80\98__eb64_lookupâ\80\99:
ebtree/eb64tree.h:128:6: warning: variable â\80\98node_bitâ\80\99 set but not used [-Wunused-but-set-variable]
ebtree/eb64tree.h: In function â\80\98__eb64i_lookupâ\80\99:
ebtree/eb64tree.h:180:6: warning: variable â\80\98node_bitâ\80\99 set but not used [-Wunused-but-set-variable]

14 years ago[MINOR] Allow showing and clearing by key of string stick tables
Simon Horman [Wed, 15 Jun 2011 06:18:52 +0000 (15:18 +0900)] 
[MINOR] Allow showing and clearing by key of string stick tables

14 years ago[MINOR] Allow showing and clearing by key of integer stick tables
Simon Horman [Wed, 15 Jun 2011 06:18:51 +0000 (15:18 +0900)] 
[MINOR] Allow showing and clearing by key of integer stick tables

14 years ago[MINOR] Allow showing and clearing by key of ipv6 stick tables
Simon Horman [Wed, 15 Jun 2011 06:18:50 +0000 (15:18 +0900)] 
[MINOR] Allow showing and clearing by key of ipv6 stick tables

14 years ago[MINOR] More flexible clearing of stick table
Simon Horman [Wed, 15 Jun 2011 06:18:49 +0000 (15:18 +0900)] 
[MINOR] More flexible clearing of stick table

* Allow clearing of all entries of a table
* Allow clearing of all entries of a table
  that match a data filter

14 years ago[MINOR] Break out all stick table socat command parsing
Simon Horman [Wed, 15 Jun 2011 06:18:48 +0000 (15:18 +0900)] 
[MINOR] Break out all stick table socat command parsing

This will allow reuse for clearing table entries
other than by key

14 years ago[MINOR] Allow listing of stick table by key
Simon Horman [Wed, 15 Jun 2011 06:18:47 +0000 (15:18 +0900)] 
[MINOR] Allow listing of stick table by key

14 years ago[MINOR] Break out processing of clear table
Simon Horman [Wed, 15 Jun 2011 06:18:46 +0000 (15:18 +0900)] 
[MINOR] Break out processing of clear table

This will allow the code to be reused
for showing a table filtered by key

14 years ago[MINOR] Break out dumping table
Simon Horman [Wed, 15 Jun 2011 06:18:45 +0000 (15:18 +0900)] 
[MINOR] Break out dumping table

This will allow the code to be reused
for showing a table filtered by key

Signed-off-by: Simon Horman <horms@verge.net.au>
14 years ago[CLEANUP] dumpstats: make symbols static where possible
Simon Horman [Wed, 15 Jun 2011 06:18:44 +0000 (15:18 +0900)] 
[CLEANUP] dumpstats: make symbols static where possible

14 years ago[BUG] checks: fix support of Mysqld >= 5.5 for mysql-check
Hervé COMMOWICK [Fri, 10 Jun 2011 12:05:59 +0000 (14:05 +0200)] 
[BUG] checks: fix support of Mysqld >= 5.5 for mysql-check

mysqld >= 5.5 want the client to announce 4.1+ authentication support, even if we have no password, so we do this.
I also check on a debian potato mysqld 3.22 and it works too so i assume we are good from 3.22 to 5.5.

[WT: this must be backported to 1.4]

14 years ago[CLEANUP] config: remove some left-over printf debugging code from previous patch
Willy Tarreau [Tue, 14 Jun 2011 05:49:12 +0000 (07:49 +0200)] 
[CLEANUP] config: remove some left-over printf debugging code from previous patch

Last patch fbb784 unexpectedly left some debugging printf messages which can be
seen in debug mode.

14 years ago[MINOR] config: automatically compute a default fullconn value
Willy Tarreau [Sun, 5 Jun 2011 13:38:35 +0000 (15:38 +0200)] 
[MINOR] config: automatically compute a default fullconn value

The fullconn value is not easy to get right when doing dynamic regulation,
as it should depend on the maxconns of the frontends that can reach a
backend. Since the parameter is mandatory, many configs are found with
an inappropriate default value.

Instead of rejecting configs without a fullconn value, we now set it to
10% of the sum of the configured maxconns of all the frontends which are
susceptible to branch to the backend. That way if new frontends are added,
the backend's fullconn automatically adjusts itself.

14 years ago[DOC] Minor spelling fixes and grammatical enhancements
Simon Horman [Sun, 29 May 2011 06:01:10 +0000 (15:01 +0900)] 
[DOC] Minor spelling fixes and grammatical enhancements

14 years ago[BUG] stats: support url-encoded forms
Willy Tarreau [Tue, 31 May 2011 16:06:18 +0000 (18:06 +0200)] 
[BUG] stats: support url-encoded forms

Bashkim Kasa reported that the stats admin page did not work when colons
were used in server or backend names. This was caused by url-encoding
resulting in ':' being sent as '%3A'. Now we systematically decode the
field names and values to fix this issue.

14 years ago[MINOR] config: make it possible to specify a cookie even without a server
Willy Tarreau [Mon, 30 May 2011 16:47:41 +0000 (18:47 +0200)] 
[MINOR] config: make it possible to specify a cookie even without a server

Since version 1.0.0, it's forbidden to have a cookie specified without at
least one server. This test is useless and makes it complex to write APIs
to iteratively generate working configurations. Remove the test.

14 years ago[OPTIM] stream_sock: don't use splice on too small payloads
Willy Tarreau [Wed, 11 May 2011 18:47:24 +0000 (20:47 +0200)] 
[OPTIM] stream_sock: don't use splice on too small payloads

It's more expensive to call splice() on short payloads than to use
recv()+send(). One of the reasons is that doing a splice() involves
allocating a pipe. One other reason is that the kernel will have to
copy itself if we try to splice less than a page. So let's fix a
short offset of 4kB below which we don't splice.

A quick test shows that on chunked encoded data, with splice we had
6826 syscalls (1715 splice, 3461 recv, 1650 send) while with this
patch, the same transfer resulted in 5793 syscalls (3896 recv, 1897
send).

14 years ago[OPTIM] stream_sock: avoid fast-forwarding of partial data
Willy Tarreau [Wed, 11 May 2011 18:32:36 +0000 (20:32 +0200)] 
[OPTIM] stream_sock: avoid fast-forwarding of partial data

Fast-forwarding between file descriptors is nice but can be counter-productive
when only one part of the buffer is forwarded, because it can result in doubling
the number of send() syscalls. This is what happens on HTTP chunking, because
the chunk data are sent, then the CRLF + next chunk size are parsed and immediately
scheduled for forwarding. This results in two send() for the same block while a
single one would have done it.

14 years ago[OPTIM] http: optimize chunking again in non-interactive mode
Willy Tarreau [Mon, 30 May 2011 16:29:28 +0000 (18:29 +0200)] 
[OPTIM] http: optimize chunking again in non-interactive mode

Now that we support the http-no-delay mode, we can optimize HTTP
chunking again by always waiting for more data to come until the
last chunk is met.

This patch may or may not be backported to 1.4, it's not a big deal,
it will mainly help for chunks which are aligned with the buffer size.

14 years ago[MEDIUM] http: add support for "http-no-delay"
Willy Tarreau [Mon, 30 May 2011 16:10:30 +0000 (18:10 +0200)] 
[MEDIUM] http: add support for "http-no-delay"

There are some very rare server-to-server applications that abuse the HTTP
protocol and expect the payload phase to be highly interactive, with many
interleaved data chunks in both directions within a single request. This is
absolutely not supported by the HTTP specification and will not work across
most proxies or servers. When such applications attempt to do this through
haproxy, it works but they will experience high delays due to the network
optimizations which favor performance by instructing the system to wait for
enough data to be available in order to only send full packets. Typical
delays are around 200 ms per round trip. Note that this only happens with
abnormal uses. Normal uses such as CONNECT requests nor WebSockets are not
affected.

When "option http-no-delay" is present in either the frontend or the backend
used by a connection, all such optimizations will be disabled in order to
make the exchanges as fast as possible. Of course this offers no guarantee on
the functionality, as it may break at any other place. But if it works via
HAProxy, it will work as fast as possible. This option should never be used
by default, and should never be used at all unless such a buggy application
is discovered. The impact of using this option is an increase of bandwidth
usage and CPU usage, which may significantly lower performance in high
latency environments.

This change should be backported to 1.4 since the first report of such a
misuse was in 1.4. Next patch will also be needed.

14 years ago[CLEANUP] stream_sock: remove unneeded FL_TCP and factor out test
Willy Tarreau [Mon, 30 May 2011 15:32:53 +0000 (17:32 +0200)] 
[CLEANUP] stream_sock: remove unneeded FL_TCP and factor out test

The FL_TCP flag was a leftover from the old days we were using TCP_CORK.
With MSG_MORE it's not needed anymore so we can remove the condition and
sensibly simplify the test.

14 years ago[MINOR] stream_sock: always clear BF_EXPECT_MORE upon complete transfer
Willy Tarreau [Wed, 11 May 2011 18:14:03 +0000 (20:14 +0200)] 
[MINOR] stream_sock: always clear BF_EXPECT_MORE upon complete transfer

When sending is complete, it's preferred to systematically clear the flags
that were set for that transfer. What could happen is that the to_forward
counter had caused the MSG_MORE flag to be set and BF_EXPECT_MORE not to
be cleared, resulting in this flag being unexpectedly maintained for next
round.

The code has taken extreme care of not doing this till now, but it's not
acceptable that the caller has to know these precise semantics. So let's
unconditionnally clear the flag instead.

For the sake of safety, this fix should be backported to 1.4.

14 years ago[MINOR] http: partially revert the chunking optimization for now
Willy Tarreau [Wed, 11 May 2011 17:56:11 +0000 (19:56 +0200)] 
[MINOR] http: partially revert the chunking optimization for now

Commit 57f5c1 used to provide a nice improvement on chunked encoding since
it ensured that we did not set a PUSH flag for every chunk or buffer data
part of a chunked transfer.

Some applications appear to erroneously abuse HTTP chunking in order to
get interactive exchanges between a user agent and an origin server with
very small chunks. While it happens to work through haproxy, it's terribly
slow due to the latency added after passing each chunk to the system, who
could wait up to 200ms before pushing them onto the wire.

So we need an interactive mode for such usages. In the mean time, step back
on the optim, but not completely, so that we still keep the flag as long as
we know we're not finished with the current chunk.

This change should be backported to 1.4 too as the issue was discovered
with it.

14 years ago[MINOR] http: make the "HTTP 200" status code configurable.
Willy Tarreau [Wed, 11 May 2011 14:28:49 +0000 (16:28 +0200)] 
[MINOR] http: make the "HTTP 200" status code configurable.

This status code is used in response to requests matching "monitor-uri".
Some users need to adjust it to fit their needs (eg: make some strings
appear there). As it's already defined as a chunked string and used
exactly like other status codes, it makes sense to make it configurable
with the usual "errorfile", "errorloc", ...

14 years ago[REORG] http: move HTTP error codes back to proto_http.h
Willy Tarreau [Wed, 11 May 2011 14:10:11 +0000 (16:10 +0200)] 
[REORG] http: move HTTP error codes back to proto_http.h

This one was left isolated in its own file. It probably is a leftover
from the 1.2->1.3 split.

14 years ago[MINOR] http: don't report the "haproxy" word on the monitoring response
Willy Tarreau [Wed, 11 May 2011 14:00:54 +0000 (16:00 +0200)] 
[MINOR] http: don't report the "haproxy" word on the monitoring response

Some people like to make the monitoring URL testable from unsafe locations.
Reporting haproxy's existence there can sometimes be problematic. This patch
should not be backported to 1.4 because it is possible, eventhough unlikely,
that some scripts rely on this word to appear there.

14 years ago[BUG] fix binary stick-tables
Cyril Bonté [Mon, 9 May 2011 18:44:54 +0000 (20:44 +0200)] 
[BUG] fix binary stick-tables

As reported by Lauri-Alo Adamson, version 1.5-dev6 doesn't support
stick-tables with a binary type.
This issue was introduced in the commit 4f92d32 where a line was erroneously
deleted, and is 1.5-specific.

14 years ago[BUG] proto_tcp: fix address binding on remote source
Willy Tarreau [Tue, 19 Apr 2011 05:20:57 +0000 (07:20 +0200)] 
[BUG] proto_tcp: fix address binding on remote source

Mark Brooks reported that commit 1b4b7c broke tproxy in 1.5-dev6. Nick
Chalk tracked the issue down to a missing address family setting in
tcp_bind_socket() which resulted in a failure to use get_addr_len().
This issue is 1.5-specific.

14 years ago[DOC] fix minor typo in the "dispatch" doc
Willy Tarreau [Fri, 15 Apr 2011 04:45:37 +0000 (06:45 +0200)] 
[DOC] fix minor typo in the "dispatch" doc

Bradley Falzon reported a left-over of a copy-paste from the "disabled"
keyword in the "dispatch" section.

14 years ago[BUG] checks: http-check expect could fail a check on multi-packet responses
Willy Tarreau [Wed, 13 Apr 2011 07:32:41 +0000 (09:32 +0200)] 
[BUG] checks: http-check expect could fail a check on multi-packet responses

Christopher Blencowe reported that the httpchk_expect() function was
lacking a test for incomplete responses : if the server sends only the
headers in the first packet and the body in a subsequent one, there is
a risk that the check fails without waiting for more data. A failure
rate of about 1% was reported.

This fix must be backported to 1.4.

14 years ago[RELEASE] Released version 1.5-dev6
Willy Tarreau [Thu, 7 Apr 2011 22:56:41 +0000 (00:56 +0200)] 
[RELEASE] Released version 1.5-dev6

Released version 1.5-dev6 with the following main changes :
    - [BUG] stream_sock: use get_addr_len() instead of sizeof() on sockaddr_storage
    - [BUG] TCP source tracking was broken with IPv6 changes
    - [BUG] stick-tables did not work when converting IPv6 to IPv4
    - [CRITICAL] fix risk of crash when dealing with space in response cookies