New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RemoteClosedException occurs from multiple threads #12

Closed
henter opened this Issue Nov 29, 2013 · 3 comments

Comments

Projects
None yet
2 participants
@henter
Copy link

henter commented Nov 29, 2013

Exception like "NOT_ALLOWED - attempt to reuse consumer tag 'rabbitpy.1.139714802256464'"

Exception in thread Thread-101:
Traceback (most recent call last):
  File "/usr/lib/python2.7/threading.py", line 552, in __bootstrap_inner
    self.run()
  File "/usr/lib/python2.7/threading.py", line 505, in run
    self.__target(*self.__args, **self.__kwargs)
  File "rabbitpy_ios.py", line 28, in main
    for message in queue.consume_messages(False, 10):
  File "/usr/local/lib/python2.7/dist-packages/rabbitpy/amqp_queue.py", line 110, in consume_messages
    with self.consumer(no_ack, prefetch) as consumer:
  File "/usr/lib/python2.7/contextlib.py", line 17, in __enter__
    return self.gen.next()
  File "/usr/local/lib/python2.7/dist-packages/rabbitpy/amqp_queue.py", line 92, in consumer
    self.channel.prefetch_count(prefetch)
  File "/usr/local/lib/python2.7/dist-packages/rabbitpy/channel.py", line 178, in prefetch_count
    global_=all_channels))
  File "/usr/local/lib/python2.7/dist-packages/rabbitpy/base.py", line 181, in rpc
    return self._wait_on_frame(frame_value.valid_responses)
  File "/usr/local/lib/python2.7/dist-packages/rabbitpy/base.py", line 254, in _wait_on_frame
    value = self._read_from_queue()
  File "/usr/local/lib/python2.7/dist-packages/rabbitpy/base.py", line 207, in _read_from_queue
    self._check_for_exceptions()
  File "/usr/local/lib/python2.7/dist-packages/rabbitpy/base.py", line 199, in _check_for_exceptions
    raise exception
RemoteClosedException: (530, "NOT_ALLOWED - attempt to reuse consumer tag 'rabbitpy.1.139714802256464'")
@gmr

This comment has been minimized.

Copy link
Owner

gmr commented Dec 18, 2013

Can you provide an example of what you're trying to do? It appears that you're trying to run two consumers using the context manager. This is currently not supported and I don't know if I will support that with this library...

Are you trying to run two different threads, each with its own connection, channel and consumer? I would expect that to work.

@henter

This comment has been minimized.

Copy link

henter commented Dec 20, 2013

yes, I've fixed my code to run only one consumer for each thread, it's works fine.
thanks for your reply.

@gmr

This comment has been minimized.

Copy link
Owner

gmr commented Dec 23, 2013

Great!

@gmr gmr closed this Dec 23, 2013

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment