aweber/rabbitmq-autocluster

Tags with < and > fail to parse

opokhvalit opened this issue · 4 comments

I setup rabbitmq with autoscaling module in AWS Autoscaling environment. They did not start, with errors in logs:

=CRASH REPORT==== 26-Jan-2017::08:43:08 ===
  crasher:
    initial call: application_master:init/4
    pid: <0.140.0>
    registered_name: []
    exception exit: {bad_return,
                        {{rabbit,start,[normal,[]]},
                         {'EXIT',
                             {{function_clause,
                                  [{rabbitmq_aws_xml,flatten_text,
                                       [[">|, u|groupSet|: {u|items|: [{u|groupId|: u|sg-a8f540d4|}]}, u|instancesSet|: {u|items|: [{u|minCount|: 1, u|maxCount|: 1, u|imageId|: u
|ami-df866cc9|}]}, u|clientToken|: u|5f001b98-3743-4cd4-83cd-f917df35e59e_subn",
                                         "<sensitiveDataRemoved",
                                         "u|userData|: u|"],
                                        []],
.....
                              {gen_server,call,
                                  [rabbitmq_aws,
                                   {request,"ec2",get,[],
                                       "/?Action=DescribeInstances&InstanceId.3=i-002524e813d6e8840&Version=2015-10-01",
                                       [],[],undefined}]}}}}}
      in function  application_master:init/4 (application_master.erl, line 134)

We have special tags for security management of our servers. This tags could contain special symbols, like '>', '<', etc. I removed this tags and rabbit had started properly.
It looks like bug in module and it don't escape special characters

@opokhvalit can you please provide an example EC2 response with such tags? (this plugin lists instances)

It would be great to have more specific examples than "something with an angle bracket".

you can find the simple example in the log above. But anyway I will reproduce this trouble and put here more detais

How to reproduce the problem.
Put tag on instance with any name and value equal to (this is part of data from an amazon event):
u|userData|: u|<sensitiveDataRemoved>|, u|groupSet|: {u|items|: [{u|groupId|: u|sg-aaaaaaaa|}]}, u|instancesSet|: {u|items|: [{u|minCount|: 1, u|maxCount|: 1, u|imageId|: u|ami-df866cc9|}]}, u|clientToken|: u|802c996d-2a16-45f3-93e7-72e301dd7fe3_subn

after that try to start rabbitmq with config like:

[
    {rabbit, [        {log_levels, [{connection, warning},{autocluster, info}]}
    ]},
    {autocluster, [
        {backend, aws},
        {aws_autoscaling, true},
        {aws_ec2_region, "us-east-1"}
    ]},
    {rabbitmq_stomp, [{tcp_listeners, [{"0.0.0.0", 6163}]}]}
].

RabbitMQ version is 3.6.6, OS - Linux, erlang version 19.2.0

gmr commented

This plugin was forked by the RabbitMQ team and is now part of RabbitMQ. More information can be found @ https://github.com/rabbitmq/rabbitmq-autocluster