-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 0d5feff
Showing
5 changed files
with
79 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
FROM elixir:1.6.6-alpine | ||
|
||
RUN mkdir /app | ||
WORKDIR /app | ||
COPY . . | ||
RUN mix do local.hex --force, deps.get, compile |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
### Swarm deadlock repro | ||
|
||
This repository serves as a repro for bitwalker/swarm#91 . | ||
To start reproducing, simply run: | ||
|
||
```sh | ||
docker-compose up --scale repro=5 | ||
``` | ||
|
||
This command will build a docker image with the compiled repro Elixir application, | ||
and run 5 instances of the image. All the application does is start `Swarm` and | ||
`Libcluster` with `Cluster.Strategy.Gossip` topology. A single process on each | ||
node prints state of the local `Swarm.Tracker` process. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
version: '2' | ||
services: | ||
repro: | ||
build: . | ||
command: ['sh', '-c', 'iex --cookie mycookie --name "node@$$(hostname -i)" -S mix'] | ||
This comment has been minimized.
Sorry, something went wrong. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
defmodule TrackerStateMonitor do | ||
use Task, restart: :permanent | ||
|
||
def start_link(_args) do | ||
Task.start_link(fn -> | ||
Stream.repeatedly(fn -> Process.sleep(5000) end) | ||
|> Enum.each(fn _ -> | ||
{state, _} = :sys.get_state(Swarm.Tracker) | ||
IO.puts("Swarm.Tracker state: #{state}") | ||
end) | ||
end) | ||
end | ||
end | ||
|
||
defmodule MyApp do | ||
use Application | ||
|
||
@impl Application | ||
def start(_type, _args) do | ||
Supervisor.start_link([ | ||
{Cluster.Supervisor, | ||
[[local: [strategy: Cluster.Strategy.Gossip]], [name: MyApp.ClusterSupervisor]]}, | ||
{TrackerStateMonitor, []} | ||
], strategy: :one_for_one) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
defmodule MyApp.MixProject do | ||
use Mix.Project | ||
|
||
def project do | ||
[ | ||
app: :my_app, | ||
version: "0.1.0", | ||
elixir: "~> 1.6", | ||
start_permanent: Mix.env() == :prod, | ||
deps: deps() | ||
] | ||
end | ||
|
||
# Run "mix help compile.app" to learn about applications. | ||
def application do | ||
[ | ||
extra_applications: [:logger, :sasl], | ||
mod: {MyApp, []} | ||
] | ||
end | ||
|
||
# Run "mix help deps" to learn about dependencies. | ||
defp deps do | ||
[ | ||
{:libcluster, "~> 3.0"}, | ||
{:swarm, "~> 3.3"} | ||
] | ||
end | ||
end |
$
has to be escaped in docker-compose.yml, otherwise docker-compose tries to substitute it