]> git.ipfire.org Git - thirdparty/haproxy.git/log
thirdparty/haproxy.git
15 years ago[BUG] config: fix erroneous check on cookie domain names
Willy Tarreau [Thu, 3 Dec 2009 22:10:56 +0000 (23:10 +0100)] 
[BUG] config: fix erroneous check on cookie domain names

It was a OR instead of a AND, so it was required to have a cookie
name which contained a dot AND began with a dot.

15 years ago[BUG] config: disable 'option httplog' on TCP proxies
Willy Tarreau [Mon, 9 Nov 2009 20:27:51 +0000 (21:27 +0100)] 
[BUG] config: disable 'option httplog' on TCP proxies

Gabriel Sosa reported that logs were appearing with BADREQ when
'option httplog' was used with a TCP proxy (eg: inherited via a
default instance). This patch detects it and falls back to tcplog
after emitting a warning.

15 years ago[BUG] config: fix wrong handling of too large argument count
Willy Tarreau [Mon, 9 Nov 2009 20:16:53 +0000 (21:16 +0100)] 
[BUG] config: fix wrong handling of too large argument count

Holger Just reported that running ACLs with too many args caused
a segfault during config parsing. This is caused by a wrong test
on argument count. In case of too many arguments on a config line,
the last one was not correctly zeroed. This is now done and we
report the error indicating what part had been truncated.

16 years ago[MEDIUM] appsession: add the "request-learn" option
Cyril Bonté [Wed, 14 Oct 2009 22:15:40 +0000 (00:15 +0200)] 
[MEDIUM] appsession: add the "request-learn" option

This patch has 2 goals :

1. I wanted to test the appsession feature with a small PHP code,
using PHPSESSID. The problem is that when PHP gets an unknown session
id, it creates a new one with this ID. So, when sending an unknown
session to PHP, persistance is broken : haproxy won't see any new
cookie in the response and will never attach this session to a
specific server.

This also happens when you restart haproxy : the internal hash becomes
empty and all sessions loose their persistance (load balancing the
requests on all backend servers, creating a new session on each one).
For a user, it's like the service is unusable.

The patch modifies the code to make haproxy also learn the persistance
from the client : if no session is sent from the server, then the
session id found in the client part (using the URI or the client cookie)
is used to associated the server that gave the response.

As it's probably not a feature usable in all cases, I added an option
to enable it (by default it's disabled). The syntax of appsession becomes :

  appsession <cookie> len <length> timeout <holdtime> [request-learn]

This helps haproxy repair the persistance (with the risk of losing its
session at the next request, as the user will probably not be load
balanced to the same server the first time).

2. This patch also tries to reduce the memory usage.
Here is a little example to explain the current behaviour :
- Take a Tomcat server where /session.jsp is valid.
- Send a request using a cookie with an unknown value AND a path
  parameter with another unknown value :

  curl -b "JSESSIONID=12345678901234567890123456789012" http://<haproxy>/session.jsp;jsessionid=00000000000000000000000000000001

(I know, it's unexpected to have a request like that on a live service)
Here, haproxy finds the URI session ID and stores it in its internal
hash (with no server associated). But it also finds the cookie session
ID and stores it again.

- As a result, session.jsp sends a new session ID also stored in the
  internal hash, with a server associated.

=> For 1 request, haproxy has stored 3 entries, with only 1 which will be usable

The patch modifies the behaviour to store only 1 entry (maximum).

Similar patch was merged in 1.4 with commit ID bf47aeb9469b54b0547922bdffe3fcd8e70aac1e.

16 years ago[DOC] trivial fix for man page
Michael Shuler [Wed, 14 Oct 2009 15:23:03 +0000 (10:23 -0500)] 
[DOC] trivial fix for man page

I'm working on helping Arnaud update haproxy in Debian, and one of the
package build warnings I received was about "hyphen where a minus sign
was intended" in the man page - details:
http://lintian.debian.org/tags/hyphen-used-as-minus-sign.html

Patch included in my 1.3.20 Debian package is attached.

(cherry picked from commit 35928e84e2766dc8310dea2b0062365bde0e65c9)

16 years ago[RELEASE] Released version 1.3.22 v1.3.22
Willy Tarreau [Wed, 14 Oct 2009 18:43:22 +0000 (20:43 +0200)] 
[RELEASE] Released version 1.3.22

Released version 1.3.22 with the following main changes :
    - [BUG] unix socket: don't try to dereference frontend/backends
    - [MINOR] unix socket: report the socket path in case of bind error
    - [CONTRIB] halog: support searching by response time
    - [DOC] add a reminder about obsolete documents

16 years ago[DOC] add a reminder about obsolete documents
Willy Tarreau [Wed, 14 Oct 2009 18:30:15 +0000 (20:30 +0200)] 
[DOC] add a reminder about obsolete documents

haproxy-en.txt and haproxy-fr.txt are outdated but people still refer to
them quite often, generally causing a useless waste of time.
(cherry picked from commit a080eca533c860f038e848274a38ad91dc951df4)

16 years ago[CONTRIB] halog: support searching by response time
Willy Tarreau [Wed, 14 Oct 2009 13:16:29 +0000 (15:16 +0200)] 
[CONTRIB] halog: support searching by response time

Also support inverting search criteria when specified uppercase
(cherry picked from commit 5bdfd968ed9c9eb30a1d46f9427e6802d7164476)

16 years ago[MINOR] unix socket: report the socket path in case of bind error
Willy Tarreau [Wed, 14 Oct 2009 13:16:48 +0000 (15:16 +0200)] 
[MINOR] unix socket: report the socket path in case of bind error

When an error occurs during binding of the stats unix socket, messages
are far from clear for the user !
(cherry picked from commit 5d53634f3634ed377843d37ca5450ffed43ecda8)

16 years ago[BUG] unix socket: don't try to dereference frontend/backends
Willy Tarreau [Wed, 14 Oct 2009 13:22:58 +0000 (15:22 +0200)] 
[BUG] unix socket: don't try to dereference frontend/backends

John Lauro reported a new crash on 1.3.21 due to a dereferencing bug
of the frontend which does not have any frontend. The bug was introduced
by commit a3e0e0767f55474e676fffa3387dab4d022a0675.

16 years ago[RELEASE] Released version 1.3.21 v1.3.21
Willy Tarreau [Mon, 12 Oct 2009 04:20:09 +0000 (06:20 +0200)] 
[RELEASE] Released version 1.3.21

Released version 1.3.21 with the following main changes :
    - [DOC] add missing rate_lim and rate_max
    - [BUG] check if rise/fall has an argument and it is > 0
    - [MINOR] add "description", "node" and show-node"/"show-desc", remove "node-name", v2
    - [DOC] Add information about http://haproxy.1wt.eu/contrib.html
    - [MINOR] acl: don't report valid acls as potential mistakes
    - [BUG] task.c: don't assing last_timer to node-less entries
    - [MINOR] export the hostname variable so that all the code can access it
    - [MINOR] stats: add a new node-name setting
    - [MINOR] acl: add support for hdr_ip to match IP addresses in headers
    - [CLEANUP] remove ifdef MSG_NOSIGNAL and define it instead
    - [BUG] buffer_forward() would not correctly consider data already scheduled
    - [MAJOR] http: add support for HTTP 1xx informational responses
    - [BUILD] stream_interface: fix conflicting declaration
    - [CLEANUP] include time.h from freq_ctr.h as it uses "now".
    - [MINOR] report list of supported pollers with -vv
    - [MEDIUM] new option "independant-streams" to stop updating read timeout on writes
    - [BUG] don't refresh timeouts late after detected activity
    - [MINOR] acl: add fe_conn, be_conn, queue, avg_queue
    - [BUILD] add a 'make tags' target (cherry picked from commit ebe0af4b77bca2042565a3f15fc1f597f5862874)

16 years ago[BUILD] add a 'make tags' target
Willy Tarreau [Sat, 10 Oct 2009 20:20:44 +0000 (22:20 +0200)] 
[BUILD] add a 'make tags' target
(cherry picked from commit ebe0af4b77bca2042565a3f15fc1f597f5862874)

16 years ago[BUG] task.c: don't assing last_timer to node-less entries
SaVaGe [Tue, 6 Oct 2009 15:53:37 +0000 (18:53 +0300)] 
[BUG] task.c: don't assing last_timer to node-less entries

I noticed that in __eb32_insert , if the tree is empty
(root->b[EB_LEFT] == NULL) , the node.bit is not defined.
However in __task_queue there are checks:

- if (last_timer->node.bit < 0)
- if (task->wq.node.bit < last_timer->node.bit)

which might rely upon an undefined value.

This is how I see it:

1. We insert eb32_node in an empty wait queue tree for a task (called by
process_runnable_tasks() ):
Inserting into empty wait queue  &task->wq = 0x72a87c8, last_timer
pointer: (nil)

2. Then, we set the last timer to the same address:
Setting last_timer: (nil) to: 0x72a87c8

3. We get a new task to be inserted in the queue (again called by
process_runnable_tasks()) , before the __task_unlink_wq() is called for
the previous task.

4. At this point, we still have last_timer set to 0x72a87c8 , but since
it was inserted in an empty tree, it doesn't have node.bit and the
values above get dereferenced with undefined value.

The bug has no effect right now because the check for equality is still
made, so the next timer will still be queued at the right place anyway,
without any possible side-effect. But it's a pending bug waiting for a
small change somewhere to strike.

Iliya Polihronov
(cherry picked from commit 1d7a420c84cfd19bfeaedfc1dc971fb13dfc8a1f)

16 years ago[MINOR] acl: add fe_conn, be_conn, queue, avg_queue
Willy Tarreau [Sat, 10 Oct 2009 10:02:45 +0000 (12:02 +0200)] 
[MINOR] acl: add fe_conn, be_conn, queue, avg_queue

These ACLs are used to check the number of active connections on the
frontend, backend or in a backend's queue. The avg_queue returns the
average number of queued connections per server, and for this, divides
the total number of queued connections by the number of alive servers.

The dst_conn ACL has been slightly changed to more reflect its name and
original usage, which is to return the number of connections on the
destination address/port (the socket) and not the whole frontend.
(cherry picked from commit a36af91951539ee7b24afd1dee58216979efeaea)

16 years ago[MINOR] acl: don't report valid acls as potential mistakes
Krzysztof Piotr Oledzki [Sun, 4 Oct 2009 22:23:35 +0000 (00:23 +0200)] 
[MINOR] acl: don't report valid acls as potential mistakes

Commit 404e8ab4615d564a74f92a0d3822b0292dd6224f introduced
smart checking for stupid acl typos. However, now haproxy shows
the warning even for valid acls, like this one:
acl Cookie-X-NoAccel    hdr_reg(cookie) (^|\ |;)X-NoAccel=1(;|$)
(cherry picked from commit 4cdd8314e949f1c31f86331a1122c3ec9ff7c233)

16 years ago[DOC] Add information about http://haproxy.1wt.eu/contrib.html
Krzysztof Piotr Oledzki [Sun, 27 Sep 2009 12:20:28 +0000 (14:20 +0200)] 
[DOC] Add information about http://haproxy.1wt.eu/contrib.html

Add information about http://haproxy.1wt.eu/contrib.html in
the CONTRIB file and remove one useless comment.
(cherry picked from commit 6d45fcd7198300b1744c04398a49724aff729b75)

16 years ago[BUG] don't refresh timeouts late after detected activity
Willy Tarreau [Sun, 4 Oct 2009 08:56:08 +0000 (10:56 +0200)] 
[BUG] don't refresh timeouts late after detected activity

In old versions, before 1.3.16, we had to refresh the timeouts after
each call to process_session() because the stream socket handler did
not do it. Now that the sockets can exchange data for a long period
without calling process_session(), we can detect an old activity and
refresh a timeout long after the last activity, causing too late a
detection of some timeouts.

The fix simply consists in not checking for activity anymore in
stream_sock_data_finish() but only set a timeout if it was not
previously set.
(cherry picked from commit fe8903cc76184ef20109d9ec9729a88368b2ccd7)

16 years ago[MEDIUM] new option "independant-streams" to stop updating read timeout on writes
Willy Tarreau [Sat, 3 Oct 2009 20:01:18 +0000 (22:01 +0200)] 
[MEDIUM] new option "independant-streams" to stop updating read timeout on writes

By default, when data is sent over a socket, both the write timeout and the
read timeout for that socket are refreshed, because we consider that there is
activity on that socket, and we have no other means of guessing if we should
receive data or not.

While this default behaviour is desirable for almost all applications, there
exists a situation where it is desirable to disable it, and only refresh the
read timeout if there are incoming data. This happens on sessions with large
timeouts and low amounts of exchanged data such as telnet session. If the
server suddenly disappears, the output data accumulates in the system's
socket buffers, both timeouts are correctly refreshed, and there is no way
to know the server does not receive them, so we don't timeout. However, when
the underlying protocol always echoes sent data, it would be enough by itself
to detect the issue using the read timeout. Note that this problem does not
happen with more verbose protocols because data won't accumulate long in the
socket buffers.

When this option is set on the frontend, it will disable read timeout updates
on data sent to the client. There probably is little use of this case. When
the option is set on the backend, it will disable read timeout updates on
data sent to the server. Doing so will typically break large HTTP posts from
slow lines, so use it with caution.

(cherry picked from commit f27b5ea8dc615bd2a9ffaba90ba3dda66567dbc4)

16 years ago[MINOR] report list of supported pollers with -vv
Willy Tarreau [Sat, 3 Oct 2009 16:57:08 +0000 (18:57 +0200)] 
[MINOR] report list of supported pollers with -vv

During troubleshooting, it's often useful to get the list of supported
pollers but until now it was required to have a working configuration
first. Since the pollers are known before main() is called, let's list
them with the build options.

Also report the default MAXCONN setting.

(cherry picked from commit be5b68584e09b7760230a4ba54278af17e0455f3)

16 years ago[MINOR] add "description", "node" and show-node"/"show-desc", remove "node-name", v2
Krzysztof Piotr Oledzki [Fri, 2 Oct 2009 20:51:14 +0000 (22:51 +0200)] 
[MINOR] add "description", "node" and show-node"/"show-desc", remove "node-name", v2

This patch implements "description" (proxy and global) and "node" (global)
options, removes "node-name" and adds "show-node" & "show-desc" options
for "stats". It also changes the way the header lines (with proxy name) and
the statistics are displayed, so stats no longer look so clumsy with very
long names.

Instead of "node-name" it is possible to use show-node/show-desc with
an optional parameter that overrides a default node/description.

backend cust-0045
        # report specific values for this customer
        stats show-node Europe
        stats show-desc Master node for Europe, Asia, Africa

(cherry picked from commit 48cb2aed5aab2dec7af77055a3cd9a158727527a)

16 years ago[CLEANUP] include time.h from freq_ctr.h as it uses "now".
Willy Tarreau [Thu, 1 Oct 2009 09:05:26 +0000 (11:05 +0200)] 
[CLEANUP] include time.h from freq_ctr.h as it uses "now".

(cherry picked from commit 78ff5d0a9e62b0aa4c31f18859d2a0de71bb9da6)

16 years ago[BUG] check if rise/fall has an argument and it is > 0
Krzysztof Piotr Oledzki [Sun, 27 Sep 2009 14:17:31 +0000 (16:17 +0200)] 
[BUG] check if rise/fall has an argument and it is > 0

Check if rise/fall has an argument and it is > 0  or bad things may happen
in the health checks. ;)

Now it is verified and the code no longer allows for such condition:

backend bad
(...)
        server o-f0 192.168.129.27:80 check inter 4000 source 0.0.0.0 rise 0
        server o-r0 192.168.129.27:80 check inter 4000 source 0.0.0.0 fall 0
        server o-f1 192.168.129.27:80 check inter 4000 source 0.0.0.0 rise
        server o-r1 192.168.129.27:80 check inter 4000 source 0.0.0.0 fall

[ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:98]: 'rise' has to be > 0.
[ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:99]: 'fall' has to be > 0.
[ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:100]: 'rise' expects an integer argument.
[ALERT] 269/161830 (24136) : parsing [../git/haproxy.cfg:101]: 'fall' expects an integer argument.

Also add endline in the custom id checking code.

(cherry picked from commit 08ff959c3eaaac89efb38f249f095a8b0d04ef47)

16 years ago[DOC] add missing rate_lim and rate_max
Krzysztof Piotr Oledzki [Mon, 31 Aug 2009 19:23:27 +0000 (21:23 +0200)] 
[DOC] add missing rate_lim and rate_max

(cherry picked from commit db57c6b293051ed45eb5dc7f9fcc307bedd486eb)

16 years ago[BUILD] stream_interface: fix conflicting declaration
Willy Tarreau [Sun, 20 Sep 2009 18:14:49 +0000 (20:14 +0200)] 
[BUILD] stream_interface: fix conflicting declaration

stream_int_check_timeouts was declared void while it's an int.

(cherry picked from commit 269358db93458d343584581239cd7118a09a52a0)

16 years ago[MAJOR] http: add support for HTTP 1xx informational responses
Willy Tarreau [Tue, 15 Sep 2009 19:25:21 +0000 (21:25 +0200)] 
[MAJOR] http: add support for HTTP 1xx informational responses

HTTP supports status codes 100 and 101 to report protocol indications,
which are followed by the requests's response. Till now, haproxy would
only see those responses without parsing subsequent ones. That means
that cookie additions were only performed on 1xx messages for instance,
which does not work since headers must be ignored with 1xx messages.
Also, logs were not terribly useful with the common 100 status code
in response to "Expect: 100-continue" during POST some requests.

This change adds support for such messages. Now haproxy sees them,
forwards them and skips them until it finds a correct response, which
it logs and processes. As an exception, header removal/rewriting still
work on 1xx responses in order to be able to strip out sensible
information that may have accidentely been left by another equipment
(possibly an older haproxy itself). But headers addition are disabled
however.

This change brings the ability to loop on response without data, which
is a starting point to support keepalive. The change is marked as major
as a few fixes had to be performed in the HTTP message parser.

Note: this change is sensible for version 1.3 but it appears correct
      and has extensively been tested. Also it fixes a real misbehaviour.

(cherry picked from commit 816b97997772524e974b18a165af8f4f803192c6)

16 years ago[BUG] buffer_forward() would not correctly consider data already scheduled
Willy Tarreau [Tue, 15 Sep 2009 18:32:30 +0000 (20:32 +0200)] 
[BUG] buffer_forward() would not correctly consider data already scheduled

The computations in buffer_forward() were only valid if buffer_forward()
was used on a buffer which had no more data scheduled for forwarding.
This is always the case right now so this bug is not yet triggered but
it will soon be. Now we correctly discount the bytes to be forwarded
from the data already present in the buffer.
(cherry picked from commit 91aa577b1f0483c50bfa72b3198cf1a1ff835163)

16 years ago[CLEANUP] remove ifdef MSG_NOSIGNAL and define it instead
Willy Tarreau [Wed, 19 Aug 2009 09:22:33 +0000 (11:22 +0200)] 
[CLEANUP] remove ifdef MSG_NOSIGNAL and define it instead

ifdefs are really annoying in the code. Define MSG_NOSIGNAL to zero
when undefined and remove associated ifdefs.

(cherry picked from commit d6d06909dae55bd594f5a9d6bf54dad04eae382f)

16 years ago[MINOR] acl: add support for hdr_ip to match IP addresses in headers
Willy Tarreau [Sat, 19 Sep 2009 05:54:16 +0000 (07:54 +0200)] 
[MINOR] acl: add support for hdr_ip to match IP addresses in headers

For x-forwarded-for and such headers, it's sometimes needed to match
based on network addresses. Let's use hdr_ip() for that.

16 years ago[MINOR] stats: add a new node-name setting
Willy Tarreau [Sun, 16 Aug 2009 08:29:18 +0000 (10:29 +0200)] 
[MINOR] stats: add a new node-name setting

The new "node-name" stats setting enables reporting of a node ID on
the stats page. It is possible to return the system's host name as
well as a specific name.
(cherry picked from commit 1d45b7cbaeeed0426165521fbd9dab4be55b14a4)

16 years ago[MINOR] export the hostname variable so that all the code can access it
Willy Tarreau [Sun, 16 Aug 2009 08:08:02 +0000 (10:08 +0200)] 
[MINOR] export the hostname variable so that all the code can access it

The hostname variable will be used later, export it.
(cherry picked from commit 3ad6a7640ba6bfbac6987dfa581c345bdc03100b)

16 years ago[RELEASE] Released version 1.3.20 v1.3.20
Willy Tarreau [Sun, 9 Aug 2009 20:53:49 +0000 (22:53 +0200)] 
[RELEASE] Released version 1.3.20

Released version 1.3.20 with the following main changes :
    - [BUG] task: fix possible crash when some timeouts are not configured
    - [BUG] log: option tcplog would log to global if no logger was defined

16 years ago[BUG] log: option tcplog would log to global if no logger was defined
Willy Tarreau [Sun, 9 Aug 2009 08:11:45 +0000 (10:11 +0200)] 
[BUG] log: option tcplog would log to global if no logger was defined

Romuald du Song reported a strange bug causing "option tcplog" to
unexpectedly use global log parameters if no log server was declared.

Eventhough it can be useful in some circumstances, it only hides
configuration bugs and can even cause traffic logs to be sent to
the wrong logger, since global settings are just for the process.

This has been fixed and a warning has been added for configurations
where tcplog or httplog are set without any logger. This fix must
be backported to 1.3.20, but not to 1.3.15.X in order not to risk
any regression on old configurations.
(cherry picked from commit e7ded1f8698ab954656106baae9cc8da00567511)

16 years ago[BUG] task: fix possible crash when some timeouts are not configured
Willy Tarreau [Sun, 9 Aug 2009 07:09:54 +0000 (09:09 +0200)] 
[BUG] task: fix possible crash when some timeouts are not configured

Cristian Ditoiu reported a major regression when testing 1.3.19 at
transfer.ro. It would crash within a few minutes while 1.3.15.10
was OK. He offered to help so we could run gdb and debug the crash
live. We finally found that the crash was the result of a regression
introduced by recent fix 814c978fb67782ceeaf1db74abfe7083938bedff
(task: fix possible timer drift after update) which makes it possible
for a tree walk to start from a detached task if this task has got
its timeout disabled due to a missing timeout.

The trivial fix below has been extensively tested and confirmed not
to crash anymore.

Special thanks to Cristian who spontaneously provided a lot of help
and trust to debug this issue which at first glance looked impossible
after reading the code and traces, but took less than an hour to spot
and fix when caught live in gdb ! That's really appreciated !
(cherry picked from commit 34e98ea70d09195e8e047b3ea22c23506598687d)

16 years ago[RELEASE] Released version 1.3.19 v1.3.19
Willy Tarreau [Mon, 27 Jul 2009 19:39:21 +0000 (21:39 +0200)] 
[RELEASE] Released version 1.3.19

Released version 1.3.19 with the following main changes :
    - [MINOR] startup: don't imply -q with -D
    - [BUG] ensure that we correctly re-start old process in case of error
    - [MEDIUM] add support for binding to source port ranges during connect
    - [MEDIUM] support setting a server weight to zero
    - [MINOR] make DEFAULT_MAXCONN user-configurable at build time
    - [MEDIUM] config: split parser and checker in two functions
    - [MEDIUM] config: support loading multiple configuration files
    - [BUG] http: redirect rules were processed too early
    - [CLEANUP] remove unused DEBUG_PARSE_NO_SPEEDUP define
    - [BUG] default ACLs did not properly set the ->requires flag
    - [BUILD] report commit date and not author's date as build date
    - [BUG] stream_sock: always shutdown(SHUT_WR) before closing
    - [BUG] stream_sock: don't stop reading when the poller reports an error
    - [BUG] config: tcp-request content only accepts "if" or "unless"
    - [BUG] task: fix possible timer drift after update
    - [MINOR] stats: better displaying in MSIE
    - [MINOR] config: improve error reporting in global section
    - [MINOR] config: improve error reporting in listen sections
    - [MINOR] config: the "capture" keyword is not allowed in backends
    - [MINOR] config: improve error reporting when checking configuration
    - [BUILD] fix a minor build warning on AIX
    - [BUILD] use "git cmd" instead of "git-cmd"
    - [CLEANUP] report 2009 not 2008 in the copyright banner.
    - [MINOR] print usage on the stats sockets upon invalid commands
    - [MINOR] acl: detect and report potential mistakes in ACLs
    - [BUILD] fix incorrect printf arg count with tcp_splice
    - [BUG] fix random pauses on last segment of a series
    - [BUILD] add support for build under Cygwin

16 years ago[BUG] fix random pauses on last segment of a series
Willy Tarreau [Mon, 27 Jul 2009 18:08:06 +0000 (20:08 +0200)] 
[BUG] fix random pauses on last segment of a series

During a direct data transfer from the server to the client, if the
system did not have enough buffers anymore, haproxy would not enable
write polling again if it could write at least one data chunk. Under
normal conditions, this would remain undetected because the remaining
data would be pushed by next data chunks.

However, when this happens on the last chunk of a session, or the last
in a series in an interactive bidirectional TCP transfer, haproxy would
only start sending again when the read timeout was reached on the side
it stopped writing, causing long pauses on some protocols such as SQL.

This bug was reported by an Exceliance customer who generously offered
to help us by sending large amounts of traces and running various tests
on production systems.

It is quite hard to trigger it but it becomes easier with a ping-pong
TCP service which transfers random data sizes, with a modified version
of send() able to send packets smaller than the average transfer size.

A cleaner fix would imply only updating the write timeout when data
transfers are *attempted*, not succeeded, but that requires more
sensible code changes without fixing the result. It is a candidate
for a later patch though.
(cherry picked from commit c54aef3180c00abc5abe33136f4cfbaa1328bdb1)

16 years ago[BUILD] fix incorrect printf arg count with tcp_splice
Willy Tarreau [Sun, 26 Jul 2009 18:40:05 +0000 (20:40 +0200)] 
[BUILD] fix incorrect printf arg count with tcp_splice

remove an extra arg.
(cherry picked from commit bc69d8bbcf80ab8721449636e274a691f117680f)

16 years ago[MINOR] acl: detect and report potential mistakes in ACLs
Willy Tarreau [Sun, 26 Jul 2009 17:40:40 +0000 (19:40 +0200)] 
[MINOR] acl: detect and report potential mistakes in ACLs

I've discovered a configuration with lots of occurrences of the
following :

    acl xxx hdr_beg (host) xxx

The problem is that hdr_beg will match every header against patterns
(host) and xxx due to the space between both, which certainly is not
what the user wanted. Now we detect such ACLs and report a warning
with a suggestion to add "--" between "hdr_beg" and "(host)" if this
is definitely what is wanted.
(cherry picked from commit 404e8ab4615d564a74f92a0d3822b0292dd6224f)

16 years ago[MINOR] print usage on the stats sockets upon invalid commands
Willy Tarreau [Sun, 26 Jul 2009 16:16:43 +0000 (18:16 +0200)] 
[MINOR] print usage on the stats sockets upon invalid commands

When issuing commands on the unix socket, there's no way to
know if the result is empty or if the command is wrong. This
patch makes invalid command return a help message.
(cherry picked from commit 43e0e3997870e39b78b87d3050f260571e5a7de9)

16 years ago[CLEANUP] report 2009 not 2008 in the copyright banner.
Willy Tarreau [Thu, 23 Jul 2009 11:45:47 +0000 (13:45 +0200)] 
[CLEANUP] report 2009 not 2008 in the copyright banner.

(cherry picked from commit b455691af393f831ab44c70b605fd45e7ca0967b)

16 years ago[BUILD] use "git cmd" instead of "git-cmd"
Willy Tarreau [Thu, 23 Jul 2009 11:43:33 +0000 (13:43 +0200)] 
[BUILD] use "git cmd" instead of "git-cmd"

Newer GIT versions do not support "git-cmd" anymore, so date and version
can be wrong during development builds. Use "git cmd" now. Also fix
git-tar to use "git archive" instead of "git-tar-tree".
(cherry picked from commit 63076b3f611803a9bf9e6012193f89d14ccc32d2)

16 years ago[BUILD] fix a minor build warning on AIX
Willy Tarreau [Thu, 23 Jul 2009 11:40:20 +0000 (13:40 +0200)] 
[BUILD] fix a minor build warning on AIX

AIX wants string.h in signal.c (and is right to do so) :

gcc -Iinclude -Wall  -O2 -g       -DTPROXY -DENABLE_POLL  -DCONFIG_HAPROXY_VERSION=\"1.3.18\" -DCONFIG_HAPROXY_DATE=\"2009/05/10\" -c -o src/signal.o src/signal.c
src/signal.c: In function 'signal_init':
src/signal.c:32: warning: implicit declaration of function 'memset'
src/signal.c:32: warning: incompatible implicit declaration of built-in function 'memset'
(cherry picked from commit be8c736cca24f3981a3e9dee868605ae76b9565c)

16 years ago[MINOR] config: improve error reporting when checking configuration
Willy Tarreau [Thu, 23 Jul 2009 11:36:36 +0000 (13:36 +0200)] 
[MINOR] config: improve error reporting when checking configuration

Do not exit early at the first error found while checking configuration
validity. This particularly helps spotting multiple wrong tracked server
names at once.
(cherry picked from commit bb9250104fdf1096b708181c82172df737341a95)

16 years ago[MINOR] config: the "capture" keyword is not allowed in backends
Willy Tarreau [Thu, 23 Jul 2009 11:24:23 +0000 (13:24 +0200)] 
[MINOR] config: the "capture" keyword is not allowed in backends

The "capture" keyword is only supported by frontends, fix the check.
(cherry picked from commit 3b6b1a984d6a587892afc88d03862c3fc3681bce)

16 years ago[MINOR] config: improve error reporting in listen sections
Willy Tarreau [Thu, 23 Jul 2009 11:19:11 +0000 (13:19 +0200)] 
[MINOR] config: improve error reporting in listen sections

Try not to immediately exit on non-fatal errors while parsing a
listen section, so that the user has a chance to get most of the
errors at once, which is quite convenient especially during config
checks with the -c argument.
(cherry picked from commit 9389379f608d0776988125e52cbac12a2a2ad165)

16 years ago[MINOR] config: improve error reporting in global section
Willy Tarreau [Mon, 20 Jul 2009 07:30:05 +0000 (09:30 +0200)] 
[MINOR] config: improve error reporting in global section

Try not to immediately exit on non-fatal errors while parsing the
global section, so that the user has a chance to get most of the
errors at once, which is quite convenient especially during config
checks with the -c argument. Some other errors such as unresolved
server names also don't make the parser exit too early.
(cherry picked from commit 058e9074865abd23912127d8847cccb6b5f4eb8b)

16 years ago[MINOR] stats: better displaying in MSIE
Willy Tarreau [Wed, 15 Jul 2009 08:07:05 +0000 (10:07 +0200)] 
[MINOR] stats: better displaying in MSIE

MSIE does not correctly display spaced digits. It requires a margin of
at least one pixel. Also, it does not correctly hide empty cells, so we
work around this by setting the background white. Last, the H1 font was
too large, so we reduce it by one size, which is still OK in other
browsers.
(cherry picked from commit da6721ba28d4c917e07ffa7fef1d8707c80c54b6)

16 years ago[BUG] task: fix possible timer drift after update
Willy Tarreau [Tue, 14 Jul 2009 21:48:55 +0000 (23:48 +0200)] 
[BUG] task: fix possible timer drift after update

When the scheduler detected that a task was misplaced in the timer
queue, it used to place it right again. Unfortunately, it did not
check whether it would still call the new task from its new place.
This resulted in some tasks not getting called on timeout once in
a while, causing a minor drift for repetitive timers. This effect
was only observable with slow health checks and without any activity
because no other task would cause the scheduler to be immediately
called again.

In practice, it does not affect any real-world configuration, but
it's still better to fix it.
(cherry picked from commit 814c978fb67782ceeaf1db74abfe7083938bedff)

16 years ago[BUG] config: tcp-request content only accepts "if" or "unless"
Willy Tarreau [Tue, 14 Jul 2009 19:17:05 +0000 (21:17 +0200)] 
[BUG] config: tcp-request content only accepts "if" or "unless"

As reported by Maik Broemme, if something different from "if" or
"unless" was specified after "tcp-request content accept", the
condition would silently remain void. The parser must obviously
complain since this typically corresponds to a forgotten "if".
(cherry picked from commit 606ad73e73600275aae944f00bda4af9976c0be8)

16 years ago[BUG] stream_sock: don't stop reading when the poller reports an error
Willy Tarreau [Tue, 14 Jul 2009 17:55:05 +0000 (19:55 +0200)] 
[BUG] stream_sock: don't stop reading when the poller reports an error

As reported by Jean-Baptiste Quenot and Robbie Aelter, sometimes a
backend server error is converted to a 502 error if the backend stops
before reading all the request. The reason is that the remote system
sends a TCP RST packet because there are still unread data pending in
the socket buffer. This RST is translated as a socket error on the
local system, and this error is reported by the poller.

However, most of the time, it's a write error, but the system is
still able to read the remaining pending data, such as in the trace
below :

send(7, "GET /aaa HTTP/1.0\r\nUser-Agent: Mo"..., 1123, MSG_DONTWAIT|MSG_NOSIGNAL) = 1123
epoll_ctl(3, EPOLL_CTL_ADD, 7, {EPOLLIN, {u32=7, u64=7}}) = 0
epoll_wait(3, {{EPOLLIN|EPOLLERR|EPOLLHUP, {u32=7, u64=7}}}, 8, 1000) = 1
gettimeofday({1247593958, 643572}, NULL) = 0
recv(7, "HTTP/1.0 400 Bad request\r\nCache-C"..., 7000, MSG_NOSIGNAL) = 187
setsockopt(6, SOL_TCP, TCP_NODELAY, [0], 4) = 0
setsockopt(6, SOL_TCP, TCP_CORK, [1], 4) = 0
send(6, "HTTP/1.0 400 Bad request\r\nCache-C"..., 187, MSG_DONTWAIT|MSG_NOSIGNAL) = 187
shutdown(6, 1 /* send */)               = 0

The recv succeeded while epoll_wait() reported an error.

Note: This case is very hard to reproduce and requires that the backend
server is reached via the loopback in order to minimise latency and
reduce the risk of sent data being ACKed.
(cherry picked from commit 7154365cc60b124b543db4e98faedc75c0f3a2cb)

16 years ago[BUG] stream_sock: always shutdown(SHUT_WR) before closing
Willy Tarreau [Tue, 14 Jul 2009 17:21:50 +0000 (19:21 +0200)] 
[BUG] stream_sock: always shutdown(SHUT_WR) before closing

When we close a socket with unread data in the buffer, or when the
nolinger option is set, we regularly lose the last fragment, which
often contains the error message. This typically occurs when sending
too large a request. Only the RST is seen due to the close() (since
not all data were read) and the output message never reaches the
network.

Doing a shutdown() before the close() solves this annoying issue
because the data are really pushed before the system sends the RST.
(cherry picked from commit 720058cdcbd5285dc4e4a48216b10c9b96000141)

16 years ago[BUILD] report commit date and not author's date as build date
Willy Tarreau [Tue, 14 Jul 2009 11:24:16 +0000 (13:24 +0200)] 
[BUILD] report commit date and not author's date as build date

By default, when building from a git tree, haproxy's release date is
set to the last commit's date. But it was the wrong date which was
used, the initial patch's date, which can cause time jumps in the
past when an old patch gets merged. What we want is the commit date,
which reflects the correct code history.
(cherry picked from commit 446024e7fb5faef86cd6e2c0aba3c4524ad77705)

16 years ago[BUG] default ACLs did not properly set the ->requires flag
Willy Tarreau [Sun, 12 Jul 2009 07:21:30 +0000 (09:21 +0200)] 
[BUG] default ACLs did not properly set the ->requires flag

This bug caused TCP proxies not to report incorrect use of some
aliases of HTTP ACLs.
(cherry picked from commit a55b7dc52877ee81609db688f327e7e9586498f0)

16 years ago[CLEANUP] remove unused DEBUG_PARSE_NO_SPEEDUP define
Willy Tarreau [Tue, 7 Jul 2009 06:56:15 +0000 (08:56 +0200)] 
[CLEANUP] remove unused DEBUG_PARSE_NO_SPEEDUP define

This one has become useless with the new HTTP parser.
(cherry picked from commit 571ec98baaacd68205ada1cda898ae359a41bc83)

16 years ago[BUG] http: redirect rules were processed too early
Willy Tarreau [Mon, 6 Jul 2009 14:34:52 +0000 (16:34 +0200)] 
[BUG] http: redirect rules were processed too early

redirect rules are documented as being processed last before
use_backend but were mistakenly processed before block rules.
Fortunately very few people use a mix of block and redirect
rules, so this bug has never been reported yet.
(cherry picked from commit 06b917c7abcd7313263d551eaecda1b31b9c03b1)

16 years ago[MEDIUM] config: support loading multiple configuration files
Willy Tarreau [Mon, 22 Jun 2009 14:02:30 +0000 (16:02 +0200)] 
[MEDIUM] config: support loading multiple configuration files

We now support up to 10 distinct configuration files. They are
all loaded in the order defined by -f <file1> -f <file2> ...

This can be useful in order to store global, private, public,
etc... configurations in distinct files.
(cherry picked from commit 5d01a63b7862235fdd3119cb29d5a0cfd04edb91)

16 years ago[MEDIUM] config: split parser and checker in two functions
Willy Tarreau [Mon, 22 Jun 2009 13:48:36 +0000 (15:48 +0200)] 
[MEDIUM] config: split parser and checker in two functions

This is a first step towards support of multiple configuration files.
Now readcfgfile() only reads a file in memory and performs very minimal
parsing. The checks are performed afterwards.
(cherry picked from commit 915e1ebe63b2137fa1634ebc9553f5b73ae2fd75)

16 years ago[MINOR] make DEFAULT_MAXCONN user-configurable at build time
Willy Tarreau [Mon, 15 Jun 2009 14:33:36 +0000 (16:33 +0200)] 
[MINOR] make DEFAULT_MAXCONN user-configurable at build time

The only way to set this previously was to set SYSTEM_MAXCONN
which serves a different purpose.
(cherry picked from commit c9fe4562c24ebacdfdf55631636e5a5a0395e43c)

16 years ago[MEDIUM] support setting a server weight to zero
Willy Tarreau [Mon, 15 Jun 2009 08:56:05 +0000 (10:56 +0200)] 
[MEDIUM] support setting a server weight to zero

Sometimes it is useful to be able to set a server's weight to zero.
It allows the server to receive only persistent traffic but never
normal traffic.
(cherry picked from commit 6704d67d656574a602ddf81a603cdb4f482f90a9)

16 years ago[BUILD] add support for build under Cygwin
Yitzhak Sapir [Sun, 14 Jun 2009 16:27:54 +0000 (18:27 +0200)] 
[BUILD] add support for build under Cygwin

After considering various possibilities, we compiled haproxy under cygwin.
Attached is an updated full diff that also has the TARGET=cygwin documented.
The whole thing compiles and installs with this diff only.

In cygwin 1.7 (now in beta), there is apparently support for ipv6.  Cygwin
1.5 (later versions, anyway) already includes some support in the form of a
define USE_IPV6.  When defined, it declares the sockaddr_in6 struct and
possibly other things.  The above definition AF_INET6=23 is taken from
their /usr/include/socket.h file (where it is #if 0'd out).

We are running into a socket limit.  It appears that Cygwin (running on
Windows 2003 Server) will only allow us to set ulimit -n (maximum open
files) to 3200, which means we're a little short of 1600 connections.

The limit of 3200 is an internal Cygwin limit.  Perhaps they can raise it in
the future.  Using the nbproc option, I was able to bring up 10 servers.  It
seems to me that they were able to handle over 2000 connections (even though
each had maxconn 1500 set, and the hard Cygwin fd limit).
(cherry picked from commit 32087312e3a4ad483440d371b0b1769db23946d3)

16 years ago[MEDIUM] add support for binding to source port ranges during connect
Willy Tarreau [Wed, 10 Jun 2009 09:09:37 +0000 (11:09 +0200)] 
[MEDIUM] add support for binding to source port ranges during connect

Some users are already hitting the 64k source port limit when
connecting to servers. The system usually maintains a list of
unused source ports, regardless of the source IP they're bound
to. So in order to go beyond the 64k concurrent connections, we
have to manage the source ip:port lists ourselves.

The solution consists in assigning a source port range to each
server and use a free port in that range when connecting to that
server, either for a proxied connection or for a health check.
The port must then be put back into the server's range when the
connection is closed.

This mechanism is used only when a port range is specified on
a server. It makes it possible to reach 64k connections per
server, possibly all from the same IP address. Right now it
should be more than enough even for huge deployments.
(cherry picked from commit c6f4ce8fc4a9da9f4c31e8d088fab1ed4f631ed0)

16 years ago[BUG] ensure that we correctly re-start old process in case of error
Willy Tarreau [Tue, 9 Jun 2009 12:36:00 +0000 (14:36 +0200)] 
[BUG] ensure that we correctly re-start old process in case of error

When a new process fails to grab some ports, it sends a signal to
the old process in order to release them. Then it tries to bind
again. If it still fails (eg: one of the ports is bound to a
completely different process), it must send the continue signal
to the old process so that this one re-binds to the ports. This
is correctly done, but the newly bound ports are not released
first, which sometimes causes the old process to remain running
with no port bound. The fix simply consists in unbinding all
ports before sending the signal to the old process.
(cherry picked from commit f68da4603a092f35af627c459dbc714d9fa796e9)

16 years ago[MINOR] startup: don't imply -q with -D
Willy Tarreau [Mon, 18 May 2009 14:29:51 +0000 (16:29 +0200)] 
[MINOR] startup: don't imply -q with -D

It is recommended to have -D in init scripts, but -D also implies
quiet mode, which hides warning messages, and both options are now
completely unrelated. Remove the implication to get warnings with
-D.

16 years ago[RELEASE] Released version 1.3.18 v1.3.18
Willy Tarreau [Sun, 10 May 2009 18:27:47 +0000 (20:27 +0200)] 
[RELEASE] Released version 1.3.18

Released version 1.3.18 with the following main changes :
    - [MEDIUM] add support for "balance hdr(name)"
    - [CLEANUP] give a little bit more information in error message
    - [MINOR] add X-Original-To: header
    - [BUG] x-original-to: fix missing initialization to default value
    - [BUILD] spec file: fix broken pipe during rpmbuild and add man file
    - [MINOR] improve reporting of misplaced acl/reqxxx rules
    - [MEDIUM] http: add options to ignore invalid header names
    - [MEDIUM] http: capture invalid requests/responses even if accepted
    - [BUILD] add format(printf) to printf-like functions
    - [MINOR] fix several printf formats and missing arguments
    - [BUG] stats: total and lbtot are unsigned
    - [MINOR] fix a few remaining printf-like formats on 64-bit platforms
    - [CLEANUP] remove unused make option from haproxy.spec
    - [BUILD] make it possible to pass alternative arch at build time
    - [MINOR] switch all stat counters to 64-bit
    - [MEDIUM] ensure we don't recursively call pool_gc2()
    - [CRITICAL] uninitialized response field can sometimes cause crashes
    - [BUG] fix wrong pointer arithmetics in HTTP message captures
    - [MINOR] rhel init script : support the reload operation
    - [MINOR] add basic signal handling functions
    - [BUILD] add signal.o to all makefiles
    - [MEDIUM] call signal_process_queue from run_poll_loop
    - [MEDIUM] pollers: don't wait if a signal is pending
    - [MEDIUM] convert all signals to asynchronous signals
    - [BUG] O(1) pollers should check their FD before closing it
    - [MINOR] don't close stdio fds twice
    - [MINOR] add options dontlog-normal and log-separate-errors
    - [DOC] minor fixes and rearrangements
    - [BUG] fix parser crash on unconditional tcp content rules
    - [DOC] rearrange the configuration manual and add a summary
    - [MINOR] standard: provide a new 'my_strndup' function
    - [MINOR] implement per-logger log level limitation
    - [MINOR] compute the max of sessions/s on fe/be/srv
    - [MINOR] stats: report max sessions/s and limit in CSV export
    - [MINOR] stats: report max sessions/s and limit in HTML stats
    - [MINOR] stats/html: use the arial font before helvetica

16 years ago[MINOR] stats/html: use the arial font before helvetica
Willy Tarreau [Sun, 10 May 2009 18:08:10 +0000 (20:08 +0200)] 
[MINOR] stats/html: use the arial font before helvetica

The stats HTML output were barely readable on some browsers such as
firefox on Linux, due to the selected helvetica font which is too
small. Specifying "arial" first fixes the issue without changing the
table size. Also, the default size of 0.8em choosen to get 10px out
of 12px is wrong because it gets 9px when rounded down.

16 years ago[MINOR] stats: report max sessions/s and limit in HTML stats
Willy Tarreau [Sun, 10 May 2009 17:19:41 +0000 (19:19 +0200)] 
[MINOR] stats: report max sessions/s and limit in HTML stats

16 years ago[MINOR] stats: report max sessions/s and limit in CSV export
Willy Tarreau [Sun, 10 May 2009 17:01:49 +0000 (19:01 +0200)] 
[MINOR] stats: report max sessions/s and limit in CSV export

16 years ago[MINOR] compute the max of sessions/s on fe/be/srv
Willy Tarreau [Sun, 10 May 2009 16:52:49 +0000 (18:52 +0200)] 
[MINOR] compute the max of sessions/s on fe/be/srv

Some users want to keep the max sessions/s seen on servers, frontends
and backends for capacity planning. It's easy to grab it while the
session count is updated, so let's keep it.

16 years ago[MINOR] implement per-logger log level limitation
Willy Tarreau [Sun, 10 May 2009 15:20:05 +0000 (17:20 +0200)] 
[MINOR] implement per-logger log level limitation

Some people are using haproxy in a shared environment where the
system logger by default sends alert and emerg messages to all
consoles, which happens when all servers go down on a backend for
instance. These people can not always change the system configuration
and would like to limit the outgoing messages level in order not to
disturb the local users.

The addition of an optional 4th field on the "log" line permits
exactly this. The minimal log level ensures that all outgoing logs
will have at least this level. So the logs are not filtered out,
just set to this level.

16 years ago[MEDIUM] add support for "balance hdr(name)"
Benoit [Wed, 25 Mar 2009 12:02:10 +0000 (13:02 +0100)] 
[MEDIUM] add support for "balance hdr(name)"

There is a patch made by me that allow for balancing on any http header
field.

[WT:
  made minor changes:
  - turned 'balance header name' into 'balance hdr(name)' to match more
    closely the ACL syntax for easier future convergence
  - renamed the proxy structure fields header_* => hh_*
  - made it possible to use the domain name reduction to any header, not
    only "host" since it makes sense to do it with other ones.
  Otherwise patch looks good.
/WT]

16 years ago[MINOR] standard: provide a new 'my_strndup' function
Willy Tarreau [Sun, 10 May 2009 13:41:18 +0000 (15:41 +0200)] 
[MINOR] standard: provide a new 'my_strndup' function

This function is only offered by GNU extensions and is sometimes
useful during configuration parsing.

16 years ago[DOC] rearrange the configuration manual and add a summary
Willy Tarreau [Sun, 10 May 2009 11:12:33 +0000 (13:12 +0200)] 
[DOC] rearrange the configuration manual and add a summary

Several people have asked for a summary in order to ease finding
of sections in the configuration manual. It was the opportunity to
tidy it up a bit and rearrange some sections.

16 years ago[BUG] fix parser crash on unconditional tcp content rules
Willy Tarreau [Sun, 10 May 2009 10:05:46 +0000 (12:05 +0200)] 
[BUG] fix parser crash on unconditional tcp content rules

Since 1.3.17, a config containing one of the following lines would
crash the parser :

    tcp content reject
    tcp content accept

This is because a check is performed on the condition which is not
specified. The obvious fix consists in checkinf for a condition
first.

16 years ago[DOC] minor fixes and rearrangements
Willy Tarreau [Sun, 10 May 2009 10:02:55 +0000 (12:02 +0200)] 
[DOC] minor fixes and rearrangements

Rearranged a few misplaced keywords, fixed a few typos and truncated
some long lines.

16 years ago[MINOR] add options dontlog-normal and log-separate-errors
Willy Tarreau [Sun, 10 May 2009 09:57:02 +0000 (11:57 +0200)] 
[MINOR] add options dontlog-normal and log-separate-errors

Some big traffic sites have trouble dealing with logs and tend to
disable them. Here are two new options to help cope with massive
logs.

  - dontlog-normal only disables logging for 100% successful
    connections, other ones will still be logged

  - log-separate-errors will cause non-100% successful connections
    to be logged at level "err" instead of level "info" so that a
    properly configured syslog daemon can send them to a different
    file for longer conservation.

16 years ago[MINOR] don't close stdio fds twice
Willy Tarreau [Sun, 10 May 2009 08:33:29 +0000 (10:33 +0200)] 
[MINOR] don't close stdio fds twice

This minor harmless bug dates back to v1.1. When fclose() was added,
the close() calls were not removed, so the fds 0,1,2 are closed twice.

16 years ago[BUG] O(1) pollers should check their FD before closing it
Willy Tarreau [Sun, 10 May 2009 08:18:54 +0000 (10:18 +0200)] 
[BUG] O(1) pollers should check their FD before closing it

epoll, sepoll and kqueue pollers should check that their fd is not
closed before attempting to close it, otherwise we can end up with
multiple closes of fd #0 upon exit, which is harmless but dirty.

16 years ago[MEDIUM] convert all signals to asynchronous signals
Willy Tarreau [Sun, 10 May 2009 07:59:50 +0000 (09:59 +0200)] 
[MEDIUM] convert all signals to asynchronous signals

The small list of signals currently handled by haproxy were processed
as soon as they were received. This has caused trouble with calls to
pool_gc2() occuring in the middle of libc's memory management functions
seldom causing deadlocks preventing the old process from leaving.

Now these signals use the new async signal framework and are called
asynchronously, when there is no risk of recursion. This ensures more
reliable operation, especially for sensible processing such as memory
management.

16 years ago[MEDIUM] pollers: don't wait if a signal is pending
Willy Tarreau [Sun, 10 May 2009 07:57:21 +0000 (09:57 +0200)] 
[MEDIUM] pollers: don't wait if a signal is pending

If an asynchronous signal is received outside of the poller, we don't
want the poller to wait for a timeout to occur before processing it,
so we set its timeout to zero, just like we do with pending tasks in
the run queue.

16 years ago[MEDIUM] call signal_process_queue from run_poll_loop
Willy Tarreau [Sun, 10 May 2009 07:01:21 +0000 (09:01 +0200)] 
[MEDIUM] call signal_process_queue from run_poll_loop

Now we check for asynchronous pending signals. There's no user yet
so this cannot cause any trouble.

16 years ago[BUILD] add signal.o to all makefiles
Willy Tarreau [Sun, 10 May 2009 07:00:20 +0000 (09:00 +0200)] 
[BUILD] add signal.o to all makefiles

16 years ago[MINOR] add basic signal handling functions
Willy Tarreau [Sun, 10 May 2009 06:53:33 +0000 (08:53 +0200)] 
[MINOR] add basic signal handling functions

These functions will be used to deliver asynchronous signals in order
to make the signal handling functions more robust. The goal is to keep
the same interface to signal handlers.

16 years ago[BUG] x-original-to: fix missing initialization to default value
Maik Broemme [Fri, 8 May 2009 15:02:07 +0000 (17:02 +0200)] 
[BUG] x-original-to: fix missing initialization to default value

16 years ago[MINOR] add X-Original-To: header
Maik Broemme [Fri, 17 Apr 2009 16:53:21 +0000 (18:53 +0200)] 
[MINOR] add X-Original-To: header

I have attached a patch which will add on every http request a new
header 'X-Original-To'. If you have HAProxy running in transparent mode
with a big number of SQUID servers behind it, it is very nice to have
the original destination ip as a common header to make decisions based
on it.

The whole thing is configurable with a new option 'originalto'. I have
updated the sourcecode as well as the documentation. The 'haproxy-en.txt'
and 'haproxy-fr.txt' files are untouched, due to lack of my french
language knowledge. ;)

Also the patch adds this header for IPv4 only. I haven't any IPv6 test
environment running here and don't know if getsockopt() with SO_ORIGINAL_DST
will work on IPv6. If someone knows it and wants to test it I can modify
the diff. Feel free to ask me questions or things which should be changed. :)

