Commit Graph

499 Commits

Author SHA1 Message Date
Willy Tarreau
8aeae4af23 [BUG] str2net() must not change the const char *
str2net needs to put \0 in a const char *. Use strdup() for that.
2007-06-17 11:42:08 +02:00
Willy Tarreau
c8d7c96b26 [MEDIUM] acl: support '-i' to ignore case when matching
Implemented the "-i" option on ACLs to state that the matching
will have to be performed for all patterns ignoring case. The
usage is :

   acl <aclname> <aclsubject> -i pattern1 ...

If a pattern must begin with "-", either it must not be the first one,
or the "--" option should be specified first.
2007-06-17 08:20:33 +02:00
Willy Tarreau
0fc45a7e83 [MINOR] improve memory freeing upon exit
The deinit() function is specialized in memory area freeing.
There were a ton of information that were not released at the
exit time, which made valgrind complain. Now, most of the entries
are freed. However, it seems like regfree() does not completely
free a regex (12 bytes lost per regex).
2007-06-17 00:36:03 +02:00
Willy Tarreau
dae4aa8c4a [BUG] fix segfault at exit when using captures
since pools v2, the way pools were destroyed at exit is incorrect
because it ought to account for users of those pools before freeing
them. This test also ensures there is no double free.
2007-06-16 23:19:53 +02:00
Willy Tarreau
74b98a8c22 [BUG] negation in ACL conds was not cleared between terms
The exclamation mark (!) in front of an ACL condition was propagated
to the whole line instead of being flushed after parsing an acl name.
2007-06-16 19:35:18 +02:00
Willy Tarreau
3f49b30284 [MEDIUM] errorfile: use a local file to feed error messages
It is now possible to read error messages from local files,
using the 'errorfile' keyword. Those files are read during
parsing, so there's no I/O involved. They make it possible
to return custom error messages with custom status and headers.
2007-06-11 00:29:26 +02:00
Willy Tarreau
1ad7c6dd85 [MINOR] acl: permit to return any header when no name specified
Having the ability to match on hdr_xxx in addition to hdr_xxx(yyy)
makes it possible to match any value or to count the headers easily.
2007-06-10 21:42:55 +02:00
Willy Tarreau
737b0c12a6 [MEDIUM] acl: support maching on 'path' component
'path', 'path_reg', 'path_beg', 'path_end', 'path_sub', 'path_dir'
and 'path_dom' have been implemented to process the path component
of the URI. It starts after the host part, and stops before the
question mark.
2007-06-10 21:28:46 +02:00
Willy Tarreau
33a7e6901f [MEDIUM] acl: implement matching on header values
hdr(x), hdr_reg(x), hdr_beg(x), hdr_end(x), hdr_sub(x), hdr_dir(x),
hdr_dom(x), hdr_cnt(x) and hdr_val(x) have been implemented. They
apply to any of the possibly multiple values of header <x>.

Right now, hdr_val() is limited to integer matching, but it should
reasonably be upgraded to match long long ints.
2007-06-10 19:45:56 +02:00
Willy Tarreau
97be145991 [MINOR] acl: provide a reference to the expr to fetch()
The fetch() functions may need to access the full expr to get
their args. Turn the void *arg into a struct acl_expr *expr.
2007-06-10 11:47:14 +02:00
Willy Tarreau
bb76891d0f [MINOR] acl: provide the argument length for fetch functions
Some fetch() functions will require an argument (eg: header).
It's wise to provide the argument size to optimize string
comparisons.
2007-06-10 11:17:01 +02:00
Willy Tarreau
d41f8d85e8 [MINOR] acl: specify the direction during fetches
Some fetches such as 'line' or 'hdr' need to know the direction of
the test (request or response). A new 'dir' parameter is now
propagated from the caller to achieve this.
2007-06-10 10:06:18 +02:00
Willy Tarreau
ae8b796722 [MEDIUM] smarter integer comparison support in ACLs
ACLs now support operators such as 'eq', 'le', 'lt', 'ge' and 'gt'
in order to give more flexibility to the language. Because of this
change, the 'dst_limit' keyword changed to 'dst_conn' and now requires
either a range or a test such as 'dst_conn lt 1000' which is more
understandable.
2007-06-09 23:10:04 +02:00
Willy Tarreau
a3503e0b5a [RELEASE] Released version 1.3.11.4 with the following main changes :
- do not re-arm read timeout in SHUTR state
    - optimize I/O by detecting system starvation
    - the epoll FD must not be shared between processes
    - limit the number of events returned by *poll*
