nova.cmd.baseproxy handles errors incorrectly

Bug #1506213 reported by Alexander Aleksiyants
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
OpenStack Compute (nova)
Fix Released
Low
Wenzhi Yu

Bug Description

Nova from master.

The module doesn't print error message. If an error occurs in nova.cmd.baseproxy the method exit_with_error is executed that looks as follows:

def exit_with_error(msg, errno=-1):
    print(msg) and sys.exit(errno)

So in python 2.7 this method terminates the application without printing anything (unable to flush on time) and in python 3.4 it does strange things because print() returns None.

I noticed this bug when I was trying to run nova-novncproxy without novnc istalled. nova-novncproxy was being terminated without any prints. Then I debugged it and found out that it tries to send an error message but it fails.

Wenzhi Yu (yuywz)
Changed in nova:
assignee: nobody → Wen Zhi Yu (yuywz)
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

Confirmed with this simple test with python2.7:

    import sys

    def exit_with_error(msg, errno=-1):
        print(msg) and sys.exit(errno)

    if __name__ == "__main__":
        exit_with_error("print this message")

The message doesn't get flushed.

Changed in nova:
status: New → Confirmed
importance: Undecided → Low
status: Confirmed → In Progress
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

@Wen Zhi Yu: Thanks for taking over the task to provide a fix for this bug. Please push a patch set within the next few weeks.

A short reminder on the bug mgmt process: If you set yourself as assignee, please change the status of the bug to "in progress".

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to nova (master)

Fix proposed to branch: master
Review: https://review.openstack.org/237886

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to nova (master)

Reviewed: https://review.openstack.org/237886
Committed: https://git.openstack.org/cgit/openstack/nova/commit/?id=cf7cd655a2aaa7f44b94dca0ad7a15073a774a48
Submitter: Jenkins
Branch: master

commit cf7cd655a2aaa7f44b94dca0ad7a15073a774a48
Author: Wen Zhi Yu <email address hidden>
Date: Wed Oct 21 13:38:22 2015 +0800

    Fix error handling in nova.cmd.baseproxy

    If an error occurs in nova.cmd.baseproxy the method exit_with_error
    will be executed that looks as follows:

    def exit_with_error(msg, errno=-1):
     print(msg) and sys.exit(errno)

    However, in python2.7 this method terminates the application without
    printing anything(unable to flush on time) and in Python3.4 it does
    strange things because print() returns None.

    This commit modifies exit_with_error method to output error message
    with stderr(which in unbuffered).

    Change-Id: I519b68f8c2bc62988de87bdd2847d5f3be7e532d
    Closes-Bug: #1506213

Changed in nova:
status: In Progress → Fix Committed
Revision history for this message
Markus Zoeller (markus_z) (mzoeller) wrote :

We changed the release management from a "delayed-release" to a
"direct-release" model [1]. It seems that the fix for this bug merged
in the timeframe where we made the transition to the new model and
therefore wasn't closed with "Fix-Released" at it should be.
=> Manually closing this bug with "Fix-Released".

[1] "openstack-dev" ML, 2015-11-23, Doug Hellmann,
    "[release] process change for closing bugs when patches merge"
    http://lists.openstack.org/pipermail/openstack-dev/2015-November/080288.html

Changed in nova:
status: Fix Committed → Fix Released
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/nova 13.0.0.0b2

This issue was fixed in the openstack/nova 13.0.0.0b2 development milestone.

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.