Independent work / Technical investigation
Tracing a container connectivity failure.
Docker DNS, Node.js and Undici
A containerized application could resolve a service name through a direct DNS query, yet its HTTP client consistently stalled when attempting to connect. I investigated the discrepancy, implemented a targeted resolver override, and validated the remediation inside the deployed container environment.
Investigation overview
While operating a self-hosted installation of the open-source SUB/WAVE project, I encountered connection failures between its Node.js controller and Navidrome, the music library service. Both applications operated within a Docker-based Linux environment.
The investigation focused on determining why the application could not establish a reliable HTTP connection despite successful direct DNS resolution of the destination.
01 / Problem definition
The Subwave controller communicates with Navidrome through its Subsonic-compatible HTTP API. Connections to the Docker service hostname stalled, preventing reliable communication between the applications.
The challenge was to distinguish between network reachability, service availability, DNS resolution, application authentication, and HTTP client behavior without introducing unnecessary infrastructure changes.
02 / Investigation and isolation
I compared hostname-based connections, direct-address connections, independent HTTP clients, and DNS resolution methods from within the container environment.
Direct IPv4 resolution using Node.js resolve4 returned an address for Navidrome. However, the connection path used by the application could still stall when resolving and connecting to the same hostname.
| Diagnostic area | Finding |
|---|---|
| Service availability | Navidrome responded through alternative connection paths. |
| Direct IPv4 resolution | The service hostname returned an IPv4 address. |
| Application connection | The original hostname-based HTTP connection stalled. |
| Investigation scope | Application-level connection and resolver behavior. |
These observations narrowed the investigation to the application's connection and name-resolution path rather than establishing a general failure of Docker networking or DNS.
03 / Engineering constraints
A static container IP could bypass the observed problem, but would introduce a brittle dependency on Docker's address allocation. Container recreation or network changes could invalidate that address.
The remediation needed to preserve dynamic service discovery, avoid unnecessary changes to other destinations, handle resolution errors, and remain reproducible across container restarts.
04 / Targeted remediation
I implemented an Undici Agent with a custom connection lookup function. The dispatcher uses explicit IPv4 DNS resolution when connecting to Navidrome and delegates other hostnames to Node's normal dns.lookup behavior.
Selected excerpt from the deployed dispatcher
const agent = new Agent({
connect: {
lookup(hostname, options, callback) {
if (hostname !== 'navidrome') {
return dns.lookup(hostname, options, callback);
}
dns.resolve4(hostname, (error, addresses) => {
if (error) {
return callback(error);
}
if (!addresses.length) {
const err = new Error(
'No IPv4 address for navidrome'
);
err.code = 'ENOTFOUND';
return callback(err);
}
const results = addresses.map(address => ({
address,
family: 4
}));
if (options?.all) {
callback(null, results);
} else {
callback(null, results[0].address, 4);
}
});
}
}
});
setGlobalDispatcher(agent);
The lookup implementation accommodates both single-address and multiple-address callback formats. Resolution failures propagate to the caller instead of being silently suppressed.
Although the dispatcher is installed globally within the Node.js process, the custom resolver behavior is restricted to the Navidrome hostname.
05 / Deployment and reproducibility
Rather than modifying the running container's application files, I deployed the dispatcher as an externally maintained CommonJS preload, mounted into the container through Docker configuration.
NODE_OPTIONS=--require=/app/patches/navidrome-ipv4.cjs
Container inspection confirmed both the preload configuration and the mounted patch. This approach keeps the remediation separate from the container image and allows it to be reapplied when the container is recreated.
A startup message provides additional evidence that the dispatcher has been installed in the Node.js process.
[subwave] Navidrome IPv4 DNS dispatcher installed
06 / Validation and measured results
On November 28, 2026, I executed ten sequential HTTP requests from a Node.js process inside the deployed Subwave controller container. Each request targeted Navidrome using its Docker service hostname with a five-second request deadline.
| Request | HTTP status | Elapsed time |
|---|---|---|
| 1 | 200 | 17 ms |
| 2 | 200 | 2 ms |
| 3 | 200 | 2 ms |
| 4 | 200 | 1 ms |
| 5 | 200 | 2 ms |
| 6 | 200 | 1 ms |
| 7 | 200 | 1 ms |
| 8 | 200 | 1 ms |
| 9 | 200 | 3 ms |
| 10 | 200 | 1 ms |
All ten requests returned HTTP 200 without connection failures. The initial request completed in 17 milliseconds, while subsequent requests completed in one to three milliseconds. Median elapsed time across the sample was 1.5 milliseconds.
These measurements demonstrate successful HTTP connectivity through the deployed dispatcher during the validation window.
07 / Limitations and lessons learned
The underlying cause of the original system resolver stall remains unconfirmed. The remediation addresses the observed failure mode without establishing a definitive upstream defect in Node.js, Undici, Docker, or the operating system.
The validation was performed using a separate Node.js process inside the controller container. HTTP 200 responses confirm connectivity but do not independently establish successful Subsonic authentication or application-level correctness. Connection reuse may also explain the lower latency of subsequent requests.
Further validation should include fresh-connection testing, authenticated application requests, container recreation, and longer-duration operational monitoring.
The central lesson is that successful DNS resolution in one diagnostic tool does not establish successful resolution and connection behavior in every application. Testing the actual client path is essential when isolating layered system failures.
Independent work / Plain English
Container DNS and Undici
Finding out why two programs couldn't talk.
What was the problem?
Imagine knowing someone's name but having trouble calling them, even though their phone works perfectly. Two of my computer programs had a similar problem.
What did I discover?
Different ways of connecting to the same service produced different results. Some connections worked while others became stuck.
What did I change?
I changed how one program looked up the address of the other, without changing how it connected to everything else. The modified connection passed ten follow-up tests.
Why does it matter?
Instead of replacing everything or guessing, I narrowed the problem down and tested a small, targeted change.
Independent work / Stone Age
Rock cannot find other rock.
Technology. But rock.
Rock know other rock name.
Rock call. No answer.
Other rock not dead. Other rock work fine.
Me change how rock find other rock.
Ten test. Ten work.
Good rock.