Uploaded image for project: 'Log4cxx'
  1. Log4cxx
  2. LOGCXX-140

Handle leak with LoggingEvent::getCurrentThreadName

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 0.10.0
    • Fix Version/s: 0.10.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      Win32

      Description

      apr_os_thread_current leaks a handle for each spawned thread (see also documentation for revision 64133 of apr's win32/thread.c).

      I suppose that the actual intend was to print the thread id in stead of the thread handle. It would be much more convenient to have the tid (thread id) because tools such as "pslist" print also this tid. The thread handle is not very meaningful at this point.

      Since the Win32-API function GetCurrentThreadId() is not provided by the apr library, I suggest following (ugly) patch:

      const LogString LoggingEvent::getCurrentThreadName() {
      #if APR_HAS_THREADS
      //return StringHelper::formatHex((const void*) apr_os_thread_current());
      return StringHelper::formatHex((const void*) GetCurrentThreadId()); // CS 16-05-2006 due to handle leak
      #else
      return LOG4CXX_STR("0x00000000");
      #endif
      }

        Attachments

          Activity

            People

            • Assignee:
              carnold@apache.org Curt Arnold
              Reporter:
              chris75vie Kriz
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: