Commit Graph

16818 Commits

Author SHA1 Message Date
Christopher Faulet
c983b2114d CLEANUP: backend: Don't export connect_server anymore
connect_server() function is only called from backend.c. So make it static.
2022-02-24 11:00:03 +01:00
Christopher Faulet
e3a3af1ec8 CLEANUP: conn-stream: Remove cs_destroy()
This function is no longer used.
2022-02-24 11:00:03 +01:00
Christopher Faulet
54e85cbfc7 MAJOR: check: Use a persistent conn-stream for health-checks
In the same way a stream has always valid conn-streams, when a health-checks
is created, a conn-stream is now created and the health-check is attached on
it, as an app. This simplify a bit the connect part when a health-check is
running.
2022-02-24 11:00:03 +01:00
Christopher Faulet
14fd99a20c MINOR: stream: Don't destroy conn-streams but detach app and endp
Don't call cs_destroy() anymore when a stream is released. Instead the
endpoint and the app are detached from the conn-stream.
2022-02-24 11:00:03 +01:00
Christopher Faulet
c36de9dc93 MINOR: conn-stream: Release a CS when both app and endp are detached
cs_detach_app() function is added to detach an app from a conn-stream. And
now, both cs_detach_app() and cs_detach_endp() release the conn-stream when
both the app and the endpoint are detached.
2022-02-24 11:00:03 +01:00
Christopher Faulet
014ac35eb2 CLEANUP: stream-int: rename si_reset() to si_init()
si_reset() function is only used when a stream-interface is allocated. Thus
rename it to si_init() insteaad.
2022-02-24 11:00:03 +01:00
Christopher Faulet
cda94accb1 MAJOR: stream/conn_stream: Move the stream-interface into the conn-stream
Thanks to all previous changes, it is now possible to move the
stream-interface into the conn-stream. To do so, some SI functions are
removed and their conn-stream counterparts are added. In addition, the
conn-stream is now responsible to create and release the
stream-interface. While the stream-interfaces were inlined in the stream
structure, there is now a pointer in the conn-stream. stream-interfaces are
now dynamically allocated. Thus a dedicated pool is added. It is a temporary
change because, at the end, the stream-interface structure will most
probably disappear.
2022-02-24 11:00:03 +01:00
Christopher Faulet
9a86f6399f CLEANUP: conn-stream: Don't export conn-stream pool
There is no reason to export the conn-stream pool.
2022-02-24 11:00:03 +01:00
Christopher Faulet
a73c9f0faa MINOR: conn-stream: Rename cs_detach() to cs_detach_endp()
Because cs_detach() is releated to the endpoint only, the function is
renamed. The main purpose of this patch is to be able to add a function to
detach the conn-stream from the application.
2022-02-24 11:00:02 +01:00
Christopher Faulet
108ce5a70b MINOR: sink: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the sink part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
0de82720e7 MINOR: tcp-act: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the tcp-act part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
b91afea91c MINOR: httpclient: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the httpclient part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
e1ede302c3 MINOR: http-act: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the http-act part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
8f8f35b2b0 MINOR: dns: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the dns part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
7a58d79dd2 MINOR: cache: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the cache part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
436811f4a8 MINOR: hlua: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the hlua part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
5d3c8aa154 MINOR: debug: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the debug part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
56489e2e31 MINOR: peers: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the peers part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
4d056bcb70 MINOR: proxy: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the proxy part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
503d26428d MINOR: frontend: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the frontend part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
02fc86e8f6 MINOR: log: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the log part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
0c247df38b MINOR: cli: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the cli part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
a629447d02 MINOR: http-ana: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream, all
access to the SI is done via the conn-stream. This patch is limited to the
http-ana part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
5c8b47f665 MINOR: stream: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the stream part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
4a0114b298 MINOR: backend: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the backend part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
165ca0e812 MINOR: stream-int: Always access the stream-int via the conn-stream
To be able to move the stream-interface from the stream to the conn-stream,
all access to the SI is done via the conn-stream. This patch is limited to
the stream-interface part.
2022-02-24 11:00:02 +01:00
Christopher Faulet
0dd566b42e MINOR: stream: Slightly rework stream_new to separate CS/SI initialization
It is just a minor reforctoring of stream_new() function to ease next
changes. Especially to move the SI from the stream to the conn-stream.
2022-02-24 11:00:02 +01:00
Christopher Faulet
95a61e8a0e MINOR: stream: Add pointer to front/back conn-streams into stream struct
frontend and backend conn-streams are now directly accesible from the
stream. This way, and with some other changes, it will be possible to remove
the stream-interfaces from the stream structure.
2022-02-24 11:00:02 +01:00
Christopher Faulet
f835dea939 MEDIUM: conn_stream: Add a pointer to the app object into the conn-stream
In the same way the conn-stream has a pointer to the stream endpoint , this
patch adds a pointer to the application entity in the conn-stream
structure. For now, it is a stream or a health-check. It is mandatory to
merge the stream-interface with the conn-stream.
2022-02-24 11:00:02 +01:00
Christopher Faulet
86e1c3381b MEDIUM: applet: Set the conn-stream as appctx owner instead of the stream-int
Because appctx is now an endpoint of the conn-stream, there is no reason to
still have the stream-interface as appctx owner. Thus, the conn-stream is
now the appctx owner.
2022-02-24 11:00:02 +01:00
Christopher Faulet
13a35e5752 MAJOR: conn_stream/stream-int: move the appctx to the conn-stream
Thanks to previous changes, it is now possible to set an appctx as endpoint
for a conn-stream. This means the appctx is no longer linked to the
stream-interface but to the conn-stream. Thus, a pointer to the conn-stream
is explicitly stored in the stream-interface. The endpoint (connection or
appctx) can be retrieved via the conn-stream.
2022-02-24 11:00:02 +01:00
Christopher Faulet
dd2d0d8b80 MEDIUM: conn-stream: Be prepared to use an appctx as conn-stream endpoint
To be able to use an appctx as conn-stream endpoint, the connection is no
longer stored as is in the conn-stream. The obj-type is used instead.
2022-02-24 11:00:02 +01:00
Christopher Faulet
897d612d68 MEDIUM: conn-stream: No longer access connection field directly
To be able to handle applets as a conn-stream endpoint, we must be prepared
to handle different types of endpoints. First of all, the conn-strream's
connection must no longer be used directly.
2022-02-24 11:00:02 +01:00
Christopher Faulet
1329f2a12a REORG: conn_stream: move conn-stream stuff in dedicated files
Move code dealing with the conn-streams in dedicated files.
2022-02-24 11:00:02 +01:00
Christopher Faulet
e2b38b31bb MEDIUM: stream: Allocate backend CS when the stream is created
Because the backend conn-stream is no longer released during connection
retry and because it is valid to have conn-stream with no connection, it is
possible to allocated it when the stream is created. This means, from now, a
stream has always valid frontend and backend conn-streams. It is the first
step to merge the SI and the CS.
2022-02-24 11:00:02 +01:00
Christopher Faulet
e00ad358c9 MEDIUM: stream: No longer release backend conn-stream on connection retry
The backend conn-stream is no longer released on connection retry. This
means the conn-stream is detached from the underlying connection but not
released. Thus, during connection retries, the stream has always an
allocated conn-stream with no connection. All previous changes were made to
make this possible.

