Skip to content
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

Errors don't seem to be handled/reported gracefully #42

Closed
danmur opened this issue Nov 26, 2013 · 2 comments
Closed

Errors don't seem to be handled/reported gracefully #42

danmur opened this issue Nov 26, 2013 · 2 comments

Comments

@danmur
Copy link

danmur commented Nov 26, 2013

I'm using haigha with the gevent transport and I'm getting a few errors (normal expected errors) but they don't seem to be reported well. The main one that I keep seeing is that the queue property on the channel instance disappears; from looking at the debug logging I can see that rabbitmq has reported an error immediately before, but it would be nice if this was reported in some way. Here's some logging and a stack trace as an example:

2013-11-26 17:28:01,589 DEBUG [haigha][Dummy-2] READ: MethodFrame[channel: 1, class_id: 20, method_id: 40, args: \x00\x14\x00\x28\x01\x94\x33\x4e\x4f\x54\x5f\x46\x4f\x55\x4e\x44\x20\x2d\x20\x6e\x6f\x20\x65\x78\x63\x68\x61\x6e\x67\x65\x20\x27\x61\x6c\x6c\x5f\x6d\x65\x73\x73\x61\x67\x65\x73\x27\x20\x69\x6e\x20\x76\x68\x6f\x73\x74\x20\x27\x2f\x27\x00\x3c\x00\x28]
2013-11-26 17:28:01,590 DEBUG [haigha][Dummy-2] WRITE: MethodFrame[channel: 1, class_id: 20, method_id: 41, args: None]
2013-11-26 17:28:01,590 DEBUG [haigha][Dummy-2] sent 12 bytes to localhost:5672
2013-11-26 17:28:02,090 ERROR [hatchd.utils.scripts.runner][Dummy-1] Uncaught exception running script
Traceback (most recent call last):
  File "/Users/daniel/Projects/myapp/lib/hatchd.utils/hatchd/utils/scripts/runner.py", line 93, in run_script
    func(settings=settings, arguments=args, argparser=parser)
  File "/Users/daniel/Projects/myapp/myapp/scripts/run_component.py", line 15, in run_component
    component.run()
  File "/Users/daniel/Projects/myapp/myapp/components/heartbeat.py", line 22, in run
    self.message_broker.publish(Message('hb', {}))
  File "/Users/daniel/Projects/myapp/myapp/messaging.py", line 34, in publish
    self.channel.queue.declare(
AttributeError: 'Channel' object has no attribute 'queue'
2013-11-26 17:28:02,091 DEBUG [haigha][Dummy-3] WRITE: MethodFrame[channel: 0, class_id: 10, method_id: 50, args: \x00\x00\x00\x00\x00\x00\x00]
2013-11-26 17:28:02,091 DEBUG [haigha][Dummy-3] sent 19 bytes to localhost:5672

and if I print out that last bit of data:

>>> print '\x00\x14\x00\x28\x01\x94\x33\x4e\x4f\x54\x5f\x46\x4f\x55\x4e\x44\x20\x2d\x20\x6e\x6f\x20\x65\x78\x63\x68\x61\x6e\x67\x65\x20\x27\x61\x6c\x6c\x5f\x6d\x65\x73\x73\x61\x67\x65\x73\x27\x20\x69\x6e\x20\x76\x68\x6f\x73\x74\x20\x27\x2f\x27\x00\x3c\x00\x28'
(�3NOT_FOUND - no exchange 'all_messages' in vhost '/'<(

If this is by design then all good, I'm just curious if I'm doing something wrong, or if there is something else I should be doing to handle errors?

p.s. Thank you for you work :)

@awestendorf
Copy link
Member

Thank you, it's good to know you're finding it valuable.

It seems that your channel is being closed without you knowing, and so the next time you go to use it, the internal handles have been cleaned up.

In the Channel class, there are listener methods for registering callbacks on channel open and close. This should give you the opportunity to handle the close event, at which point you can check the close_info on the channel to read out the error condition that the broker reported.

I added issue #43 to make this a bit easier to debug from the output.

@danmur
Copy link
Author

danmur commented Nov 28, 2013

Ah, thank you! That should do nicely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants