You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by Gary Kotton <gk...@redhat.com> on 2012/11/06 16:32:52 UTC
QPID and eventlet.monkey_patch()
Hi,
Hi,
I'm Gary and working on the OpenStack project. I have run into a problem
and maybe you can help or can suggest someone who can.
The communication between the different modules is done with QPID. We
are using python. If the service that I am running starts before qpidd
then it hangs and does not recover. Even when the qpidd daemon starts it
does not recover.
The reason is that we do eventlet.monkey_patch(). The script below
easily shows a reproduction of the problem. If the lines below in red
are commented out the the script recovers when qpidd starts. If not then
it hangs. Please note that if the sockets are not patched then this
works. We need all to be patched.
Any clues or direction will be greatly appreciated.
Thanks
Gary
#!/usr/bin/env python
import eventlet
eventlet.monkey_patch()
import os
import time
from qpid.messaging import endpoints
print "QPID Test!"
session = None
consumers = {}
consumer_thread = None
default_params = dict(hostname='localhost',
port=5672,
username='',
password='')
params = {}
for key in default_params.keys():
params.setdefault(key, default_params[key])
broker = params['hostname'] + ":" + str(params['port'])
# Create the connection - this does not open the connection
print "======> broker %s" % broker
connection = endpoints.Connection(broker)
# Check if flags are set and if so set them for the connection
# before we call open
connection.username = params['username']
connection.password = params['password']
connection.sasl_mechanisms = ''
connection.reconnect = True
connection.heartbeat = 60
connection.protocol = 'tcp'
connection.tcp_nodelay = True
while True:
try:
connection.open()
except endpoints.exceptions.ConnectionError, e:
print 'Unable to connect to AMQP server: %s' % e
time.sleep(1)
else:
break
print 'Connected to AMQP server on %s' % broker
Re: QPID and eventlet.monkey_patch()
Posted by Chuck Rolke <cr...@redhat.com>.
I believe that the 'red lines' are:
import eventlet
eventlet.monkey_patch()
----- Original Message -----
> From: "Gordon Sim" <go...@gmail.com>
> To: dev@qpid.apache.org
> Sent: Tuesday, November 6, 2012 11:53:01 AM
> Subject: Re: QPID and eventlet.monkey_patch()
>
> On 11/06/2012 03:32 PM, Gary Kotton wrote:
> > Hi,
> > Hi,
> > I'm Gary and working on the OpenStack project. I have run into a
> > problem
> > and maybe you can help or can suggest someone who can.
> > The communication between the different modules is done with QPID.
> > We
> > are using python. If the service that I am running starts before
> > qpidd
> > then it hangs and does not recover. Even when the qpidd daemon
> > starts it
> > does not recover.
> >
> > The reason is that we do eventlet.monkey_patch(). The script below
> > easily shows a reproduction of the problem. If the lines below in
> > red
> > are commented out the the script recovers when qpidd starts.
>
> For the benefit of those of us using mail readers that display plain
> text (and thus lose your colouring), could you point out which lines
> these are? Thanks!
>
> > If not then
> > it hangs. Please note that if the sockets are not patched then this
> > works. We need all to be patched.
> >
> > Any clues or direction will be greatly appreciated.
> > Thanks
> > Gary
> >
> > #!/usr/bin/env python
> >
> > import eventlet
> > eventlet.monkey_patch()
> >
> > import os
> > import time
> >
> > from qpid.messaging import endpoints
> >
> > print "QPID Test!"
> >
> > session = None
> > consumers = {}
> > consumer_thread = None
> >
> > default_params = dict(hostname='localhost',
> > port=5672,
> > username='',
> > password='')
> >
> > params = {}
> > for key in default_params.keys():
> > params.setdefault(key, default_params[key])
> >
> > broker = params['hostname'] + ":" + str(params['port'])
> > # Create the connection - this does not open the connection
> > print "======> broker %s" % broker
> > connection = endpoints.Connection(broker)
> >
> > # Check if flags are set and if so set them for the connection
> > # before we call open
> > connection.username = params['username']
> > connection.password = params['password']
> > connection.sasl_mechanisms = ''
> > connection.reconnect = True
> > connection.heartbeat = 60
> > connection.protocol = 'tcp'
> > connection.tcp_nodelay = True
> >
> > while True:
> > try:
> > connection.open()
> > except endpoints.exceptions.ConnectionError, e:
> > print 'Unable to connect to AMQP server: %s' % e
> > time.sleep(1)
> > else:
> > break
> >
> > print 'Connected to AMQP server on %s' % broker
> >
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
> For additional commands, e-mail: dev-help@qpid.apache.org
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org
Re: QPID and eventlet.monkey_patch()
Posted by Gordon Sim <go...@gmail.com>.
On 11/06/2012 03:32 PM, Gary Kotton wrote:
> Hi,
> Hi,
> I'm Gary and working on the OpenStack project. I have run into a problem
> and maybe you can help or can suggest someone who can.
> The communication between the different modules is done with QPID. We
> are using python. If the service that I am running starts before qpidd
> then it hangs and does not recover. Even when the qpidd daemon starts it
> does not recover.
>
> The reason is that we do eventlet.monkey_patch(). The script below
> easily shows a reproduction of the problem. If the lines below in red
> are commented out the the script recovers when qpidd starts.
For the benefit of those of us using mail readers that display plain
text (and thus lose your colouring), could you point out which lines
these are? Thanks!
> If not then
> it hangs. Please note that if the sockets are not patched then this
> works. We need all to be patched.
>
> Any clues or direction will be greatly appreciated.
> Thanks
> Gary
>
> #!/usr/bin/env python
>
> import eventlet
> eventlet.monkey_patch()
>
> import os
> import time
>
> from qpid.messaging import endpoints
>
> print "QPID Test!"
>
> session = None
> consumers = {}
> consumer_thread = None
>
> default_params = dict(hostname='localhost',
> port=5672,
> username='',
> password='')
>
> params = {}
> for key in default_params.keys():
> params.setdefault(key, default_params[key])
>
> broker = params['hostname'] + ":" + str(params['port'])
> # Create the connection - this does not open the connection
> print "======> broker %s" % broker
> connection = endpoints.Connection(broker)
>
> # Check if flags are set and if so set them for the connection
> # before we call open
> connection.username = params['username']
> connection.password = params['password']
> connection.sasl_mechanisms = ''
> connection.reconnect = True
> connection.heartbeat = 60
> connection.protocol = 'tcp'
> connection.tcp_nodelay = True
>
> while True:
> try:
> connection.open()
> except endpoints.exceptions.ConnectionError, e:
> print 'Unable to connect to AMQP server: %s' % e
> time.sleep(1)
> else:
> break
>
> print 'Connected to AMQP server on %s' % broker
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org