[rabbitmq-discuss] Alternative Python AMQP client library
Dmitriy Samovskiy
dmitriy.samovskiy at cohesiveft.com
Fri Feb 1 23:39:03 GMT 2008
Barry Pederson wrote:
> kyles wrote:
>>
>> Traceback (most recent call last):
>> File "demo_send.py", line 56, in <module>
>> main()
>> File "demo_send.py", line 41, in main
>> conn = amqp.Connection(options.host, userid=options.userid,
>> password=options.password, ssl=options.ssl)
>> File "/usr/local/lib/python2.5/site-packages/amqplib/client_0_8.py", line
>> 180, in __init__
>> self.close()
>> File "/usr/local/lib/python2.5/site-packages/amqplib/client_0_8.py", line
>> 420, in close
>> (10, 61), # Connection.close_ok
>> File "/usr/local/lib/python2.5/site-packages/amqplib/client_0_8.py", line
>> 356, in wait
>> frame_type, payload = self._wait_channel(0)
>> File "/usr/local/lib/python2.5/site-packages/amqplib/client_0_8.py", line
>> 298, in _wait_channel
>> frame_type, frame_channel, payload = self._wait_frame()
>> File "/usr/local/lib/python2.5/site-packages/amqplib/client_0_8.py", line
>> 273, in _wait_frame
>> frame_type = self.input.read_octet()
>> File "/usr/local/lib/python2.5/site-packages/amqplib/util_0_8.py", line
>> 96, in read_octet
>> return unpack('B', self.input.read(1))[0]
>> File "/usr/local/lib/python2.5/struct.py", line 87, in unpack
>> return o.unpack(s)
>> struct.error: unpack requires a string argument of length 1
>> Exception socket.error: (32, 'Broken pipe') in <bound method
>> Connection.__del__ of <amqplib.client_0_8.Connection object at 0xb7c7470c>>
>> ignored
>>
>> Is this something you've seen before?
>>
>> Thanks,
>> Kyle
>
> Sorry, I haven't had a multi-node RabbitMQ setup to try anything like
> that particular setup, so haven't seen that particular error.
>
> It looks like the node you're connecting to is maybe trying to redirect
> you to the other node, and then closing the socket without waiting for
> the client to send a "close" message and then responding with "close-ok".
>
Yes, I get the same very exception when broker replies with a redirect.
You can also use insist flag when starting a connection:
client = Connection(host=myip, userid='guest', password='guest', insist=True)
This should work with the latest version of amqplib.
In my tests I have never seen a broker respond with redirect when I set insist to True,
even though according to the spec, a broker SHOULD accept a connection (not MUST):
<field name="insist" type="bit">
insist on connecting to server
<doc>
In a configuration with multiple load-sharing servers, the server
may respond to a Connection.Open method with a Connection.Redirect.
The insist option tells the server that the client is insisting on
a connection to the specified server.
</doc>
<rule implement="SHOULD">
When the client uses the insist option, the server SHOULD accept
the client connection unless it is technically unable to do so.
</rule>
</field>
- Dmitriy
More information about the rabbitmq-discuss
mailing list