Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

Coerce config values to binaries in message retainer #86

Closed
michaelklishin opened this issue Jun 27, 2016 · 5 comments
Closed

Coerce config values to binaries in message retainer #86

michaelklishin opened this issue Jun 27, 2016 · 5 comments
Assignees
Milestone

Comments

@michaelklishin
Copy link
Member

See this mailing list thread.

@michaelklishin michaelklishin added this to the 3.6.4 milestone Jun 27, 2016
@michaelklishin michaelklishin self-assigned this Jun 27, 2016
@michaelklishin michaelklishin modified the milestones: 3.6.x, 3.6.4 Nov 18, 2016
@michaelklishin michaelklishin modified the milestones: 3.6.7, 3.6.x Dec 1, 2016
@acogoluegnes
Copy link
Contributor

Managed to reproduce with this configuration file:

[
  {rabbit,
    [
      {default_vhost, "/"}
    ]
  }
].

Message retainer supervisor fails to start its children (one per virtual host). It gets the list of virtual hosts with rabbit_vhost:list/0. Unfortunately, the harm is already done at that time, the default virtual host is a string in the broker and it's broken, it won't be much useful to convert string-ed virtual hosts to an atom everywhere in rabbit_mqtt_retainer_sup.

We'd better off coercing when inserting those default values.

WDYT @michaelklishin?

@michaelklishin
Copy link
Member Author

@acogoluegnes those values have been strings for close to 10 years. What rabbit_vhost:list/0 can easily be coerced to binaries in the MQTT plugin.

@acogoluegnes
Copy link
Contributor

Sure, but the broker is broken e.g. if we use an Erlang string for the default virtual host. I did a couple of tests with the configuration above on a fresh installation: the management plugin is broken on some pages, a Java client wouldn't connect to the default virtual host, etc.

We can coerce to binaries in the MQTT plugin, it may be working instead of crashing but the rest of the system would have a strange and hard-to-debug behavior in many other places. Hence my suggestion to coerce to binaries some of the default values in the broker itself. We can also coerce in both places, better safe than sorry.

@michaelklishin
Copy link
Member Author

michaelklishin commented Dec 5, 2016 via email

@acogoluegnes
Copy link
Contributor

OK, I'll create the issue in the broker repo.

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

No branches or pull requests

2 participants