--Maik

16 years ago[MINOR] rhel init script : support the reload operation
Willy Tarreau [Fri, 1 May 2009 13:49:56 +0000 (15:49 +0200)] 
[MINOR] rhel init script : support the reload operation

The reload operation in the Red Hat init script caused a restart
which is not always the best thing to do. Implement the reload.

16 years ago[BUG] fix wrong pointer arithmetics in HTTP message captures
Willy Tarreau [Fri, 1 May 2009 09:33:17 +0000 (11:33 +0200)] 
[BUG] fix wrong pointer arithmetics in HTTP message captures

The pointer arithmetics was wrong in http_capture_bad_message().
This has no impact right now because the error only msg->som was
affected and right now it's always 0. But this was a bug waiting
for keepalive support to strike.

16 years ago[CRITICAL] uninitialized response field can sometimes cause crashes
Willy Tarreau [Mon, 27 Apr 2009 06:11:33 +0000 (08:11 +0200)] 
[CRITICAL] uninitialized response field can sometimes cause crashes

The response message in the transaction structure was not properly
initialised at session initialisation. In theory it cannot cause any
trouble since the affected field os expected to always remain NULL.
However, in some circumstances, such as building on 64-bit platforms
with certain options, the struct session can be exactly 1024 bytes,
the same size of the requri field, so the pools are merged and the
uninitialised field may contain non-null data, causing crashes if
an invalid response is encountered and archived.

The fix simply consists in correctly initialising the missing fields.
This bug cannot affect architectures where the session pool is not
shared (32-bit architectures), but this is only by pure luck.

16 years ago[MEDIUM] ensure we don't recursively call pool_gc2()
Willy Tarreau [Tue, 21 Apr 2009 00:17:45 +0000 (02:17 +0200)] 
[MEDIUM] ensure we don't recursively call pool_gc2()

A race condition exists in the hot reconfiguration code. It is
theorically possible that the second signal is sent during a free()
in the first list, which can cause crashes or freezes (the later
have been observed). Just set up a counter to ensure we do not
recurse.

16 years ago[MINOR] switch all stat counters to 64-bit
Willy Tarreau [Sat, 11 Apr 2009 18:44:08 +0000 (20:44 +0200)] 
[MINOR] switch all stat counters to 64-bit

The byte counters have long been 64-bit to avoid overflows. But with
several sites nowadays, we see session counters wrap around every 10-days
or so. So it was the moment to switch counters to 64-bit, including
error and warning counters which can theorically rise as fast as session
counters even if in practice there is very low risk.

The performance impact should not be noticeable since those counters are
only updated once per session. The stats output have been carefully checked
for proper types on both 32- and 64-bit platforms.

16 years ago[BUILD] make it possible to pass alternative arch at build time
Willy Tarreau [Sat, 11 Apr 2009 17:45:50 +0000 (19:45 +0200)] 
[BUILD] make it possible to pass alternative arch at build time

