List leases is out of date

I’m having trouble with the lxc network list-leases lxdfan0 command

In my container list I have the following

+---------------------+---------+--------------------+------+-----------+-----------+-----------------+
|        NAME         |  STATE  |        IPV4        | IPV6 |   TYPE    | SNAPSHOTS |    LOCATION     |
+---------------------+---------+--------------------+------+-----------+-----------+-----------------+
| rdio-staging-web-01 | RUNNING | 240.4.0.96 (eth0)  |      | CONTAINER | 0         | upmaru-stage-01 |
+---------------------+---------+--------------------+------+-----------+-----------+-----------------+
| uplink-stage-01     | RUNNING | 240.4.0.252 (eth0) |      | CONTAINER | 0         | upmaru-stage-01 |
+---------------------+---------+--------------------+------+-----------+-----------+-----------------+
| uplink-stage-02     | RUNNING | 240.2.0.137 (eth0) |      | CONTAINER | 0         | upmaru-stage-02 |
+---------------------+---------+--------------------+------+-----------+-----------+-----------------+
| uplink-stage-03     | RUNNING | 240.3.0.11 (eth0)  |      | CONTAINER | 0         | upmaru-stage-03 |
+---------------------+---------+--------------------+------+-----------+-----------+-----------------+
| xcaddy-test         | RUNNING | 240.2.0.78 (eth0)  |      | CONTAINER | 0         | upmaru-stage-02 |
+---------------------+---------+--------------------+------+-----------+-----------+-----------------+

however when i run the list-leases i get the following:

+-----------------+-------------------+-------------+---------+-----------------+
|    HOSTNAME     |    MAC ADDRESS    | IP ADDRESS  |  TYPE   |    LOCATION     |
+-----------------+-------------------+-------------+---------+-----------------+
| uplink-stage-01 | 00:16:3e:59:dc:32 | 240.4.0.252 | DYNAMIC | upmaru-stage-01 |
+-----------------+-------------------+-------------+---------+-----------------+
| uplink-stage-02 | 00:16:3e:88:64:e5 | 240.2.0.137 | DYNAMIC | upmaru-stage-02 |
+-----------------+-------------------+-------------+---------+-----------------+
| uplink-stage-03 | 00:16:3e:4e:4f:3d | 240.3.0.11  | DYNAMIC | upmaru-stage-03 |
+-----------------+-------------------+-------------+---------+-----------------+
| xcaddy-test     | 00:16:3e:f7:16:01 | 240.2.0.78  | DYNAMIC | upmaru-stage-02 |
+-----------------+-------------------+-------------+---------+-----------------+

one container is missing

An update on this. When I restarted the container, it showed up in the leases

Are you able to reproduce the issue? It maybe that dnsmasq hadn’t flushed the lease to the leases file that LXD reads from.

This happens from time to time. I think I’m using the API a lot, I’ve noticed it happens when many operations are done together. But a restart of the container generally solves the problem.

Are you able to produce a reproducer script we can use to diagnose the problem?

@tomp I have the code on a github repository but it’s written in elixir.

In this routine I do the following

  1. Create the instance
  2. Start the instance
  3. Setup the instance

Which executes the following

And then it goes on to execute this

I’ve noticed from time to time when things go abit too fast sometimes there is no network available. So I wrote it to retry after sometime. Then it works.

Thanks.

I’m not familiar with Elixir I’m afraid.

Do you see it with using lxc commands directly?

If I come across it with lxd commands will let you know. As of now I haven’t run into it yet.