Opened 7 years ago

Closed 7 years ago

Last modified 7 years ago

#2422 closed defect (wontfix)

log4cplus threading issues: not logging at all from a new thread

Reported by: jelte Owned by: UnAssigned
Priority: medium Milestone: Sprint-20121106
Component: logging Version:
Keywords: Cc:
CVSS Scoring: Parent Tickets:
Sensitive: no Defect Severity: N/A
Sub-Project: DNS Feature Depending on Ticket:
Estimated Difficulty: 0 Add Hours to Ticket: 4
Total Hours: 0 Internal?: no

Description

We have run into a few logging+threads issues over the past few days, one of them is that LOG_XXX calls do not do anything at all on some systems (e.g. http://git.bind10.isc.org/~tester/builder/BIND10-lettuce/20121101112722-MacOS/logs/lettuce.out the test fails because the load-success line is never logged. The code does it succesfully, and calls the LOG_DEBUG macro, but nothing happens).

This is with log4cplus 1.0.4 without any special configure options, as far as I know. The problem may very well be that logger objects are not thread-safe, and/or a different bug in log4cplus; or maybe we shouldn't share logger instances over threads in the first place.

The latter does appear to help; creating a separate isc::log::Logger instance specific for the thread makes it work as expected.

Attaching a patch that does that.

Subtickets

Attachments (1)

logger_fix.patch (1.6 KB) - added by jelte 7 years ago.
Create separate Logger instance for clients builder thread

Download all attachments as: .zip

Change History (5)

Changed 7 years ago by jelte

Create separate Logger instance for clients builder thread

comment:1 Changed 7 years ago by jelte

Note: I have merged #2198 in a test branch, but it did not change anything regarding the erroneous behaviour described in this ticket

comment:2 Changed 7 years ago by jelte

  • Owner set to UnAssigned
  • Status changed from new to reviewing

note2: pushed branch trac2422 with this patch applied

comment:3 Changed 7 years ago by jelte

  • Resolution set to wontfix
  • Status changed from reviewing to closed

making this a wontfix, there seems to be something wrong with the version of clang used on this system, and we are looking into that first.

comment:4 Changed 7 years ago by jinmei

For the record: from a deeper look, this is probably not a thread
related issue, but about C++ template handling of the compiler.

In fact, if I add a log message to
DataSrcClientsManager::loadZone() (which is run on the main
thread), it wasn't logged either. On the other hand, if I
extracted this

        LOG_DEBUG(auth_logger, DBG_AUTH_OPS,
                  AUTH_DATASRC_CLIENTS_BUILDER_LOAD_ZONE)
            .arg(origin).arg(rrclass);

from DataSrcClientsBuilderBase::doLoadZone() (which is templated)
into a non-templated function and had doLoadZone() call it, it was
logged.

Maybe the lesson here is that it's safer to try not to log things from
a templated function/method.

Last edited 7 years ago by jinmei (previous) (diff)
Note: See TracTickets for help on using tickets.