When trying to build a 32-bit binary on a 64-bit platform, we generally
need to pass "-m32" to gcc, which is not convenient with current makefile.
Note that this option requires gcc >= 3.

In order to ease parameter passing, a new ARCH= makefile option has been
added. If it receives a target architecture, according "-m32"/"-m64" and
"-march=xxxx" will be passed to gcc. Only the generic makefile has been
changed to support this option right now as the need only appeared on Linux.

The spec file now makes use of this option so that rpmbuild can automatically
build with the proper architecture.

16 years ago[CLEANUP] remove unused make option from haproxy.spec
Willy Tarreau [Sat, 11 Apr 2009 17:44:17 +0000 (19:44 +0200)] 
[CLEANUP] remove unused make option from haproxy.spec

16 years ago[MINOR] fix a few remaining printf-like formats on 64-bit platforms
Willy Tarreau [Sat, 11 Apr 2009 17:42:49 +0000 (19:42 +0200)] 
[MINOR] fix a few remaining printf-like formats on 64-bit platforms

Mainly two sizeof() returning size_t which is not the size of an int
on 64-bit platforms.

16 years ago[BUG] stats: total and lbtot are unsigned
Willy Tarreau [Tue, 7 Apr 2009 11:27:40 +0000 (13:27 +0200)] 
[BUG] stats: total and lbtot are unsigned

