You are viewing a plain text version of this content. The canonical link for it is here.
Posted to bugs@httpd.apache.org by bu...@apache.org on 2021/05/14 16:25:07 UTC

[Bug 65307] New: Rewrite and improvements of mod_unique_id

https://bz.apache.org/bugzilla/show_bug.cgi?id=65307

            Bug ID: 65307
           Summary: Rewrite and improvements of mod_unique_id
           Product: Apache httpd-2
           Version: 2.5-HEAD
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: mod_unique_id
          Assignee: bugs@httpd.apache.org
          Reporter: atle@goliathdns.no
  Target Milestone: ---

Created attachment 37862
  --> https://bz.apache.org/bugzilla/attachment.cgi?id=37862&action=edit
Diff for mod_unique_id.c

Hi

I've been working on some cleanups in mod_unique_id module and have also
changed the composition of values used to ensure unique IDs.

There has recently there has been a bug report #65159 which was resolved by
replacing a global counter with a per-thread counter. This is however not
enough to ensure uniqueness in all situations.

The cleanup is mostly done because the current module has been patched multiple
times over the years and it was kind of messy and difficult to work with.

I'm proposing new data to include in the unique ID string:

- 32 bit process ID
- 64 bit thread ID
- 64 bit timestamp in microseconds
- 16 bit server ID
- 16 bit counter

The server ID is by default 0 but can be set to a fixed value in the
configuration. This way an ID can be assigned to different servers for instance
when doing load balancing with a common backend.

The 16 bit counter is per-thread (as in the previous patch) and ensures
uniqueness should the timestamp be the same in two requests.

There are no random numbers.

All values are swapped to network byte order.

The total length of the unique string has been increased from 27 to 32
characters.

It is nevertheless easy with this patch to change the actual composition of
values in the unique ID and I reckon there might be different opinions on this.

The attached diff changes the whole file, it might be easier to read the file
whole itself:

https://github.com/apache/httpd/blob/a477b27e2fc74b1a41f8e600c599d89454a5cd38/modules/metadata/mod_unique_id.c

Best regards
Atle

-- 
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@httpd.apache.org
For additional commands, e-mail: bugs-help@httpd.apache.org