airbnb / synapse

A transparent service discovery framework for connecting an SOA
MIT License
2.07k stars 251 forks source link

When using default servers as fallback, synapse is looking for a Zookeeper method #71

Open Jaykah opened 10 years ago

Jaykah commented 10 years ago

Not sure if I am doing something wrong, or if that is a bug, but here it is:

After synapse fails to fetch backends from Zookeeper, and it falls back to default server list, it is still trying to find method "shuffle"

W, [2014-06-06T20:24:36.814618 #14]  WARN -- Synapse::ZookeeperWatcher: synapse: no backends for service application; using default servers: {"name"=>"default-app", "host"=>"111.111.111.111", "port"=>443}
I, [2014-06-06T20:24:36.817710 #14]  INFO -- Synapse::Synapse: synapse: regenerating haproxy config
E, [2014-06-06T20:24:36.818293 #14] ERROR -- Synapse::Synapse: synapse: encountered unexpected exception #<NoMethodError: undefined method `shuffle' for {"name"=>"default-app", "host"=>"111.111.111.111", "port"=>443}:Hash> in main thread
W, [2014-06-06T20:24:36.818395 #14]  WARN -- Synapse::Synapse: synapse: exiting; sending stop signal to all watchers
W, [2014-06-06T20:24:36.818452 #14]  WARN -- Synapse::ZookeeperWatcher: synapse: zookeeper watcher exiting
I, [2014-06-06T20:24:36.830512 #14]  INFO -- Synapse::ZookeeperWatcher: synapse: zookeeper watcher cleaned up successfully
/usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse/haproxy.rb:654:in `generate_backend_stanza': undefined method `shuffle' for {"name"=>"default-app", "host"=>"111.111.111.111", "port"=>443}:Hash (NoMethodError)
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse/haproxy.rb:551:in `block in generate_config'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse/haproxy.rb:548:in `each'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse/haproxy.rb:548:in `generate_config'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse/haproxy.rb:534:in `update_config'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse.rb:45:in `block in run'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse.rb:37:in `loop'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/lib/synapse.rb:37:in `run'
    from /usr/local/lib/ruby/gems/2.1.0/gems/synapse-0.10.0/bin/synapse:60:in `<top (required)>'
    from /usr/local/bin/synapse:23:in `load'
    from /usr/local/bin/synapse:23:in `<main>'
igor47 commented 10 years ago

default servers should be a list; see this example, here: https://github.com/airbnb/synapse/blob/master/config/synapse.conf.json#L4-L10

based on the error message, i think you made it into a plan hash.

we should really let you know sooner if you don't configure it as a list. feel free to submit a PR to do this validation, or i'll get around to it sometime next week.