Duplicate Qpid connection is created during Connection initialization

Bug #1330364 reported by zhu zhu
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
oslo-incubator
Fix Released
Low
zhu zhu
oslo.messaging
Fix Released
Low
ChangBo Guo(gcb)

Bug Description

neutron was still adopting the oslo incubator code for rpc modules. During the qpid connection setup from amqp get_connection_pool.

Duplicate connections will be created during __init__(class Connection in impl_qpid.py). And after the first connection object is created, this connection will never be used, and within the next step method reconnect, it will create a new qpid connection object and open it.

Need to fix this issue for duplicate creation of qpid connection.

Impl_qpid.py
class Connection(object):
    """Connection object."""

    pool = None

    def __init__(self, conf, server_params=None):
        if not qpid_messaging:
            raise ImportError("Failed to import qpid.messaging")

        self.session = None
        self.consumers = {}
        self.consumer_thread = None
        self.proxy_callbacks = []
        self.conf = conf

        if server_params and 'hostname' in server_params:
            # NOTE(russellb) This enables support for cast_to_server.
            server_params['qpid_hosts'] = [
                '%s:%d' % (server_params['hostname'],
                           server_params.get('port', 5672))
            ]

        params = {
            'qpid_hosts': self.conf.qpid_hosts,
            'username': self.conf.qpid_username,
            'password': self.conf.qpid_password,
        }
        params.update(server_params or {})

        self.brokers = params['qpid_hosts']
        self.username = params['username']
        self.password = params['password']

        brokers_count = len(self.brokers)
        self.next_broker_indices = itertools.cycle(range(brokers_count))

        self.connection_create(self.brokers[0])
        self.reconnect()

Xu Han Peng (xuhanp)
Changed in neutron:
assignee: nobody → Xu Han Peng (xuhanp)
Revision history for this message
Mark McLoughlin (markmc) wrote :

Fixed in oslo.messaging by I7618cf3506d857579dc37b338690d05179ba272d

oslo-incubator patch https://review.openstack.org/#/c/100177/

Note - this isn't nearly as bad as the report makes it sound. We simple creating duplicate connection objects, but don't actually set up and tear down extra sockets with the broker

Changed in oslo.messaging:
status: New → Fix Released
importance: Undecided → Low
assignee: nobody → ChangBo Guo(gcb) (glongwave)
Changed in oslo:
importance: Undecided → Low
status: New → Triaged
status: Triaged → In Progress
assignee: nobody → zhu zhu (zhuzhubj)
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to oslo-incubator (master)

Reviewed: https://review.openstack.org/100177
Committed: https://git.openstack.org/cgit/openstack/oslo-incubator/commit/?id=4558a7202e78b853e7ee6451abd0dcf25007667e
Submitter: Jenkins
Branch: master

commit 4558a7202e78b853e7ee6451abd0dcf25007667e
Author: ZHU ZHU <email address hidden>
Date: Mon Jun 16 02:58:51 2014 -0500

    Fix issue of duplicate creation for connections in impl_qpid

    Within __init__ of Class Connection, self.connection_create and
    reconnect() will both construct a new connection object. Need to fix
    it.

    Change-Id: I6e3183d36d11995970fb8dce45240f804ec52ab4
    Closes-Bug: #1330364

Changed in oslo:
status: In Progress → Fix Committed
Changed in oslo:
milestone: none → juno-2
status: Fix Committed → Fix Released
Revision history for this message
Eugene Nikanorov (enikanorov) wrote :

removing neutron as it depends on oslo.messaging now

no longer affects: neutron
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.