Docker container unresponsive, cannot be stopped, only restarting Docker Desktop helps

I’m trying to run a PHP application in Docker (GitHub - dunglas/symfony-docker: A Docker-based installer and runtime for Symfony. Install: download and `docker compose up`.).
Everything works fine for a while, but for some inexplicable reason the container just randomly decides to become unresponsive.
image
At 14:51 I built and ran the container; made only a couple authorization requests to it from a frontend application (also running in Docker), but then all of a sudden, when reloading the frontend application (which makes a session check request to backend), it just didn’t load. I checked the Docker logs for both PHP and Caddy containers, but there was absolutely nothing there (the screenshot is from the PHP container).
I then tried to stop the entire thing; database and Caddy containers stopped fine, but PHP gave me this:

Container backend-php-1       Error while Stopping
Error response from daemon: cannot stop container: 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d: tried to kill container, but did not receive an exit event

The PHP container uses an entrypoint, which, from what I’ve read online, replaces the original process with a new one that should listen and respond correctly to SIGTERM etc commands, and if the container isn’t frozen like this, then stopping and restarting it works just fine.

This has happened a bunch of times before, and it is absolutely infuriating since there are no errors anywhere that I would look for them, and the error message when trying to stop the container doesn’t help in the least. It makes it unsustainable to work with, because it can freeze at any random point in time for no obvious reason whatsoever, and kills productivity as a result.

How do I find out what’s causing this, if it’s even possible? IT BETTER BE, I am SUPER pissed about this crap, Docker was supposed to make things better, not worse, but back in the day when I was configuring all the dev environment on my own machine everything worked perfectly fine, and in the rare cases when I did have some issues, they were nowhere near as annoying as this, and could be fixed in a few minutes.

To be clear, I am NOT looking for help on stopping the container, nobody cares about that, I want to prevent it from freezing all the time.

My environment:
Windows 11 Home
RAM: 32 GB of DDR4-3200
CPU: Ryzen 3900x
SSD: 2TB M.2 NVMe (OS, Docker and containers all running on it)

Update: I found some basically useless info in %APPDATA%\Local\Docker\log\vm\dockerd.log:

[2023-08-08T12:32:24.170980026Z][dockerd][I] time="2023-08-08T12:32:24.170607338Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:32:24.171059685Z][dockerd][I] time="2023-08-08T12:32:24.170693129Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:32:24.173559748Z][dockerd][I] time="2023-08-08T12:32:24.173423423Z" level=warning msg="Health check for container 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error: OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown"
[2023-08-08T12:32:30.265279748Z][dockerd][I] time="2023-08-08T12:32:30.265034048Z" level=info msg="Container failed to exit within 10s of signal 3 - using the force" container=1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d
[2023-08-08T12:32:34.196544652Z][dockerd][I] time="2023-08-08T12:32:34.196338486Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:32:34.196574488Z][dockerd][I] time="2023-08-08T12:32:34.196340099Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:32:34.199444681Z][dockerd][I] time="2023-08-08T12:32:34.199271046Z" level=warning msg="Health check for container 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error: OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown"
[2023-08-08T12:32:40.276649324Z][dockerd][I] time="2023-08-08T12:32:40.276399957Z" level=error msg="Container failed to exit within 10s of kill - trying direct SIGKILL" container=1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error="context deadline exceeded"
[2023-08-08T12:32:44.224535471Z][dockerd][I] time="2023-08-08T12:32:44.224339544Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:32:44.224611744Z][dockerd][I] time="2023-08-08T12:32:44.224343221Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:32:44.227361985Z][dockerd][I] time="2023-08-08T12:32:44.227216793Z" level=warning msg="Health check for container 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error: OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown"
[2023-08-08T12:32:44.277392791Z][dockerd][I] time="2023-08-08T12:32:44.277148803Z" level=error msg="error killing container: context deadline exceeded" container=1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error="tried to kill container, but did not receive an exit event"
[2023-08-08T12:32:44.277561347Z][dockerd][I] time="2023-08-08T12:32:44.277417557Z" level=error msg="Handler for POST /containers/1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d/restart returned error: Cannot restart container 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d: tried to kill container, but did not receive an exit event"
[2023-08-08T12:32:54.251017224Z][dockerd][I] time="2023-08-08T12:32:54.250808784Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:32:54.251095640Z][dockerd][I] time="2023-08-08T12:32:54.250819534Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:32:54.253571025Z][dockerd][I] time="2023-08-08T12:32:54.253438928Z" level=warning msg="Health check for container 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error: OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown"
[2023-08-08T12:33:04.279579296Z][dockerd][I] time="2023-08-08T12:33:04.279393739Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:04.279613991Z][dockerd][I] time="2023-08-08T12:33:04.279396048Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:04.282836057Z][dockerd][I] time="2023-08-08T12:33:04.282666610Z" level=warning msg="Health check for container 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error: OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown"
[2023-08-08T12:33:14.305497806Z][dockerd][I] time="2023-08-08T12:33:14.305301430Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:14.305576644Z][dockerd][I] time="2023-08-08T12:33:14.305306870Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:14.308217598Z][dockerd][I] time="2023-08-08T12:33:14.308062029Z" level=warning msg="Health check for container 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error: OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown"
[2023-08-08T12:33:24.331794982Z][dockerd][I] time="2023-08-08T12:33:24.331568318Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:24.331828805Z][dockerd][I] time="2023-08-08T12:33:24.331577897Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:24.334385979Z][dockerd][I] time="2023-08-08T12:33:24.334210892Z" level=warning msg="Health check for container 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error: OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown"
[2023-08-08T12:33:34.356205886Z][dockerd][I] time="2023-08-08T12:33:34.356008906Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:34.356275945Z][dockerd][I] time="2023-08-08T12:33:34.356009807Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:34.359218180Z][dockerd][I] time="2023-08-08T12:33:34.359075794Z" level=warning msg="Health check for container 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error: OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown"
[2023-08-08T12:33:44.382440159Z][dockerd][I] time="2023-08-08T12:33:44.382248876Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:44.382521010Z][dockerd][I] time="2023-08-08T12:33:44.382251949Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:44.384912966Z][dockerd][I] time="2023-08-08T12:33:44.384749200Z" level=warning msg="Health check for container 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error: OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown"
[2023-08-08T12:33:54.408834783Z][dockerd][I] time="2023-08-08T12:33:54.408633197Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:54.408909032Z][dockerd][I] time="2023-08-08T12:33:54.408633247Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:33:54.411452804Z][dockerd][I] time="2023-08-08T12:33:54.411312702Z" level=warning msg="Health check for container 1576ec97d4a10a8f92cf9bb4b645a1f542627b470427a6f2b648c76c0f408c9d error: OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown"
[2023-08-08T12:34:04.435439749Z][dockerd][I] time="2023-08-08T12:34:04.435246838Z" level=error msg="stream copy error: reading from a closed fifo"
[2023-08-08T12:34:04.435516372Z][dockerd][I] time="2023-08-08T12:34:04.435263359Z" level=error msg="stream copy error: reading from a closed fifo"