Some big users are seeing negative numbers in the CSV stats. This patch
needs to be backported to 1.3.15 and extended to the HTML part.

16 years ago[BUILD] spec file: fix broken pipe during rpmbuild and add man file
Sébastien Barrier [Thu, 2 Apr 2009 13:09:35 +0000 (15:09 +0200)] 
[BUILD] spec file: fix broken pipe during rpmbuild and add man file

16 years ago[CLEANUP] give a little bit more information in error message
Jeffrey 'jf' Lim [Thu, 2 Apr 2009 13:53:56 +0000 (21:53 +0800)] 
[CLEANUP] give a little bit more information in error message

Indicate the error is about redirection.

16 years ago[MINOR] fix several printf formats and missing arguments
Willy Tarreau [Fri, 3 Apr 2009 12:49:12 +0000 (14:49 +0200)] 
[MINOR] fix several printf formats and missing arguments

Last patch revealed a number of mistakes in printf-like calls, mostly int/long
mismatches, and a few missing arguments.

16 years ago[BUILD] add format(printf) to printf-like functions
Willy Tarreau [Fri, 3 Apr 2009 10:01:47 +0000 (12:01 +0200)] 
[BUILD] add format(printf) to printf-like functions

Doing this helps catching warnings about wrong output formats.

16 years ago[MEDIUM] http: capture invalid requests/responses even if accepted
Willy Tarreau [Thu, 2 Apr 2009 13:18:36 +0000 (15:18 +0200)] 
[MEDIUM] http: capture invalid requests/responses even if accepted

