neutron-rootwrap-xen-dom0 not properly closing XenAPI sessions

Bug #1558721 reported by Alex Oughton
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
neutron
Fix Released
Medium
Alex Oughton
Kilo
Fix Released
Undecided
Alex Oughton

Bug Description

Hello,

When using OpenStack Liberty with XenServer, neutron is not properly closing its XenAPI sessions. Since it creates these so rapidly, the XenServer host eventually exceeds its maximum allowed number of connections:

Mar 17 11:39:05 compute3 xapi: [debug|compute3.openstack.lab.eco.rackspace.com|25 db_gc|DB GC D:bb694b976766|db_gc] Number of disposable sessions in group 'external' in database (401/401) exceeds limit (400): will delete the oldest

This occurs roughly once per minute, with many sessions being invalidated. The effect is that any long-running hypervisor operations (for example a live-migration) will fail with an "unauthorized" error, as their session was invalidated while they were still running:

2016-03-17 11:43:34.483 14310 ERROR nova.virt.xenapi.vmops Failure: ['INTERNAL_ERROR', 'Storage_interface.Internal_error("Http_client.Http_error(\\"401\\", \\"{ frame = false; method = POST; uri = /services/SM;
query = [ session_id=OpaqueRef:8663a5b7-928e-6ef5-e312-9f430b553c7f ]; content_length = [ ]; transfer encoding = ; version = 1.0; cookie = [ ]; task = ; subtask_of = ; content-type = ; host = ; user_agent = xe
n-api-libs/1.0 }\\")")']

The fix is to add a line to neutron-rootwrap-xen-dom0 to have it properly close the sessions.

Before:

def run_command(url, username, password, user_args, cmd_input):
    try:
        session = XenAPI.Session(url)
        session.login_with_password(username, password)
        host = session.xenapi.session.get_this_host(session.handle)
        result = session.xenapi.host.call_plugin(
            host, 'netwrap', 'run_command',
            {'cmd': json.dumps(user_args), 'cmd_input': json.dumps(cmd_input)})
        return json.loads(result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(RC_XENAPI_ERROR)

After:

def run_command(url, username, password, user_args, cmd_input):
    try:
        session = XenAPI.Session(url)
        session.login_with_password(username, password)
        host = session.xenapi.session.get_this_host(session.handle)
        result = session.xenapi.host.call_plugin(
            host, 'netwrap', 'run_command',
            {'cmd': json.dumps(user_args), 'cmd_input': json.dumps(cmd_input)})
        session.xenapi.session.logout()
        return json.loads(result)
    except Exception as e:
        traceback.print_exc()
        sys.exit(RC_XENAPI_ERROR)

After making this change, the logs still show the sessions being rapidly created, but it also shows them being destroyed. The "exceeds limit" error no longer occurs, and live-migrations now succeed.

Regards,

Alex Oughton

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

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

Changed in neutron:
assignee: nobody → Alex Oughton (alex-oughton)
status: New → In Progress
Changed in neutron:
assignee: Alex Oughton (alex-oughton) → nobody
status: In Progress → New
Changed in neutron:
importance: Undecided → Medium
Revision history for this message
Armando Migliaccio (armando-migliaccio) wrote :
Changed in neutron:
status: New → Confirmed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

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

Changed in neutron:
assignee: nobody → Alex Oughton (alex-oughton)
status: Confirmed → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on neutron (master)

Change abandoned by Alexander Oughton (<email address hidden>) on branch: master
Review: https://review.openstack.org/294230
Reason: Reuploaded as https://review.openstack.org/#/c/294661/

Revision history for this message
Alex Oughton (alex-oughton) wrote :

Sorry, I are not good at computer. Meant to upload a second patch set to the existing fix proposal, after some feedback which was received. Ended up creating a new one, so have abandoned the first one.

Changed in neutron:
assignee: Alex Oughton (alex-oughton) → nobody
status: In Progress → New
Revision history for this message
OpenStack Infra (hudson-openstack) wrote :

Change abandoned by Alexander Oughton (<email address hidden>) on branch: master
Review: https://review.openstack.org/294661
Reason: rebasing

Changed in neutron:
assignee: nobody → Alex Oughton (alex-oughton)
Changed in neutron:
status: New → In Progress
Revision history for this message
Alex Oughton (alex-oughton) wrote :

OK, I got it properly added as "patch set 2" to the original change. Sorry for any weirdness. I'm new to gerrit, and also git.

The correct patch is, once again:

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

Revision history for this message
Alex Oughton (alex-oughton) wrote :

Uploaded patch set 3 with further refinements.

Revision history for this message
Alex Oughton (alex-oughton) wrote :

Uploaded patch set 4 with better commit message.

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

Reviewed: https://review.openstack.org/294230
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=9d21b5ad7edbf9ac1fd9254e97f56966f25de8e6
Submitter: Jenkins
Branch: master

commit 9d21b5ad7edbf9ac1fd9254e97f56966f25de8e6
Author: Alex Oughton <email address hidden>
Date: Fri Mar 18 11:12:10 2016 -0500

    Close XenAPI sessions in neutron-rootwrap-xen-dom0

    Neutron with XenServer properly doesn't close XenAPI sessions.
    If it creates these sessions so rapidly, the XenServer host eventually
    exceeds its maximum allowed number of connections.
    This patch adds a close process for session.

    Closes-Bug: 1558721
    Change-Id: Ida90a970c649745c492c28c41c4a151e4d940aa6

Changed in neutron:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to neutron (stable/mitaka)

Fix proposed to branch: stable/mitaka
Review: https://review.openstack.org/296512

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

Fix proposed to branch: stable/liberty
Review: https://review.openstack.org/296513

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

Fix proposed to branch: stable/kilo
Review: https://review.openstack.org/296514

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/mitaka)

Reviewed: https://review.openstack.org/296512
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=da1eee31057fb44ff758d99ac99eeb47b7caec6e
Submitter: Jenkins
Branch: stable/mitaka

commit da1eee31057fb44ff758d99ac99eeb47b7caec6e
Author: Alex Oughton <email address hidden>
Date: Fri Mar 18 11:12:10 2016 -0500

    Close XenAPI sessions in neutron-rootwrap-xen-dom0

    Neutron with XenServer properly doesn't close XenAPI sessions.
    If it creates these sessions so rapidly, the XenServer host eventually
    exceeds its maximum allowed number of connections.
    This patch adds a close process for session.

    Closes-Bug: 1558721
    Change-Id: Ida90a970c649745c492c28c41c4a151e4d940aa6
    (cherry picked from commit 9d21b5ad7edbf9ac1fd9254e97f56966f25de8e6)

tags: added: in-stable-mitaka
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/kilo)

Reviewed: https://review.openstack.org/296514
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=2b6d1bba5d4c9e30f8389635c963fdcd3707b409
Submitter: Jenkins
Branch: stable/kilo

commit 2b6d1bba5d4c9e30f8389635c963fdcd3707b409
Author: Alex Oughton <email address hidden>
Date: Fri Mar 18 11:12:10 2016 -0500

    Close XenAPI sessions in neutron-rootwrap-xen-dom0

    Neutron with XenServer properly doesn't close XenAPI sessions.
    If it creates these sessions so rapidly, the XenServer host eventually
    exceeds its maximum allowed number of connections.
    This patch adds a close process for session.

    Closes-Bug: 1558721
    Change-Id: Ida90a970c649745c492c28c41c4a151e4d940aa6
    (cherry picked from commit 9d21b5ad7edbf9ac1fd9254e97f56966f25de8e6)

tags: added: in-stable-kilo
tags: added: in-stable-liberty
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (stable/liberty)

Reviewed: https://review.openstack.org/296513
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=a42b17615684dd3ada45b38fc314bae6c0f9341a
Submitter: Jenkins
Branch: stable/liberty

commit a42b17615684dd3ada45b38fc314bae6c0f9341a
Author: Alex Oughton <email address hidden>
Date: Fri Mar 18 11:12:10 2016 -0500

    Close XenAPI sessions in neutron-rootwrap-xen-dom0

    Neutron with XenServer properly doesn't close XenAPI sessions.
    If it creates these sessions so rapidly, the XenServer host eventually
    exceeds its maximum allowed number of connections.
    This patch adds a close process for session.

    Closes-Bug: 1558721
    Change-Id: Ida90a970c649745c492c28c41c4a151e4d940aa6
    (cherry picked from commit 9d21b5ad7edbf9ac1fd9254e97f56966f25de8e6)

