Bug 952929
Summary: | Bad file descriptor from ConcurrentRotatingFileHandler.stream_lock in beakerd | ||
---|---|---|---|
Product: | [Retired] Beaker | Reporter: | Dan Callaghan <dcallagh> |
Component: | scheduler | Assignee: | Dan Callaghan <dcallagh> |
Status: | CLOSED CURRENTRELEASE | QA Contact: | tools-bugs <tools-bugs> |
Severity: | unspecified | Docs Contact: | |
Priority: | high | ||
Version: | 0.12 | CC: | asaha, dcallagh, llim, qwan, rglasz, rmancy, xjia |
Target Milestone: | 0.13 | ||
Target Release: | --- | ||
Hardware: | Unspecified | ||
OS: | Unspecified | ||
Whiteboard: | Misc | ||
Fixed In Version: | Doc Type: | Bug Fix | |
Doc Text: | Story Points: | --- | |
Clone Of: | Environment: | ||
Last Closed: | 2013-06-25 06:25:45 UTC | Type: | Bug |
Regression: | --- | Mount Type: | --- |
Documentation: | --- | CRM: | |
Verified Versions: | Category: | --- | |
oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
Cloudforms Team: | --- | Target Upstream Version: | |
Embargoed: |
Description
Dan Callaghan
2013-04-17 02:00:15 UTC
The bug is *probably* that ConcurrentRotatingFileHandler doesn't close its stream_lock in the close method, but adding some code to do that causes other problems elsewhere due to the (IMHO bizarre) sequence of acquire/release that the logging modules calls on its handlers. Given all the ridiculous complexity, inefficiency, and bugginess that ConcurrentRotatingFileHandler and logging in general has caused us, I would be strongly in favour of eliminating it all and sending everything unconditionally to syslog. We can ship a config in /etc/rsyslog.d to mimic the existing file locations, and a config in /etc/logrotate.d to handle rotation. I think I've mentioned this idea previously in other bugs, but I think now is the time to actually do it. To get beakerd going in my environment I used the following patches. I consider this just a workaround though, the real fix should be to stop using ConcurrentLogHandler. diff --git a/Server/bkr/server/tools/beakerd.py b/Server/bkr/server/tools/beakerd.py index 701b753..31bf535 100644 --- a/Server/bkr/server/tools/beakerd.py +++ b/Server/bkr/server/tools/beakerd.py @@ -811,14 +811,12 @@ def sigterm_handler(signal, frame): raise SystemExit("received SIGTERM") def purge_handlers(): - #shutdown logging subsystem - logging.shutdown() - # Remove handlers for (_, logger) in logging.root.manager.loggerDict.items(): if hasattr(logger, 'handlers'): for handler in logger.handlers: logger.removeHandler(handler) + handler.close() #clear out logging's internal handler list logging._handlerList = [] diff -ur ConcurrentLogHandler-0.8.4.orig/src/cloghandler.py ConcurrentLogHandler-0.8.4/src/cloghandler.py --- ConcurrentLogHandler-0.8.4.orig/src/cloghandler.py 2009-11-03 04:40:37.000000000 +1000 +++ ConcurrentLogHandler-0.8.4/src/cloghandler.py 2013-04-17 12:56:37.230730149 +1000 @@ -208,6 +208,7 @@ if not self.stream.closed: self.stream.flush() self.stream.close() + self.stream_lock.close() Handler.close(self) def flush(self): +1 for moving to syslog based logging and ditching ConcurrentLogHandler (it's not like we intend to ever support running the server components on anything other than Linux) If it is a cyclic trash problem, does calling gc.collect() 3 times (to trigger at least 3 generations of collection) after purging the handlers (but prior to daemonisation) make the misbehaviour go away? Acked with the caveat to look into Ray's observation that this may just be a bug due to modifying the "logger.handlers" list while iterating over it. The migration to syslog should be proposed as a separate RFE. Ray's patch at http://gerrit.beaker-project.org/1647 doesn't fix this issue. So we can do the quick and dodgy fix from comment 2 (which includes patching ConcurrentLogHandler again, blech) or we can just switch to syslog. RFE for switching to syslog is bug 963542. We should go ahead with the fix in comment 2 as well. The Beaker side is on Gerrit: http://gerrit.beaker-project.org/1945 Patch for ConcurrentLogHandler is in dist-git: http://pkgs.fedoraproject.org/cgit/python-concurrentloghandler.git/commit/?id=17ea3d7735846045079f3fbc004128f3e2221e06 Fedora builds of ConcurrentLogHandler are here: http://koji.fedoraproject.org/koji/buildinfo?buildID=419464 http://koji.fedoraproject.org/koji/buildinfo?buildID=419461 http://koji.fedoraproject.org/koji/buildinfo?buildID=419462 http://koji.fedoraproject.org/koji/buildinfo?buildID=419463 Beaker 0.13.1 has been released. |