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

Handle leak with LoggingEvent::getCurrentThreadName

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 0.10.0
    • 0.10.0
    • None
    • None
    • 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

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

            Dates

              Created:
              Updated:
              Resolved: