WiFi AP gives out same IP address to 2 stations

I’m using mos/mongoose-os 2.14 on ESP32 WROVER module - 8MB flash, 8MB PSRAM.

I have setup mos.yml with [“wifi.ap.enable”, true] and all the defaults. Stations can connect just fine. But when 2 or more stations connect within a 5 second period, they will sometimes get assigned the same IP address!

I think this is a race condition with a global variable. Perhaps a global variable in the DHCP server code is used to assign the next available IP address in the pool. If multiple stations connect roughly at the same time, the DHCP assignment isn’t complete for the first one and the global variable isn’t updated during the time the second station connects. So they both get the same value of “next available IP address”.

Has anyone else seen this problem? And any idea how to fix it?