It's useful to be able to accept an invalid header name in a request
or response but still be able to monitor further such errors. Now,
when an invalid request/response is received and accepted due to
an "accept-invalid-http-{request|response}" option, the invalid
request will be captured for later analysis with "show errors" on
the stats socket.

16 years ago[MEDIUM] http: add options to ignore invalid header names
Willy Tarreau [Thu, 2 Apr 2009 09:35:18 +0000 (11:35 +0200)] 
[MEDIUM] http: add options to ignore invalid header names

Sometimes it is required to let invalid requests pass because
applications sometimes take time to be fixed and other servers
do not care. Thus we provide two new options :

     option accept-invalid-http-request  (for the frontend)
     option accept-invalid-http-response (for the backend)

When those options are set, invalid requests or responses do
not cause a 403/502 error to be generated.

16 years ago[MINOR] improve reporting of misplaced acl/reqxxx rules
Willy Tarreau [Tue, 31 Mar 2009 08:49:21 +0000 (10:49 +0200)] 
[MINOR] improve reporting of misplaced acl/reqxxx rules

Now we can detect improper ordering of "block", "reqxxx", "reqadd",
"redirect" and "use_backend", and warn the user accordingly.

16 years ago[RELEASE] Released version 1.3.17 v1.3.17
Willy Tarreau [Sun, 29 Mar 2009 13:26:57 +0000 (15:26 +0200)] 
[RELEASE] Released version 1.3.17

Released version 1.3.17 with the following main changes :
    - Update specfile to build for v2.6 kernel.
    - [BUG] reset the stream_interface connect timeout upon connect or error
    - [BUG] reject unix accepts when connection limit is reached
    - [MINOR] show sess: report number of calls to each task
    - [BUG] don't call epoll_ctl() on closed sockets
    - [BUG] stream_sock: disable I/O on fds reporting an error
    - [MINOR] sepoll: don't count two events on the same FD.
    - [MINOR] show sess: report a lot more information about sessions
    - [BUG] stream_sock: check for shut{r,w} before refreshing some timeouts
    - [BUG] don't set an expiration date directly from now_ms
    - [MINOR] implement ulltoh() to write HTML-formatted numbers
    - [MINOR] stats/html: group digits by 3 to clarify numbers
    - [BUILD] remove haproxy-small.spec
    - [BUILD] makefile: remove unused references to linux24eold and EPOLL_CTL_WORKAROUND