Terminate the glance-api in eclipse cause Ubuntu logout

Bug #1068051 reported by Feilong Wang
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Glance
Fix Released
Low
Flavio Percoco
Grizzly
Fix Released
Low
Flavio Percoco

Bug Description

Now I'm using eclipse+pydev+eGit to debug OpenStack, but I'm running a weird problem. When I terminate the glance-api or glance-registry, it will cause the Ubuntu 12.04 LTS logout automatically. And more worse, after reinstall the OS, I can recreate it.
But for other Openstack components, they works fine in eclipse.
Pleaes let me know if any more log is needed. Thanks.

Revision history for this message
Davanum Srinivas (DIMS) (dims-v) wrote :

Can you please see if commenting out the line that says "os.killpg(0, signal.SIGTERM)" in glance/common/wsgi.py helps

Revision history for this message
Feilong Wang (flwang) wrote :

Hi Davanum, thanks for your quick response. After comment the line, the issue is gone. But I'd like to know is there any function will be impacted if the line is commented. If no, it can be accepted by me as a workround. If no, please let me know what functions will be impacted. Thanks.

Revision history for this message
Mark Washenberger (markwash) wrote :

Hi Fei,

It looks like when you launch glance (in tests?), it is somehow retaining the process group of your window manager(?). Thus, when we call os.killpg(0, signal.SIGTERM), your window manager or X or something is in glance's process group and is being killed.

I'm not sure how exactly to fix this. In particular, it may be easier to change how you're launching glance, there might be a better way for glance to launch and kill child processes, or there might be a way for glance to explicitly become process group leader when it starts.

If you could do some digging around with ps while glance is running, that would be great. I cannot quite figure out exactly which commands should be run, however.

Changed in glance:
status: New → Triaged
importance: Undecided → Low
Revision history for this message
Feilong Wang (flwang) wrote :

Hi Mark, yes, I think the issue depends on how to launch the glance. If I start it from command line, everything is ok. And Davanum's workround also works. But I'm wondering why the other components don't have this issue.

Revision history for this message
Brian Waldon (bcwaldon) wrote :

Other projects don't use the same code to manage child processes.

Changed in glance:
assignee: nobody → Flavio Percoco Premoli (flaper87)
status: Triaged → In Progress
Revision history for this message
Flavio Percoco (flaper87) wrote :

Hi Fei,

I submitted a patch for this issue that kills each child process individually instead of killing the process group. I don't use eclipse myself but in a general use the patch works. Could you please give it a try and provide some feedback?

Thank you

Revision history for this message
Feilong Wang (flwang) wrote :

Hi Flavio, thank you for your fixing. How can I get the fix? Can you send me the code review link? Thanks.

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

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

Changed in glance:
assignee: Flavio Percoco Premoli (flaper87) → John Bresnahan (jbresnah)
Revision history for this message
Feilong Wang (flwang) wrote :

I tested the fix in my eclipse+pydev development environment, it works fine. Thanks Flavio.

Changed in glance:
assignee: John Bresnahan (jbresnah) → Flavio Percoco (flaper87)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (master)

Reviewed: https://review.openstack.org/26076
Committed: http://github.com/openstack/glance/commit/a9f9f137bb44bd5727854f416f8b0c7c3df81867
Submitter: Jenkins
Branch: master

commit a9f9f137bb44bd5727854f416f8b0c7c3df81867
Author: Flaper Fesp <email address hidden>
Date: Thu Apr 4 12:17:36 2013 +0200

    Call os.kill for each child instead of the process group

    The patch sets the process group id to its process id. Note that this
    change raises an OSError in Glance's tests because they are run under
    Popen and using glance-control, which changes children's session ids and
    other parameters. That for, setpgid is inside a try / except and falls
    back to 0.

    Fixes bug 1068051

    Change-Id: Ie9ed044e08053d0067396138de0bd124326aa1a5

Changed in glance:
status: In Progress → Fix Committed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (master)

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

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to glance (stable/grizzly)

Fix proposed to branch: stable/grizzly
Review: https://review.openstack.org/28280

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

Reviewed: https://review.openstack.org/27611
Committed: http://github.com/openstack/glance/commit/866cb846f5310e1ad36181e64e7d59ba54d9fd40
Submitter: Jenkins
Branch: master

commit 866cb846f5310e1ad36181e64e7d59ba54d9fd40
Author: John Bresnahan <email address hidden>
Date: Fri May 3 10:50:42 2013 -1000

    Remove glance-control from the test suite

    This patch removes the use of glance-control from the test suite. Instead
    of forking out glance-control and letting it fork out the other programs,
    we will now fork out the other programs directly. The file which tested
    glance-control has also been removed. While we will still have
    glance-control as part of the distribution for a bit and thus it should
    still be tested, that test was doing so in a way that depended upon the
    forking behavior previously found in the test suite.

    This patch also requires the patch
    https://review.openstack.org/#/c/26076/ on which it is dependent. As a
    side effect it tests for the problem found in bug: 1068051

    Additionally, this fixes a race condition. Previously each functional
    test called cleanup() in tearDown(). Cleanup would open a pid file and
    send a SIGTERM to the processes (api, registry, scrubber). However,
    it did not wait for this process to die and get cleaned up. The signal
    handler in the processes is over ridden so the death is not instant.
    This leaves a chance for server from a previous test to be actively
    listening on a port when the next test starts.

    fixes bug: 1173415
    blueprint: refactoring-better-faster-stronger-functional-tests

    Change-Id: Iabdb6fdc13b5f1993590b5a801a0e89df1a544c7

Thierry Carrez (ttx)
Changed in glance:
milestone: none → havana-1
status: Fix Committed → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to glance (stable/grizzly)

Reviewed: https://review.openstack.org/28280
Committed: http://github.com/openstack/glance/commit/46556859df9b935a04cf4d3184bac64a2e736d23
Submitter: Jenkins
Branch: stable/grizzly

commit 46556859df9b935a04cf4d3184bac64a2e736d23
Author: Flaper Fesp <email address hidden>
Date: Thu Apr 4 12:17:36 2013 +0200

    Call os.kill for each child instead of the process group

    The patch sets the process group id to its process id. Note that this
    change raises an OSError in Glance's tests because they are run under
    Popen and using glance-control, which changes children's session ids and
    other parameters. That for, setpgid is inside a try / except and falls
    back to 0.

    Fixes bug 1068051

    NOTE: This issue is not affecting production/stable environments (no comments
    related to that have been made) but the issue is there and raises under
    certain cases.

    The backport is being suggested because this is, most likely, happening
    under the hoods without users even noticing it.

    Change-Id: Ie9ed044e08053d0067396138de0bd124326aa1a5
    Cherry-picked: a9f9f137bb44bd5727854f416f8b0c7c3df81867

Thierry Carrez (ttx)
Changed in glance:
milestone: havana-1 → 2013.2
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.