[GH-ISSUE #408] DPS Network autoconnect stops working #142

Closed
opened 2026-02-26 04:34:10 +03:00 by kerem · 8 comments
Owner

Originally created by @Sajito on GitHub (Apr 4, 2023).
Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/408

Originally assigned to: @mageddo on GitHub.

What is Happening / What is expected

I'm using dps in a docker container with the dps network and auto connect features enabled. After the startup everything works fine, new containers are detected and added to the network. Also the logs are written, that containers were added to the network.
But after some time, new containers are not added to the network anymore. Nothing appears in the logs. There are no errors or messages regarding docker events.
The dns itself is working fine and the logging itself seems to work also. It's only that new containers are not registered in any way. Maybe the event listener closes silently in the background or something?
I don't know how to provide information on how to reproduce this, as it seems to happen randomly. Sometimes it happens after 10 minutes, sometimes it works fine for an hour.

Specs

  • OS: EndeavourOS
  • Docker Version:
    Client:
     Version:           23.0.2
     API version:       1.42
     Go version:        go1.20.2
     Git commit:        569dd73db1
     Built:             Sun Apr  2 11:30:09 2023
     OS/Arch:           linux/amd64
     Context:           default
    
    Server:
     Engine:
      Version:          23.0.2
      API version:      1.42 (minimum version 1.12)
      Go version:       go1.20.2
      Git commit:       219f21bf07
      Built:            Sun Apr  2 11:30:09 2023
      OS/Arch:          linux/amd64
      Experimental:     false
     containerd:
      Version:          v1.7.0
      GitCommit:        1fbd70374134b891f97ce19c70b6e50c7b9f4e0d.m
     runc:
      Version:          1.1.5
      GitCommit:        
     docker-init:
      Version:          0.19.0
      GitCommit:        de40ad0
    
  • DPS Version: 3.15.9-snapshot
Originally created by @Sajito on GitHub (Apr 4, 2023). Original GitHub issue: https://github.com/mageddo/dns-proxy-server/issues/408 Originally assigned to: @mageddo on GitHub. ### What is Happening / What is expected I'm using dps in a docker container with the dps network and auto connect features enabled. After the startup everything works fine, new containers are detected and added to the network. Also the logs are written, that containers were added to the network. But after some time, new containers are not added to the network anymore. Nothing appears in the logs. There are no errors or messages regarding docker events. The dns itself is working fine and the logging itself seems to work also. It's only that new containers are not registered in any way. Maybe the event listener closes silently in the background or something? I don't know how to provide information on how to reproduce this, as it seems to happen randomly. Sometimes it happens after 10 minutes, sometimes it works fine for an hour. ### Specs * OS: EndeavourOS * Docker Version: ``` Client: Version: 23.0.2 API version: 1.42 Go version: go1.20.2 Git commit: 569dd73db1 Built: Sun Apr 2 11:30:09 2023 OS/Arch: linux/amd64 Context: default Server: Engine: Version: 23.0.2 API version: 1.42 (minimum version 1.12) Go version: go1.20.2 Git commit: 219f21bf07 Built: Sun Apr 2 11:30:09 2023 OS/Arch: linux/amd64 Experimental: false containerd: Version: v1.7.0 GitCommit: 1fbd70374134b891f97ce19c70b6e50c7b9f4e0d.m runc: Version: 1.1.5 GitCommit: docker-init: Version: 0.19.0 GitCommit: de40ad0 ``` * DPS Version: `3.15.9-snapshot`
kerem 2026-02-26 04:34:10 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@mageddo commented on GitHub (Apr 5, 2023):

Please provide the command you are using to run DPS.

Also enable the DEBUG log and be aware of the log "status=event, id={}, action={}, type={}, status={}, event={}", it's supposed to log every time a container is created or destroyed, status=connected, networkNameOrId is also supposed to be logged in sequence or some leak could be happening between the event listening and the action taken.

If you can't see that log after the "new containers are not added to the network anymore." then lack of event trigger can be the root cause.

I'll make some tests at the event listener

<!-- gh-comment-id:1496910817 --> @mageddo commented on GitHub (Apr 5, 2023): Please provide the command you are using to run DPS. Also enable the DEBUG log and be aware of the log `"status=event, id={}, action={}, type={}, status={}, event={}"`, it's supposed to log every time a container is created or destroyed, `status=connected, networkNameOrId` is also supposed to be logged in sequence or some leak could be happening between the event listening and the action taken. If you can't see that log after the "new containers are not added to the network anymore." then lack of event trigger can be the root cause. I'll make some tests at the event listener
Author
Owner

@Sajito commented on GitHub (Apr 5, 2023):

I'm using this docker-compose snippet, to run DPS.

version: '3.6'

services:
  dns:
    image: defreitas/dns-proxy-server:3.15.9-snapshot
    restart: unless-stopped
    volumes:
      - /var/run/docker.sock:/var/run/docker.sock
    environment:
      MG_DPS_NETWORK: true
      MG_DPS_NETWORK_AUTO_CONNECT: true

This is the config I'm using currently.

{
  "version": 2,
  "activeEnv": "",
  "webServerPort": null,
  "dnsServerPort": null,
  "defaultDns": false,
  "logLevel": null,
  "logFile": null,
  "registerContainerNames": null,
  "hostMachineHostname": null,
  "domain": null,
  "dpsNetwork": null,
  "dpsNetworkAutoConnect": null,
  "remoteDnsServers": [],
  "envs": [
    {
      "name": "",
      "hostnames": []
    }
  ]
}

I've enabled the DEBUG log and initially the logs are printed as described, but when the containers are not added anymore, the logs don't contain the "status=event" log anymore. Since the full log exceeded 10MB, I have cleared the log file and reproduced the issue. Here is the log of that period, I can't find anything related to docker events in that snippet.
log.log

<!-- gh-comment-id:1497216766 --> @Sajito commented on GitHub (Apr 5, 2023): I'm using this docker-compose snippet, to run DPS. ``` version: '3.6' services: dns: image: defreitas/dns-proxy-server:3.15.9-snapshot restart: unless-stopped volumes: - /var/run/docker.sock:/var/run/docker.sock environment: MG_DPS_NETWORK: true MG_DPS_NETWORK_AUTO_CONNECT: true ``` This is the config I'm using currently. ``` { "version": 2, "activeEnv": "", "webServerPort": null, "dnsServerPort": null, "defaultDns": false, "logLevel": null, "logFile": null, "registerContainerNames": null, "hostMachineHostname": null, "domain": null, "dpsNetwork": null, "dpsNetworkAutoConnect": null, "remoteDnsServers": [], "envs": [ { "name": "", "hostnames": [] } ] } ``` I've enabled the DEBUG log and initially the logs are printed as described, but when the containers are not added anymore, the logs don't contain the "status=event" log anymore. Since the full log exceeded 10MB, I have cleared the log file and reproduced the issue. Here is the log of that period, I can't find anything related to docker events in that snippet. [log.log](https://github.com/mageddo/dns-proxy-server/files/11157455/log.log)
Author
Owner

@mageddo commented on GitHub (Apr 7, 2023):

I'm trying to reproduce the issue with the docker-compose.yml provided and the following docker stack.

This command will start a container, keep it alive for 3 seconds then it will die and start another one, it would be great if you check if it will also cause the issue for you.

$ while [ true ] ; do docker run --rm alpine sleep 3 ; done

My docker version is different from yours, if I couldn't get the issue then it can be the cause.

Client:
 Version:           20.10.14
 API version:       1.41
 Go version:        go1.16.15
 Git commit:        a224086
 Built:             Thu Mar 24 01:45:09 2022
 OS/Arch:           linux/amd64
 Context:           default
 Experimental:      true

Server: Docker Engine - Community
 Engine:
  Version:          20.10.14
  API version:      1.41 (minimum version 1.12)
  Go version:       go1.16.15
  Git commit:       87a90dc
  Built:            Thu Mar 24 01:49:54 2022
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          v1.5.11
  GitCommit:        3df54a852345ae127d1fa3092b95168e4a88e2f8
 runc:
  Version:          1.0.3
  GitCommit:        v1.0.3-0-gf46b6ba2
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

For 5 minutes, no issue:

408-dns-1  | 16:50:14.978 [stream-69888102] DEB com.mageddo.dnsproxyserver.docker.EventListener   l=60   m=onNext                          status=event, id=d0294f04634718bdf2718d26c39c4b0e2663f35038f99c87655581bb52967905, action=start, type=CONTAINER, status=start, event=Event(status=start, id=d0294f04634718bdf2718d26c39c4b0e2663f35038f99c87655581bb52967905, from=alpine, node=null, type=CONTAINER, action=start, actor=EventActor(id=d0294f04634718bdf2718d26c39c4b0e2663f35038f99c87655581bb52967905, attributes={image=alpine, name=busy_mirzakhani}), time=1680886214, timeNano=1680886214978251780)
408-dns-1  | 16:50:15.270 [stream-69888102] INF c.m.dnsproxyserver.docker.DockerNetworkDAODefault l=92   m=connect                         status=connected, networkNameOrId=dps, containerId=d0294f04634718bdf2718d26c39c4b0e2663f35038f99c87655581bb52967905

<!-- gh-comment-id:1500456762 --> @mageddo commented on GitHub (Apr 7, 2023): I'm trying to reproduce the issue with the docker-compose.yml provided and the following docker stack. This command will start a container, keep it alive for 3 seconds then it will die and start another one, it would be great if you check if it will also cause the issue for you. ```bash $ while [ true ] ; do docker run --rm alpine sleep 3 ; done ``` My docker version is different from yours, if I couldn't get the issue then it can be the cause. ``` Client: Version: 20.10.14 API version: 1.41 Go version: go1.16.15 Git commit: a224086 Built: Thu Mar 24 01:45:09 2022 OS/Arch: linux/amd64 Context: default Experimental: true Server: Docker Engine - Community Engine: Version: 20.10.14 API version: 1.41 (minimum version 1.12) Go version: go1.16.15 Git commit: 87a90dc Built: Thu Mar 24 01:49:54 2022 OS/Arch: linux/amd64 Experimental: false containerd: Version: v1.5.11 GitCommit: 3df54a852345ae127d1fa3092b95168e4a88e2f8 runc: Version: 1.0.3 GitCommit: v1.0.3-0-gf46b6ba2 docker-init: Version: 0.19.0 GitCommit: de40ad0 ``` For 5 minutes, no issue: ``` 408-dns-1 | 16:50:14.978 [stream-69888102] DEB com.mageddo.dnsproxyserver.docker.EventListener l=60 m=onNext status=event, id=d0294f04634718bdf2718d26c39c4b0e2663f35038f99c87655581bb52967905, action=start, type=CONTAINER, status=start, event=Event(status=start, id=d0294f04634718bdf2718d26c39c4b0e2663f35038f99c87655581bb52967905, from=alpine, node=null, type=CONTAINER, action=start, actor=EventActor(id=d0294f04634718bdf2718d26c39c4b0e2663f35038f99c87655581bb52967905, attributes={image=alpine, name=busy_mirzakhani}), time=1680886214, timeNano=1680886214978251780) 408-dns-1 | 16:50:15.270 [stream-69888102] INF c.m.dnsproxyserver.docker.DockerNetworkDAODefault l=92 m=connect status=connected, networkNameOrId=dps, containerId=d0294f04634718bdf2718d26c39c4b0e2663f35038f99c87655581bb52967905 ```
Author
Owner

@mageddo commented on GitHub (Apr 7, 2023):

Didn't get the issue 2 hours later.

408-dns-1  | 18:20:38.662 [stream-69888102] DEB com.mageddo.dnsproxyserver.docker.EventListener   l=60   m=onNext                          status=event, id=500a201ef3a1843d5b2366366d63bceef33b490cabb8fbe9ee3b0ff282bd6984, action=start, type=CONTAINER, status=start, event=Event(status=start, id=500a201ef3a1843d5b2366366d63bceef33b490cabb8fbe9ee3b0ff282bd6984, from=alpine, node=null, type=CONTAINER, action=start, actor=EventActor(id=500a201ef3a1843d5b2366366d63bceef33b490cabb8fbe9ee3b0ff282bd6984, attributes={image=alpine, name=exciting_morse}), time=1680891638, timeNano=1680891638662064363)
408-dns-1  | 18:20:38.935 [stream-69888102] INF c.m.dnsproxyserver.docker.DockerNetworkDAODefault l=92   m=connect                         status=connected, networkNameOrId=dps, containerId=500a201ef3a1843d5b2366366d63bceef33b490cabb8fbe9ee3b0ff282bd6984

<!-- gh-comment-id:1500526126 --> @mageddo commented on GitHub (Apr 7, 2023): Didn't get the issue 2 hours later. ``` 408-dns-1 | 18:20:38.662 [stream-69888102] DEB com.mageddo.dnsproxyserver.docker.EventListener l=60 m=onNext status=event, id=500a201ef3a1843d5b2366366d63bceef33b490cabb8fbe9ee3b0ff282bd6984, action=start, type=CONTAINER, status=start, event=Event(status=start, id=500a201ef3a1843d5b2366366d63bceef33b490cabb8fbe9ee3b0ff282bd6984, from=alpine, node=null, type=CONTAINER, action=start, actor=EventActor(id=500a201ef3a1843d5b2366366d63bceef33b490cabb8fbe9ee3b0ff282bd6984, attributes={image=alpine, name=exciting_morse}), time=1680891638, timeNano=1680891638662064363) 408-dns-1 | 18:20:38.935 [stream-69888102] INF c.m.dnsproxyserver.docker.DockerNetworkDAODefault l=92 m=connect status=connected, networkNameOrId=dps, containerId=500a201ef3a1843d5b2366366d63bceef33b490cabb8fbe9ee3b0ff282bd6984 ```
Author
Owner

@mageddo commented on GitHub (Apr 7, 2023):

Got the issue, If a container already connected to DPS network stops and starts again, the event listener will hang and no new event will be able to be processed.

# Okay
$ docker run --name cobaia alpine sleep 10 
$ docker start cobaia
# further events won't be processed
$ docker run alpine sleep 10 
<!-- gh-comment-id:1500533201 --> @mageddo commented on GitHub (Apr 7, 2023): Got the issue, If a container already connected to DPS network stops and starts again, the event listener will hang and no new event will be able to be processed. ```bash # Okay $ docker run --name cobaia alpine sleep 10 $ docker start cobaia # further events won't be processed $ docker run alpine sleep 10 ```
Author
Owner

@mageddo commented on GitHub (Apr 7, 2023):

I'm releasing 3.15.12-snapshot with the fix right now, will be available in 10 minutes.

<!-- gh-comment-id:1500566997 --> @mageddo commented on GitHub (Apr 7, 2023): I'm releasing `3.15.12-snapshot` with the fix right now, will be available in 10 minutes.
Author
Owner

@mageddo commented on GitHub (Apr 12, 2023):

I'll consider this issue as fixed, please reopen it if the issue persists.

<!-- gh-comment-id:1506083038 --> @mageddo commented on GitHub (Apr 12, 2023): I'll consider this issue as fixed, please reopen it if the issue persists.
Author
Owner

@Sajito commented on GitHub (Apr 13, 2023):

Sorry, I forgot to reply here. Having no issues with this anymore. Thanks!

<!-- gh-comment-id:1506388524 --> @Sajito commented on GitHub (Apr 13, 2023): Sorry, I forgot to reply here. Having no issues with this anymore. Thanks!
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/dns-proxy-server-mageddo#142
No description provided.