These are the first records about this container in the file, and all the following lines of it are just a repeat of the same thing.

I also see that kmsg.log is filled with messages like the following:

[2023-08-08T12:24:08.677587952Z][kmsg][I] (374546) - 2023-08-08T12:24:08.468276685Z: FS-Cache: Duplicate cookie detected
[2023-08-08T12:24:08.677591189Z][kmsg][I] (374547) - 2023-08-08T12:24:08.468533685Z: FS-Cache: O-key=[8] '4368040000000800'
[2023-08-08T12:24:08.677591549Z][kmsg][I] (374548) - 2023-08-08T12:24:08.468539685Z: FS-Cache: N-cookie c=000b36d1 [p=00000015 fl=2 nc=0 na=1]
[2023-08-08T12:24:08.677595196Z][kmsg][I] (374549) - 2023-08-08T12:24:08.468540685Z: FS-Cache: N-cookie d=00000000cbbdc554{9p.inode} n=00000000498ec749
[2023-08-08T12:24:08.677595677Z][kmsg][I] (374550) - 2023-08-08T12:24:08.468542685Z: FS-Cache: N-key=[8] '4368040000000800'

They repeat like a hundred times a second, and there are files kmsg.log.0 through kmsg.log.8 all from today, all 1mb large, all containing roughly the same message. Maybe that’s normal, but it certainly doesn’t look that way to me.

2 Likes

Unfortunately I am experiencing this too, but in an entirely different setup. I am using Docker on an Ubuntu Linux server to run home automation services.

I get the exact same error here:
Health check for container xxxxxxx error: OCI runtime exec failed: exec failed: unable to start container process: error executing setns process: exit status 1: unknown"

Followed by the errors:
stream copy error: reading from a closed fifo

I also have seen the “Duplicate cookie detected” on the console log.

Today this brought down my NodeRED swarm service; since the health check goes to Unhealthy, it was repeatedly restarting the service.

Ultimately I went through and set:
Healthcheck:
Disable: true

On the compose files and redeployed.

This allowed the services to start and continue running. Obviously it will be an issue if something does cause a failure, as now the health check is not there to restart after a legitimate problem…

1 Like

To this day, the only thing I have found out is that the container does not go unresponsive as long as I only make requests to it from Postman on my host machine, which seems to suggest the problem may be caused by inter-container messaging. Works fine after PC sleep, which seemed to sometimes trigger the unresponsiveness. That’s the only way I have found to work on the backend, but that means I can’t develop the frontend until I find a solution, and seeing how this topic has gone for 2 weeks with no suggestions, I feel like there is no solution.
I had one asshole say the mandatory “just use Linux” in a related GitHub issue (ye, because the containers don’t use Linux…), but that’s obviously not what I’m asking for, nor is it a solution. For a platform that is seemingly made to finally make things work the same on all platforms, this has been my worst experience of any software yet.

Hi, I am facing exactly the same problem but with a django application, I’m unable to figure out whats the root cause and its wasting too much of my time.
I’m using WSL2 backend on windows 11, 1 TB SSD, 16GB ram.

Hi. I had a similar issue, I was using image php:8.3-apache. I suspect it might be a regression so I pinned my image to an LTS version php:8.3-apache-bullseye and seems like the issue has been resolved. I will continue testing on the app that I am building and confirm if indeed the issue is gone.