Removing a network leaks its DNS listener: next network on the same subnet fails with 'dns bind: Address in use'

Open
#248 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
linux, rust

Research direction

Start by tracing how kiri creates and removes networks and manages the DNS listener bound to the gateway address; the issue does not name source files or tests. Check the cleanup path after network removal and after a container start failure, then run the relevant network lifecycle tests. Done means both cases release the listener so another network can bind the same address.

Written by the indexing model from the issue text.

Description

Environment

  • Kiri engine 0.2.0, Linux x86-64, kernel 7.3
  • Docker Compose with a project that creates its own networks

What happens
After a user-created network has hosted a container and is then removed, kiri keeps the network's DNS listener bound on the gateway address (<subnet>.0.1:53/udp). A new network that gets the same subnet can no longer start any container:

docker: Error response from daemon: run <id>: dns: dns bind: Address in use (os error 98)

I also saw it on a Compose network that had a container fail to start once. After that, every start on that network failed with the same error.

Observed

  • ss -lun | grep ':53 ' still shows 172.24.0.1:53 after docker network rm of the network that used that subnet.
  • A new network gets 172.21.0.0/16 (the lowest free subnet), and every container on it fails with dns bind: Address in use.
  • Creating an empty placeholder network on the burned subnet makes later networks pick a different subnet, so it is a workaround.

Repro (as observed)

  1. docker network create n1 and note its subnet (for example 172.24.0.0/16).
  2. docker run --rm --network n1 alpine true (works).
  3. docker network rm n1.
  4. ss -lun | grep '172.24.0.1:53' still shows a listener.
  5. docker network create n2. If it gets the same subnet, docker run --rm --network n2 alpine true fails with dns: dns bind: Address in use (os error 98).

I could only confirm step 5 for a subnet whose first container had failed to start; I did not retest it on a clean subnet.

Expected: removing a network releases its DNS listener, and a failed container start does not leave one behind.

Dominant language
Rust
Stars
7.5k
Forks
329
Avg merge
7h 48m
Merged PRs (30d)
105

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from libracoder/kiri

All issues in libracoder/kiri

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.