Docker swarm TCP client service goes to SYN_SENT after TCP listener service restarts and changes IP

I have a ZeroMQ based logging service, which listens on port 20000 for connections from other services(clients).
The whole setup works fine when the clients connect by tcp://logger_svc:20000, but if the logger_svc restarts and gets another IP, the established connections from all clients go to this state:


And they remain so indefinetelly.

I tried ipconfig /flushdns but it didn’t help. nslookup logger_svc inside client container returns the new IP.
Nothing helps short of restarting the client services.

The logger_svc is in its own stack/compose file, but it shares the same overlay network with the clients, and has full connectivity until restarted.

The issue in this case was with Windows Server DNS cache service, this helped:

New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name MaxCacheTtl -Value 0 -Type DWord
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\Dnscache\Parameters' -Name MaxNegativeCacheTtl -Value 0 -Type DWord