Revision history for this message
Alex Oughton (alex-oughton) wrote :
Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/neutron 8.1.0

This issue was fixed in the openstack/neutron 8.1.0 release.

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

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

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/neutron 2015.1.4

This issue was fixed in the openstack/neutron 2015.1.4 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to neutron (master)
Download full text (36.9 KiB)

Reviewed: https://review.openstack.org/314250
Committed: https://git.openstack.org/cgit/openstack/neutron/commit/?id=3bf73801df169de40d365e6240e045266392ca63
Submitter: Jenkins
Branch: master

commit a323769143001d67fd1b3b4ba294e59accd09e0e
Author: Ryan Moats <email address hidden>
Date: Tue Oct 20 15:51:37 2015 +0000

    Revert "Improve performance of ensure_namespace"

    This reverts commit 81823e86328e62850a89aef9f0b609bfc0a6dacd.

    Unneeded optimization: this commit only improves execution
    time on the order of milliseconds, which is less than 1% of
    the total router update execution time at the network node.

    This also

    Closes-bug: #1574881

    Change-Id: Icbcdf4725ba7d2e743bb6761c9799ae436bd953b

commit 7fcf0253246832300f13b0aa4cea397215700572
Author: OpenStack Proposal Bot <email address hidden>
Date: Thu Apr 21 07:05:16 2016 +0000

    Imported Translations from Zanata

    For more information about this automatic import see:
    https://wiki.openstack.org/wiki/Translations/Infrastructure

    Change-Id: I9e930750dde85a9beb0b6f85eeea8a0962d3e020

commit 643b4431606421b09d05eb0ccde130adbf88df64
Author: OpenStack Proposal Bot <email address hidden>
Date: Tue Apr 19 06:52:48 2016 +0000

    Imported Translations from Zanata

    For more information about this automatic import see:
    https://wiki.openstack.org/wiki/Translations/Infrastructure

    Change-Id: I52d7460b3265b5460b9089e1cc58624640dc7230

commit 1ffea42ccdc14b7a6162c1895bd8f2aae48d5dae
Author: OpenStack Proposal Bot <email address hidden>
Date: Mon Apr 18 15:03:30 2016 +0000

    Updated from global requirements

    Change-Id: Icb27945b3f222af1d9ab2b62bf2169d82b6ae26c

commit b970ed5bdac60c0fa227f2fddaa9b842ba4f51a7
Author: Kevin Benton <email address hidden>
Date: Fri Apr 8 17:52:14 2016 -0700

    Clear DVR MAC on last agent deletion from host

    Once all agents are deleted from a host, the DVR MAC generated
    for that host should be deleted as well to prevent a buildup of
    pointless flows generated in the OVS agent for hosts that don't
    exist.

    Closes-Bug: #1568206
    Change-Id: I51e736aa0431980a595ecf810f148ca62d990d20
    (cherry picked from commit 92527c2de2afaf4862fddc101143e4d02858924d)

commit eee9e58ed258a48c69effef121f55fdaa5b68bd6
Author: Mike Bayer <email address hidden>
Date: Tue Feb 9 13:10:57 2016 -0500

    Add an option for WSGI pool size

    Neutron currently hardcodes the number of
    greenlets used to process requests in a process to 1000.
    As detailed in
    http://lists.openstack.org/pipermail/openstack-dev/2015-December/082717.html

    this can cause requests to wait within one process
    for available database connection while other processes
    remain available.

    By adding a wsgi_default_pool_size option functionally
    identical to that of Nova, we can lower the number of
    greenlets per process to be more in line with a typical
    max database connection pool size.

    DocImpact: a previously unused configuration value
               wsgi_default_pool_size is now used to a...

tags: added: neutron-proactive-backport-potential
Revision history for this message
Thierry Carrez (ttx) wrote : Fix included in openstack/neutron 7.1.0

This issue was fixed in the openstack/neutron 7.1.0 release.

Revision history for this message
Doug Hellmann (doug-hellmann) wrote : Fix included in openstack/neutron 9.0.0.0b1

This issue was fixed in the openstack/neutron 9.0.0.0b1 development milestone.

tags: removed: neutron-proactive-backport-potential
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/neutron 2015.1.4

This issue was fixed in the openstack/neutron 2015.1.4 release.

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.