weaveworks / weave

Simple, resilient multi-host containers networking and more.
https://www.weave.works
Apache License 2.0
6.62k stars 668 forks source link

Race condition on container run #647

Closed bergtwvd closed 9 years ago

bergtwvd commented 9 years ago

I have a set of containers that all interconnect on a weave network. Some may be located on my PC, others in e.g. the AWS cloud. This generally works fine, but I noticed a situation where a container fails to connect on a weave IP address.

Typically I start a new container with: C=$(weave run 10.2.1.4/24 -ti myname/mycomponent -c 10.2.1.2)

where 10.2.1.2 is the address of a central component.

Each container contains a component that registers itself at a central component. It does this right away when it starts. However, sometimes it seems that weave has not set up the IP addressing for the new container yet, so the container fails to connect to the central component.

I tried "docker create ..." to create the new contrainer (without running it yet), then do a "weave attach 10.2.1.4/24 ...", followed by "docker start ...". But weave does not accept this.

The workaround I use now is to do a "sleep" for x seconds inside the container, before it connects to the central component. Obviously this is not the ideal solution, because it makes containers aware of their environment constraints.

rade commented 9 years ago

This is a dup of #47.

bergtwvd commented 9 years ago

47 is a long thread. What is the conclusion / advice at this point in time?

rade commented 9 years ago

a. introduce a 'smart sleep' b. run powerstrip-weave c. configure to use the weave bridge

bergtwvd commented 8 years ago

Weave has evolved further (1.2 +). Is the above work around still needed?

rade commented 8 years ago

47 got resolved in weave 0.11 with the introduction of the weave proxy.