Package: python-pika Version: 0.9.5-1 Severity: normal -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
Hello, when you execute this code ... #!/usr/bin/env python import pika from itertools import count counter = count(1) def receive_callback(channel, method, properties, body): print 'Received message {counter}: {body}'.format( counter=counter.next(), body=body ) channel.basic_ack(delivery_tag=method.delivery_tag) connection = pika.BlockingConnection( pika.ConnectionParameters( host='127.0.0.1', port=5672, ) ) channel = connection.channel() channel.queue_declare(queue='testertest', durable=True) channel.basic_qos(prefetch_count=1) channel.basic_consume( receive_callback, queue='testertest' ) print 'Waiting for messages ...' channel.start_consuming() you will get this Exception after N seconds (where N is defined at SOCKET_TIMEOUT_THRESHOLD in pika/adapters/blocking_connection.py (default is 100)) Waiting for messages ... Traceback (most recent call last): File "/usr/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 293, in start_consuming self.transport.connection.process_data_events() File "/usr/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 103, in process_data_events self.process_timeouts() File "/usr/lib/python2.7/dist-packages/pika/adapters/blocking_connection.py", line 157, in process_timeouts log.debug('%s: Timeout calling %s', NameError: global name 'log' is not defined This Exception makes it impossible for the process_timeouts method to handle timeouts. Code, which uses BlockingConnection, will fail in a unexpected way. I attached a patch to fix this problem. Cheers, Robin - -- System Information: Debian Release: 7.4 APT prefers stable APT policy: (500, 'stable') Architecture: amd64 (x86_64) Foreign Architectures: i386 Kernel: Linux 3.2.0-4-amd64 (SMP w/4 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages python-pika depends on: ii python 2.7.3-4+deb7u1 ii python2.6 2.6.8-1.1 ii python2.7 2.7.3-6 python-pika recommends no packages. python-pika suggests no packages. - -- no debconf information -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.12 (GNU/Linux) iQIcBAEBAgAGBQJTPAHZAAoJEKkIkdarOw7WeikP/0E62/sNUOfD/GF7MCD+RydS uHCINmKMEmWZGD6Qe9ygAcASophh1UrWUgrrIia75SR1I/5Cl3dd3khRpo0PFxZc Fkhd3JOCJxJueziWLtWghAVSw/cSZrr67y/6Bh3h4EZSJrnyPYcYDfNNswEecBvj U+ZM1/7o5DuQjzV8oyiopQX+69TpgbnVf+1dcKy4UGEH7wubO3+0n4kGF/X0xNO7 k+VsWVF0hPP951Pmr1i+tZdX/WkgkISOgFEdXyCLZ7Dvpq5lpPpjSqKuxnHTlIW4 gvLznjrKLNNZMmiLdp/aKmaemkJrtoa6oAF4/j24nmaFBWTTVzmzYEhAu1qKx/71 hMcVzB8nt9PWKr/pRtfyEah9rWg0n/EErPV4X7ZGTlYe6LqIKdF1IyEFMVm8HyXn 0YKLuwm4/AbPpBQ5PsECmxHRCX2nnDH0kmya+w6r2+SIsW8Bgo6uY24n2eeziLn4 2NsEuI+tU4DknZdTiVXBJpaom+Mcc2ZW02VtGz8JLK8pKkJsksdNTVJmQBVt4dZl WO81UH1RMjzRUmx41uLULENKlN9THR8ZiRGS6DRYpywDwZWlWIXa+sc6e6wv3WX2 OTEr/X4s6aRTXrBgxeEt4cETbCGh7JVleIwBjzg5MPee2xDeX3hbhTQzvoxEaRRs KDEXT1BrEDWZEkxPkHvk =oht0 -----END PGP SIGNATURE-----
--- a/pika/adapters/blocking_connection.py +++ b/pika/adapters/blocking_connection.py @@ -8,6 +8,7 @@ import time import types +import pika.log import pika.spec as spec from pika.adapters import BaseConnection @@ -78,7 +79,7 @@ except socket.timeout: self._socket_timeouts += 1 if self._socket_timeouts > SOCKET_TIMEOUT_THRESHOLD: - log.error(SOCKET_TIMEOUT_MESSAGE) + pika.log.error(SOCKET_TIMEOUT_MESSAGE) self._handle_disconnect() def process_data_events(self): @@ -96,7 +97,7 @@ except socket.timeout: self._socket_timeouts += 1 if self._socket_timeouts > SOCKET_TIMEOUT_THRESHOLD: - log.error(SOCKET_TIMEOUT_MESSAGE) + pika.log.error(SOCKET_TIMEOUT_MESSAGE) self._handle_disconnect() # Process our timeout events @@ -154,7 +155,7 @@ for timeout_id in keys: if timeout_id in self._timeouts and \ self._timeouts[timeout_id]['deadline'] <= start_time: - log.debug('%s: Timeout calling %s', + pika.log.debug('%s: Timeout calling %s', self.__class__.__name__, self._timeouts[timeout_id]['handler']) self._timeouts[timeout_id]['handler']()