BUG/MEDIUM: unique_id: HTTP request counter is not stable
authorWilly Tarreau <w@1wt.eu>
Sat, 25 Jan 2014 10:01:50 +0000 (11:01 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 25 Jan 2014 10:07:06 +0000 (11:07 +0100)
commit1f0da2485ea53b86a254be061ded69f5371d4a05
treed15834617136d34b768ec1d2ebc0604adb3cb6e9
parente7054c71773854c40021c3ae042c2e4d8f07b926
BUG/MEDIUM: unique_id: HTTP request counter is not stable

Patrick Hemmer reported that using unique_id_format and logs did not
report the same unique ID counter since commit 9f09521 ("BUG/MEDIUM:
unique_id: HTTP request counter must be unique!"). This is because
the increment was done while producing the log message, so it was
performed twice.

A better solution consists in fetching a new value once per request
and saving it in the request or session context for all of this
request's life.

It happens that sessions already have a unique ID field which is used
for debugging and reporting errors, and which differs from the one
sent in logs and unique_id header.

So let's change this to reuse this field to have coherent IDs everywhere.
As of now, a session gets a new unique ID once it is instanciated. This
means that TCP sessions will also benefit from a unique ID that can be
logged. And this ID is renewed for each extra HTTP request received on
an existing session. Thus, all TCP sessions and HTTP requests will have
distinct IDs that will be stable along all their life, and coherent
between all places where they're used (logs, unique_id header,
"show sess", "show errors").

This feature is 1.5-specific, no backport to 1.4 is needed.
doc/configuration.txt
include/types/global.h
src/log.c
src/proto_http.c
src/session.c