Extend the timeout for dead containers to 30 seconds,
but remove them if they are destroyed, to reduce starvation when users are creating and destroying containers quickly.
This commit is contained in:
1 parent
b2b293a8ee
commit
e468399616
4 files changed
+15
-3
No files matched your search
+1
-1
@@ -23,7 +23,7 @@ const (
|
||||
|
||||
tickInterval = time.Second * 5
|
||||
MinSubnetSize = 4 // first and last addresses are excluded, so 2 would be too small
|
||||
containerDiedTimeout = time.Second * 5
|
||||
containerDiedTimeout = time.Second * 30
|
||||
)
|
||||
|
||||
// operation represents something which Allocator wants to do, but
|
||||
|
||||
+1
-1
@@ -181,7 +181,7 @@ current IP addresses:
|
||||
host1$ weave restart b1
|
||||
|
||||
(note that the IP addresses are held for a limited time - currently
|
||||
five seconds)
|
||||
30 seconds)
|
||||
|
||||
### <a name="naming-and-discovery"></a>Naming and discovery
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ assert_raises "exec_on $HOST1 c5 $PING $C6"
|
||||
# check that restart retains the same IP, and reclaims it in IPAM
|
||||
weave_on $HOST2 restart c6
|
||||
assert_raises "exec_on $HOST1 c5 $PING $C6"
|
||||
sleep 6 # past the IPAM timeout
|
||||
sleep 31 # past the IPAM timeout
|
||||
start_container $HOST2 net:$SUBNET_2 --name=c7
|
||||
C7=$(container_ip $HOST2 c7)
|
||||
assert_raises "[ $C6 != $C7 ]"
|
||||
|
||||
@@ -21,6 +21,16 @@ wait_for_proxy() {
|
||||
exit 1
|
||||
}
|
||||
|
||||
N=50
|
||||
# Create and remove a lot of containers in a small subnet; the failure
|
||||
# mode is that this takes a long time as it has to wait for the old
|
||||
# ones to time out, so we run this function inside 'timeout'
|
||||
run_many() {
|
||||
for i in $(seq $N); do
|
||||
proxy docker_on $HOST1 run -e WEAVE_CIDR=net:10.32.4.0/28 --rm -t $SMALL_IMAGE /bin/true
|
||||
done
|
||||
}
|
||||
|
||||
start_suite "Proxy restart reattaches networking to containers"
|
||||
|
||||
WEAVE_DOCKER_ARGS=--restart=always WEAVEPROXY_DOCKER_ARGS=--restart=always weave_on $HOST1 launch
|
||||
@@ -49,6 +59,8 @@ sleep 5 # allow for re-tries of attach
|
||||
C2=$(container_ip $HOST1 c2) || (echo "container c2 has no IP address" 2>&1; exit 1)
|
||||
check_attached
|
||||
|
||||
assert_raises "timeout 90 cat <( run_many )"
|
||||
|
||||
# Restarting proxy shouldn't kill unattachable containers
|
||||
proxy_start_container $HOST1 -di --name=c3 --restart=always # Use ipam, so it won't be attachable w/o weave
|
||||
weave_on $HOST1 stop
|
||||
|
||||
Reference in new issue
Block a user