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

Node Whitelisting doesn't prevent the unexpected nodes into Swarm's clustering #31

Closed
xinz opened this issue Mar 29, 2017 · 2 comments
Closed

Comments

@xinz
Copy link
Contributor

xinz commented Mar 29, 2017

Hi,

I'm new to Swarm, I find the following case doesn't work as expected, please advise if any misunderstanding.

1, Here is node whitelist config in config.exs:

config :swarm,
  debug: true,
  node_whitelist: [~r/^app[\d]@.*$/]

2, Here is libcluster config in dev.exs:

config :libcluster,
  topologies: [
    main: [
    strategy: Cluster.Strategy.Epmd,
    config: [hosts: [:"app1@server"]],
    connect: {:net_kernel, :connect, []},
  ]
]

3, I run the following commands to setup nodes in order
$iex --sname app1 -S mix
$iex --sname unknown -S mix

4, Refer the Example in https://hexdocs.pm/swarm/readme.html , I start some workers in unknown node, and then I find some workers started in app1 node as expected, but some workers started in unknown node as unexpected, why the Swarm's distribution algorithm will use the excluded nodes (NOT in node whitelist) to register workers?

Hex env:
Hex: 0.15.0
Elixir: 1.4.2
OTP: 19.2.3

Deps tree:
├── libcluster ~> 2.0 (Hex package)
│ └── poison ~> 3.0 (Hex package)
├── timex ~> 3.0 (Hex package)
│ ├── combine ~> 0.7 (Hex package)
│ ├── gettext ~> 0.10 (Hex package)
│ └── tzdata ~> 0.1.8 or ~> 0.5 (Hex package)
│ └── hackney ~> 1.0 (Hex package)
│ ├── certifi 1.0.0 (Hex package)
│ ├── idna 4.0.0 (Hex package)
│ ├── metrics 1.0.1 (Hex package)
│ ├── mimerl 1.0.2 (Hex package)
│ └── ssl_verify_fun 1.1.1 (Hex package)
├── sweet_xml ~> 0.6.5 (Hex package)
├── httpoison ~> 0.11.0 (Hex package)
│ └── hackney ~> 1.7.0 (Hex package)
├── swarm ~> 3.0 (Hex package)
│ ├── gen_state_machine ~> 2.0 (Hex package)
│ └── libring ~> 1.0 (Hex package)
└── distillery ~> 1.0 (Hex package)

Thanks

@xinz
Copy link
Contributor Author

xinz commented Mar 29, 2017

Here's a PR for this fix, hope it makes sense #32

@xinz
Copy link
Contributor Author

xinz commented Mar 29, 2017

Currently, clone the latest code from master branch, I occurred this issue

13:36:06.259 [error] GenStateMachine Swarm.Tracker terminating
** (ErlangError) erlang error: {:"module could not be loaded", Swarm.Distribution.Strategy.Ring}
    (swarm) lib/swarm/distribution/strategy.ex:40: Swarm.Distribution.Strategy.create/1
    (swarm) lib/swarm/tracker/tracker.ex:124: Swarm.Tracker.init/1
    (stdlib) gen_statem.erl:626: :gen_statem.init_it/6
    (stdlib) proc_lib.erl:247: :proc_lib.init_p_do_apply/3
State: :undefined
Callback mode: :undefined

I modify this line in distribution/strategy.ex to resolve it, or rename module name "Swarm.Distribution.Ring" in distribution/ring.ex.

-alias Swarm.Distribution.Strategy.Ring, as: RingStrategy
+alias Swarm.Distribution.Ring, as: RingStrategy

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