Bug 856850

Summary: Beakerd fails to start successfully on Fedora 17 with Python 2.7
Product: [Retired] Beaker Reporter: Amit Saha <asaha>
Component: schedulerAssignee: Amit Saha <asaha>
Status: CLOSED CURRENTRELEASE QA Contact:
Severity: high Docs Contact:
Priority: unspecified    
Version: 0.9CC: asaha, bpeck, dcallagh, ebaak, kbaker, mishin, rmancy
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2012-10-11 23:50:09 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:
Bug Depends On: 858912    
Bug Blocks:    
Attachments:
Description Flags
Proposed patch for discussion none

Description Amit Saha 2012-09-13 00:22:20 UTC
Description of problem:

Beakerd fails to start succesfully on Fedora 17 (Python 2.7). 

Version-Release number of selected component (if applicable):

Pulled form Git repository.

How reproducible:

Easy.

Steps to Reproduce:
1. Follow the install guide from http://beaker-project.org/guide/Installation-Install_Beaker-Start_Beaker.html
2. Once the beaker server has been installed, run the beaker server in the foreground as 'apache' user. You should see the stacktrace. See below.

  
Actual results:

    [root@fedora17 ~]# su -s /bin/sh apache -c "beakerd -f"
    Traceback (most recent call last):
      File "/usr/bin/beakerd", line 9, in <module>
        load_entry_point('bkr.server==0.9.3', 'console_scripts', 'beakerd')()
      File "/usr/lib/python2.7/site-packages/bkr/server/tools/beakerd.py", line 650, in main
        schedule()
      File "/usr/lib/python2.7/site-packages/bkr/server/tools/beakerd.py", line 524, in schedule
        reload_config()
      File "/usr/lib/python2.7/site-packages/bkr/server/tools/beakerd.py", line 599, in reload_config
        handler.flush()
    AttributeError: 'weakref' object has no attribute 'flush'
    Error in atexit._run_exitfuncs:
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/atexit.py", line 24, in _run_exitfuncs
        func(*targs, **kargs)
      File "/usr/lib64/python2.7/logging/__init__.py", line 1648, in shutdown
        h.release()
      File "/usr/lib/python2.7/site-packages/cloghandler.py", line 194, in release
        self.stream.flush()
    ValueError: I/O operation on closed file
    Error in sys.exitfunc:
    Traceback (most recent call last):
      File "/usr/lib64/python2.7/atexit.py", line 24, in _run_exitfuncs
        func(*targs, **kargs)
      File "/usr/lib64/python2.7/logging/__init__.py", line 1648, in shutdown
        h.release()
      File "/usr/lib/python2.7/site-packages/cloghandler.py", line 194, in release
        self.stream.flush()
    ValueError: I/O operation on closed file



Expected results:

 Successful beakerd instance running.

Additional info:

 The RPMs I used for installing was custom built for Fedora and is not available publicly at this moment.

Comment 1 Amit Saha 2012-09-17 01:27:00 UTC
Created attachment 613548 [details]
Proposed patch for discussion

Python 2.7 logging stores the logging handlers as weakref's whereas Python 2.6 logging stors the actual objects. Relevant source references:

Python 2.6: http://hg.python.org/cpython/file/f130ce67387d/Lib/logging/__init__.py#l597

Python 2.7: http://hg.python.org/cpython/file/820032281f49/Lib/logging/__init__.py#l663

Hence, the above change is required to retrieve the handler object from the weak reference.

Comment 2 Amit Saha 2012-09-17 03:39:01 UTC
Submitted Gerrit patch review: http://gerrit.beaker-project.org/#/c/1352/

Comment 4 Dan Callaghan 2012-10-11 23:50:09 UTC
Beaker 0.9.4 has been released.