Note that .attach() mux callback function was changed to get the conn-stream
as argument. The muxes are no longer responsible to create the conn-stream
when a server connection is attached to a stream.
2022-02-24 11:00:02 +01:00
Christopher Faulet
e39827de0d MINOR: stream-int: Be able to allocate a CS without connection
si_alloc_cs() function may now be called without connection. It is mandatory
to allocate the backend conn-stream during the stream creation.
2022-02-24 11:00:02 +01:00
Christopher Faulet
1a3b598b47 MINOR: stream-int: Add function to attach a connection to a SI
si_attach_conn() function should be used to attach a connection to a
stream-interface. It created a conn-stream if necessary. This function is
mandatory to be able to keep the backend conn-stream during connection
retries.
2022-02-24 11:00:02 +01:00
Christopher Faulet
20a6501051 MINOR: stream-int: Add function to reset a SI endpoint
si_reset_endpoint() function may be used to reset the SI's endpoint without
releasing the conn-stream if the endpoint is a connection. If the endpoint
is an appctx, it is released. This change is mandatory to merge the SI and
the CS and keep the backend conn-stream attached to the stream during
connection retries.
2022-02-24 11:00:02 +01:00
Christopher Faulet
2b4e8b7b2d MINOR: connection: Add a function to detach a conn-stream from the connection
cs_detach() function is added to detach a conn-stream from the underlying
connection. This part will evovle to handle applets too. Concretely,
cs_destroy() is split to detach the conn-stream from its endpoint, via
cs_detach(), and then, the conn-stream is released, via cs_free().
2022-02-24 11:00:01 +01:00
Christopher Faulet
a742293ec9 MINOR: stream: Handle appctx case first when creating a new stream
In the same way the previous commit, when a stream is created, the appctx
case is now handled before the conn-stream one. The purpose of this change
is to limit bugs during the SI/CS refactoring.
2022-02-24 11:00:01 +01:00
Christopher Faulet
0256da14a5 MINOR: connection: Be prepared to handle conn-stream with no connection
The conn-stream will progressively replace the stream-interface. Thus, a
stream will have to allocate the backend conn-stream during its
creation. This means it will be possible to have a conn-stream with no
connection. To prepare this change, we test the conn-stream's connection
when we retrieve it.
2022-02-24 11:00:01 +01:00
Christopher Faulet
719ceef79c MINOR: stream-int: Handle appctx case first when releasing the endpoint
Stream-interfaces will be moved in the conn-stream and the appctx will be
moved at the same level than the muxes. Idea is to merge the
stream-interface and the conn-stream and have a better symmetry between the
muxes and the applets. To limit bugs during this refactoring, when the SI
endpoint is released, the appctx case is handled first.
2022-02-24 11:00:01 +01:00
Willy Tarreau
274716262b DOC: design: commit the temporary design notes on thread groups
these one are starting to grow and short-term progress doesn't seem to
be happening, let's not lose the notes.
2022-02-24 09:06:37 +01:00
Willy Tarreau
f4016df91a DOC: design: add design thoughts for later simplification of the pools
The pools currently have plenty of options (and some usefull ones were
even lost with the modern design), but most of them could be categorized
along a few use cases, namely, performance, reliability, debuggability.
This document explores various ways to try to combine them and their
effect in a less complex way for the long term.
2022-02-24 09:01:59 +01:00
Willy Tarreau
0722d5d58e DOC: internal: update the pools API to mention boot-time settings
These ones are useful for debugging and must be mentionned in the
API doc.
2022-02-24 08:58:04 +01:00
Christian Ruppert
59e66e30c2 DOC: Fix usage/examples of deprecated ACLs
Some examples or references were still using deprecated ACL variants.

Signed-off-by: Christian Ruppert <idl0r@qasl.de>
2022-02-23 18:36:45 +01:00
Willy Tarreau
a0a6911bde CI: github: enable pool debugging by default
This enables DEBUG_MEMORY_POOLS and DEBUG_POOL_INTEGRITY so that by
default the tests run under stricter checks, which are likely to
catch more bugs. Note that these ones are permanently used in prod
on haproxy.org.
2022-02-23 18:14:49 +01:00
Willy Tarreau
8de7f2822b BUILD: makefile: enable both DEBUG_STRICT and DEBUG_MEMORY_POOLS by default
The first one will enable all currently deployed BUG_ON() checks. These
ones are safe from a performance perspective and from a reliability
perspective. New ones may be added later with different categories
(hot path, detection of uncertain events, etc).

DEBUG_MEMORY_POOLS enables the "tag" pool debugging option by default,
so that pools may be better traced in dumps. This one alone results in
almost imperceptible performance difference, and 8 extra bytes per
allocated object.

Both options are safe for production use (they're among those enabled
all the time on haproxy.org) and allow to produce much more trustable
bug reports which should save a few round trips with the reporters.
2022-02-23 18:14:49 +01:00
Willy Tarreau
f4b79c4a01 MINOR: pools: support setting debugging options using -dM
The 9 currently available debugging options may now be checked, set, or
cleared using -dM. The directive now takes a comma-delimited list of
options after the optional poisonning byte. With "help", the list of
available options is displayed with a short help and their current
status.

The management doc was updated.
2022-02-23 17:28:41 +01:00