bitseq: Unselected() does not check datastore
Open
@abhi is already working on this.
Since Sep 5, 2017.
- Dominant language
- Go
- Stars
- 2.2k
- Forks
- 875
- PR merge metrics
- No merged PRs in 30d
Description
The problem
When calling RequestAddress on an IPAM, the ErrNoAvailableIPs error can be raised even if there are remaining addresses when some conditions are met.
This comes from the h.Unselected() <= 0 condition beeing checked on the bitmask without synchronizing it with the datastore first (ipam/allocator.go:534).
How to reproduce
The bug was found when using a swarm legacy cluster with a consul datastore (Docker version 17.05.0-ce).
- Create an overlay network small with a small enough IP range.
- On a first node, start as much containers as the network allows it.
- On a second node, try to start a container on this network => "no available IPv4 addresses". Now the local bitseq is synchronised with consul. The IPAM's
Alllocatoris such thata.addresses[k].Unselected() == 0,kbeeing the network subnet - On node n°1, stop one (or more) of the containers. The bitmask in the consul datastore is now correctly updated, but node n°2 was not notified of this in any way.
- On node n °2, try to start a container again => same error message. We still have
a.addresses[k].Unselected() == 0and no call to consul is made to refresh the bitmask. From this point this is impossible to start any container on the network using this node. Restarting the docker daemon fixes the problem.
I'll submit a (naive) patch to handle this problem soon.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.