On 08/13/2013 11:53 AM, Willy Tarreau wrote: > Hi Patrick, > > On Sun, Aug 11, 2013 at 03:45:36PM -0400, Patrick Hemmer wrote: >> I'm using the %rt field in the "unique-id-format" config parameter (the >> full value is "%{+X}o%pid-%rt"), and am getting lots of duplicates. In >> one specific case, haproxy added the same http_request_counter value to >> 70 different http requests within a span of 61 seconds (from various >> client hosts too). Does the http_request_counter only increment under >> certain conditions, or is this a bug? > Wow, congrats, you found a nice ugly bug! Here's how the counter is > retrieved at the moment of logging : > > iret = snprintf(tmplog, dst + maxsize - tmplog, "%04X", > global.req_count); > > As you can see, it uses a global variable which holds the global number of > requests seen at the moment of logging (or assigning the header) instead of > a unique value assigned to each request! > > So all the requests that are logged in the same time frame between two > new requests get the same ID :-( > > The counter should be auto-incrementing so that each retrieval is unique. > > Please try with the attached patch. > > Thanks, > Willy > Sorry for the delay, really busy here. Finally got a build with this patch in it, and after some light testing (development environment) it does appear to have solved the duplicate counter issue.
-Patrick