2007-06-03 17:27:07 +02:00
Willy Tarreau
1db37710dc [MEDIUM] limit the number of events returned by *poll*
By default, epoll/kqueue used to return as many events as possible.
This could sometimes cause huge latencies (latencies of up to 400 ms
have been observed with many thousands of fds at once). Limiting the
number of events returned also reduces the latency by avoiding too
many blind processing. The value is set to 200 by default and can be
changed in the global section using the tune.maxpollevents parameter.
2007-06-03 17:16:49 +02:00
Willy Tarreau
fb8983f21b [BUG] the epoll FD must not be shared between processes
Recreate the epoll file descriptor after a fork(). It will ensure
that all processes will not share their epoll_fd. Some side effects
were encountered because of this, such as epoll_wait() returning an
FD which was previously deleted, in multi-process mode.
2007-06-03 16:40:44 +02:00
Willy Tarreau
ab3e1d313c [MEDIUM] optimize I/O by detecting system starvation
Compare the results of recv/send with the parameter passed and
detect whether the system has no free buffer space for send()
or has no data anymore for recv(). This dramatically reduces
the number of syscalls (by about 23%).
2007-06-03 16:05:39 +02:00
Willy Tarreau
fa64558402 [BUG] do not re-arm read timeout after writing data
A second occurrence of read-timeout rearming was present in stream_sock.c.
To fix the problem, it was necessary to put the shutdown information in
the buffer (already planned).
2007-06-03 16:03:49 +02:00
Willy Tarreau
33014d0d8d [BUG] do not re-arm read timeout in SHUTR state !
There is a long-time bug causing busy loops when either client-side
or server-side enters a SHUTR state. When writing data to the FD,
it was possible to re-arm the read side if the write had been paused.
2007-06-03 16:03:45 +02:00
Willy Tarreau
3c6fc07e18 [RELEASE] Released version 1.3.11.3 with the following main changes :
- pre-initialize timeouts with tv_eternity during parsing
2007-05-14 14:40:25 +02:00
Willy Tarreau
ee99136992 [BUG] pre-initialize timeouts with tv_eternity during parsing
ETERNITY is not 0 anymore, so all timeouts will not be initialized
to ETERNITY by a simple calloc(). We have to explictly assign them.

This bug caused random session aborts.
2007-05-14 14:37:50 +02:00
Willy Tarreau
fc273c230d [RELEASE] Released version 1.3.11.2 with the following main changes :
- fixed broken health-checks since switch to timeval
2007-05-14 03:42:47 +02:00
Willy Tarreau
8eee9c8457 [BUG] fix broken health-checks since switch to timeval
Health-checks were broken because of a return which was unexpectedly removed.
2007-05-14 03:40:11 +02:00
Willy Tarreau
3c5340c35b [RELEASE] Released version 1.3.11.1 with the following main changes :
- fixed ev_kqueue which was forgotten during the switch to timeval
    - allowed null timeouts for past events in select
2007-05-14 03:18:43 +02:00
Willy Tarreau
d9b744104e [MINOR] allow null timeouts for past events in select 2007-05-14 03:16:06 +02:00
Willy Tarreau
79b8a62ff6 [BUG] ev_kqueue was forgotten during the switch to timeval 2007-05-14 03:15:46 +02:00
Willy Tarreau
544eb40f29 [RELEASE] Released version 1.3.11 with the following main changes :
- fixed ev_sepoll again by rewriting the state machine
    - switched all timeouts to timevals instead of milliseconds
    - improved memory management using mempools v2.
    - several minor optimizations
2007-05-14 02:42:33 +02:00
Willy Tarreau
315bff5183 Merge branch 'pools' into merge-pools 2007-05-14 02:11:56 +02:00
Willy Tarreau
1209033e46 [MINOR] disable useless hint in wake_expired_tasks
wake_expired_tasks() used a hint to avoid scanning the tree in most cases,
but it looks like the hint is more expensive than reaching the first node
in the tree. Disable it for now.
2007-05-14 02:11:39 +02:00
Willy Tarreau
fbfc053e34 [BUG] fix buggy timeout computation in wake_expired_tasks
Wake_expired_tasks is supposed to return a date, not an interval. It
was causing busy loops in pollers.
2007-05-14 02:03:47 +02:00
Willy Tarreau
bdefc513a0 [BUG] fix null timeouts in *poll-based pollers
Introduction of timeval timers broke *poll-based pollers, because the call to
tv_ms_remain may return 0 while the event is not elapsed yet. Now we carefully
check for those cases and round the result up by 1 ms.
2007-05-14 02:02:04 +02:00
Willy Tarreau
4d2d098ea3 [MAJOR] call garbage collector when doing soft stop
When we're interrupted by another instance, it is very likely
that the other one will need some memory. Now we know how to
free what is not used, so let's do it.

Also only free non-null pointers. Previously, pool_destroy()
did implicitly check for this case which was incidentely
needed.
2007-05-14 00:39:29 +02:00
Willy Tarreau
7dcd46d471 [MEDIUM] enhance behaviour of mempools v2
- keep the number of users of each pool
- call the garbage collector on out of memory conditions
- sort the pools by size for faster creation
- force the alignment size to 16 bytes instead of 4*sizeof(void *)
2007-05-14 00:16:13 +02:00
Willy Tarreau
1d4154a7c0 [MAJOR] convert the header indexes to use mempool v2 2007-05-13 22:57:02 +02:00
Willy Tarreau
cf7f320f9d [MAJOR] last bunch of capture changes for mempool v2
The header captures had lots of pools. They have all been transformed.
2007-05-13 22:46:04 +02:00
Willy Tarreau
086b3b4c9f [MAJOR] ported the captures to use the new mempool v2
The "capture.c" file has also been removed since it was empty.
2007-05-13 21:45:51 +02:00
Willy Tarreau
332f8bfc5b [MAJOR] ported requri to use mempools v2 2007-05-13 21:36:56 +02:00
Willy Tarreau
63963c62e7 [MAJOR] ported appsession to use mempools v2
Also during this process, a bug was found in appsession_refresh().
It would not automatically requeue the task in the queue, so the
old sessions would not vanish.
2007-05-13 21:29:55 +02:00
Willy Tarreau
e4d7e55061 [MAJOR] ported pendconn to mempools v2
A pool_destroy() was also missing in deinit()
2007-05-13 20:19:55 +02:00
Willy Tarreau
7341d94c5d [MAJOR] switched buffers to mempools v2 2007-05-13 19:56:02 +02:00
Willy Tarreau
c6ca1a02aa [MAJOR] migrated task, tree64 and session to pool2
task and tree64 are already very close in size and are merged together.
Overall performance gained slightly by this simple change.
2007-05-13 19:43:47 +02:00
Willy Tarreau
e6ce59deb7 [MEDIUM] add new memory management functions
Implement pool_destroy2, pool_flush2, pool_gc2. It is safe to call
pool_gc2 to free whatever memory possible.
2007-05-13 19:38:49 +02:00
Willy Tarreau
50e608d721 [MEDIUM] implement memory pools version 2
The new pools know about their size and usage. Malloc is not used
anymore, instead a dedicated function to refill the entries is used.
2007-05-13 18:26:08 +02:00
Willy Tarreau
aff694f3b6 Merge branch 'timers' into merge-timers 2007-05-13 16:10:04 +02:00
Willy Tarreau
a8b55e33da [MINOR] use non-inline tv_* functions in many locations
The __tv_* functions were abused. They are not that small and it is not
always worth using them.
2007-05-13 16:08:19 +02:00
Willy Tarreau
c64e5397f6 [MINOR] avoid inlining in task.c
The task management functions used to call __tv_* which is not really
optimal given the size of the functions.
2007-05-13 16:07:06 +02:00
Willy Tarreau
0481c20e66 [MINOR] add new tv_* functions
The most useful, tv_add_ifset only adds the increment if it is set. It
is designed for use in expiration computation.
2007-05-13 16:03:27 +02:00
Willy Tarreau
01ba1c909d Merge branch 'master' into timers 2007-05-13 14:52:43 +02:00
Willy Tarreau
ae5f7dadef [TESTS] updates to hash experimentations
Aleksandar Lazic has collected many hashing algorithms and put them
in one file to ease benchmarking. Some algos look promising, some
of them have been checked further with uri_hash. Some results on
various systems/hardware are stored in hash_results.txt.
2007-05-13 11:40:04 +02:00
Willy Tarreau
6653d17b8d [BUG] fix ev_sepoll again, this time with a new state machine
It was possible in ev_sepoll() to ignore certain events if
all speculative events had been processed at once, because
the epoll_wait() timeout was not cleared, thus delaying the
events delivery.

The state machine was complicated, it has been rewritten.
It seems faster and more correct right now.
2007-05-13 01:52:05 +02:00