Closed nido009 closed 9 years ago
Thanks for the report.
Can you please provide more details - gisting a whole raw email message would be great (you can of course mask / remove sensitive parts).
When I worked on the support for attachments, I didn't encounter this issue (I tested it with multiple different attachments) so I'm curious what is causing this issue. Or maybe this only affects message with multiple body parts (I also tested an email with two parts - raw and html and it worked fine).
still with the multipart fix i receive the following errors when a mail is received via imap:
==> st2sensorcontainer.log <== Jul 29 13:57:53 localhost st2sensorcontainer[18719]: DEBUG 140030889148080 log [-] process_task Jul 29 13:57:53 localhost st2sensorcontainer[18719]: DEBUG 140030889148080 log [-] body: TriggerDB(description=None, id=55b8d8d39c99383f8d82a834, name="st2.sensor.process_exit", pack="core", parameters={}, type="core.st2.sensor.process_exit") Jul 29 13:57:53 localhost st2sensorcontainer[18719]: DEBUG 140030889148080 log [-] message.properties: {'priority': 0, 'application_headers': {}, 'delivery_mode': 2, 'content_encoding': u'binary', 'content_type': u'application/x-python-serialize'} Jul 29 13:57:53 localhost st2sensorcontainer[18719]: DEBUG 140030889148080 log [-] message.delivery_info: {'consumer_tag': u'1', 'redelivered': False, 'routing_key': u'update', 'delivery_tag': 8, 'exchange': u'st2.trigger'} Jul 29 13:57:53 localhost st2sensorcontainer[18719]: DEBUG 140030889148080 log [-] Skipping message <kombu.transport.pyamqp.Message object at 0x7f5b7ff73348> since't trigger_type doesn't match (type=core.st2.sensor.process_exit)
Jul 29 13:58:22 localhost st2sensorcontainer[18720]: DEBUG 140505277216720 log [-] [IMAPSensor]: entering poll Jul 29 13:58:22 localhost st2sensorcontainer[18720]: DEBUG 140505277216720 log [-] [IMAPSensor]: polling mailbox dummyhost_main Jul 29 13:58:22 localhost st2sensorcontainer[18720]: DEBUG 140505277216720 log [-] [IMAPSensor]: Processing 1 new messages Jul 29 13:58:22 localhost st2sensorcontainer[18720]: DEBUG 140505277216720 log [-] Dispatching trigger (trigger=email.imap.message,payload={'trigger': 'email.imap.message', 'payload': {'body': [u'test test\r\n\r\nnido009\r\n', u'
==> st2rulesengine.log <== Jul 29 13:58:22 localhost st2rulesengine[18520]: ERROR 140579278949264 mixins [-] Can't decode message body: DecodeError(ImportError('No module named flanker.mime.message.headers.wrappers',),) (type:u'application/x-python-serialize' encoding:u'binary' raw:'\'\x80\x02}q\x01(U\x07triggerq\x02U\x12email.imap.messageq\x03U\x07payloadq\x04}q\x05(U\x04bodyq\x06]q\x07(X\x16\x00\x00\x00test test\r\n\r\nnido009\r\nq\x08X\xce\x00\x00\x00
==> st2sensorcontainer.log <== Jul 29 13:58:22 localhost st2sensorcontainer[18720]: DEBUG 140505277216720 channel [-] Closed channel #1
as far as i can see this error is not related to the email pack directly, but instead in the rulesengine, cause the flanker include is missing there.
This is rather weird.
Rules engine shouldn't import anything from there. We use pickle serializer for message bus messages, so it could be something weird going on there (e.g. payload is some how being treated as Python code when de-seralizing it and this results in the import...).
Or it could simply be error message which occurs inside the sensor (sensor container), but it's being logged in a weird way inside the rules engine.
@nido009 Can you please forward me the email in question to (tomaz at stackstorm.com) and I will try to reproduce the issue as soon as I can.
@Kami you have mail.
This issue is also affecting one of our POCs that we have ongoing.
@nido009 @jfryman Thanks. I will dig in today and try to reproduce the issue.
@nido009 I tried to reproduce this issue using the email you forwarded to me and yes, the issue doesn't lie in the sensor.
The sensor works just fine and the trigger is dispatched correctly. It looks like it's an issue with the rules engine. I will dig further.
Yep, I just confirmed it - the exception is throw inside the rules engine (kombu library) when we try to de-serialize (unpickle) the message on the message bus.
I'm looking into a fix now.
the email pack has a problem with multipart mime messages. upon hitting a multipart message it crashes with "Can't decorde message body: DecodeError(TypeError(......"
_process_message() already parses mime for the headers. instead of body = message.body it should be something like "body=mime_msg.body". then it would only be parsed if not multipart.