Exception atexit with selftest and Python 2.7

Bug #607413 reported by Martin Packman
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Bazaar
Fix Released
Low
Martin Packman
Python
Fix Released
Unknown

Bug Description

Following a selftest run with Python 2.7 there's some new junk printed at the end that's not present with earlier Python versions. Perhaps related to a change in the logging module?

Error in atexit._run_exitfuncs:
Traceback (most recent call last):
  File ".\lib\atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File ".\lib\logging\__init__.py", line 1615, in shutdown
    h.flush()
  File ".\lib\logging\__init__.py", line 824, in flush
    self.stream.flush()
ValueError: I/O operation on closed file
Traceback (most recent call last):
  File "bzr", line 153, in <module>
    sys.exitfunc()
  File ".\lib\atexit.py", line 24, in _run_exitfuncs
    func(*targs, **kargs)
  File ".\lib\logging\__init__.py", line 1615, in shutdown
    h.flush()
  File ".\lib\logging\__init__.py", line 824, in flush
    self.stream.flush()
ValueError: I/O operation on closed file
Exception TypeError: "'NoneType' object is not callable" in <function _removeHandlerRef at 0x00CC3E70> ignored

Tags: python27

Related branches

Martin Packman (gz)
Changed in bzr:
importance: Undecided → Low
status: New → Confirmed
Revision history for this message
Martin Packman (gz) wrote :

So, this is an upstream regression, but it's only exposed because of my favourite bazaar testing regression from the introduction of the testtools dependency. In short, TestCase attributes are no longer cleared after being run, so the _log_memento which holds, amongst other things, a reference to the logging StreamHandler sticks around until python exits.

So, cleaning up some testing cruft is an easy fix. However, I wonder whether Bazaar shouldn't follow the FIXME at the top of the bzrlib.trace and remove the use of the logging module entirely.

Changed in python:
status: Unknown → New
Revision history for this message
Martin Packman (gz) wrote :

Filed bug 613247 on the TestCase cleanup thing, fixing that will resolve this as well, as does adding `del self._log_memento` in TestCase._finishLogFile before reading the log back.

Changed in python:
status: New → Fix Released
Martin Packman (gz)
tags: added: python27
removed: python2.7
Martin Packman (gz)
Changed in bzr:
assignee: nobody → Martin Packman (gz)
status: Confirmed → In Progress
Martin Packman (gz)
Changed in bzr:
milestone: none → 2.5b3
status: In Progress → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.