Discussion:
[Bug 39737] LogFormat "%{tid}P" reports wrong thread id on Windows
b***@apache.org
2018-07-24 13:07:20 UTC
Permalink
https://bz.apache.org/bugzilla/show_bug.cgi?id=39737

--- Comment #4 from jfclere <***@gmail.com> ---
apr-1.6.x still use GetCurrentThread() so we have an handle not a thread id.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-***@httpd.apache.org
For additional commands, e-mail: bugs-***@httpd.apache.org
b***@apache.org
2018-08-30 06:13:23 UTC
Permalink
https://bz.apache.org/bugzilla/show_bug.cgi?id=39737

--- Comment #5 from William A. Rowe Jr. <***@apache.org> ---
apr_os_thread_current returns a handle (OS representation of a manipulatable
thread.) Similarly apr_os_thread_get. That behavior is correct.

mod_log_custom is doing this;

apr_os_thread_t tid = apr_os_thread_current();

That isn't portable, but OS specific.

core.c is grabbing this for the pid, not using apr;

return apr_psprintf(p, "%s%s%" APR_PID_T_FMT, string,
delim, getpid());

It seems we simply should switch to gettid(), and presume it is portable?

Interesting there is no APR_TID_T_FMT.

Also odd that apr_pid_t doesn't exist, but APR_PID_T_FMT is defined.

Perhaps it is possible to presume sizeof(pid_t) == sizeof(tid_t)?
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-***@httpd.apache.org
For additional commands, e-mail: bugs-***@httpd.apache.org
b***@apache.org
2018-08-30 09:33:49 UTC
Permalink
https://bz.apache.org/bugzilla/show_bug.cgi?id=39737

--- Comment #6 from Yann Ylavic <***@gmail.com> ---
Don't we need something like this?

Index: srclib/apr/strings/apr_snprintf.c
===================================================================
--- srclib/apr/strings/apr_snprintf.c (revision 1800753)
+++ srclib/apr/strings/apr_snprintf.c (working copy)
@@ -487,13 +487,21 @@ static char *conv_apr_sockaddr(apr_sockaddr_t *sa,
static char *conv_os_thread_t(apr_os_thread_t *tid, char *buf_end, apr_size_t
*len)
{
union {
+#ifndef WIN32
apr_os_thread_t tid;
+#else
+ DWORD tid;
+#endif
apr_uint64_t u64;
apr_uint32_t u32;
} u;
int is_negative;

+#ifndef WIN32
u.tid = *tid;
+#else
+ u.tid = GetThreadId(*tid);
+#endif
switch(sizeof(u.tid)) {
case sizeof(apr_int32_t):
return conv_10(u.u32, TRUE, &is_negative, buf_end, len);
--

(similarly for conv_os_thread_t_hex)
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-***@httpd.apache.org
For additional commands, e-mail: bugs-***@httpd.apache.org
b***@apache.org
2018-11-07 21:10:01 UTC
Permalink
https://bz.apache.org/bugzilla/show_bug.cgi?id=39737

William A. Rowe Jr. <***@apache.org> changed:

What |Removed |Added
----------------------------------------------------------------------------
Resolution|--- |LATER
Status|NEW |RESOLVED
Keywords| |MassUpdate

--- Comment #7 from William A. Rowe Jr. <***@apache.org> ---
Please help us to refine our list of open and current defects; this is a mass
update of old and inactive Bugzilla reports which reflect user error, already
resolved defects, and still-existing defects in httpd.

As repeatedly announced, the Apache HTTP Server Project has discontinued all
development and patch review of the 2.2.x series of releases. The final release
2.2.34 was published in July 2017, and no further evaluation of bug reports or
security risks will be considered or published for 2.2.x releases. All reports
older than 2.4.x have been updated to status RESOLVED/LATER; no further action
is expected unless the report still applies to a current version of httpd.

If your report represented a question or confusion about how to use an httpd
feature, an unexpected server behavior, problems building or installing httpd,
or working with an external component (a third party module, browser etc.) we
ask you to start by bringing your question to the User Support and Discussion
mailing list, see [https://httpd.apache.org/lists.html#http-users] for details.
Include a link to this Bugzilla report for completeness with your question.

If your report was clearly a defect in httpd or a feature request, we ask that
you retest using a modern httpd release (2.4.33 or later) released in the past
year. If it can be reproduced, please reopen this bug and change the Version
field above to the httpd version you have reconfirmed with.

Your help in identifying defects or enhancements still applicable to the
current httpd server software release is greatly appreciated.
--
You are receiving this mail because:
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-***@httpd.apache.org
For additional commands, e-mail: bugs-***@httpd.apache.org
Loading...