for-mac icon indicating copy to clipboard operation
for-mac copied to clipboard

Daemon fails with "Failed to set posix_spawn_file_actions for fd -1 at index 0 with errno 9"

Open marcelloromani opened this issue 7 years ago • 30 comments

  • [x] I have tried with the latest version of my channel (Stable or Edge)
  • [x] I have uploaded Diagnostics
  • Diagnostics ID: FDEB2B36-9E22-4A62-BD46-4B8E43938271/20190118121628

Expected behavior

docker-compose running as usual

Actual behavior

docker-compose runs starts the expected containers but crashes at random times with the following error message:

ERRO[0028] error waiting for container: EOF
ERROR: Bad response from Docker engine

When this happens, the docker daemon seems to have crashed: the icon in the tray bar at the top of the screen disappears and any further attempts to execute docker or docker-compose fail with the "can't connect to daemon" error message.

Information

  • macOS Version: 10.13.6 (17G4015)

Diagnostic logs

Docker for Mac: version...
Version 2.0.0.2 (30215)
Channel: stable
0b030e17ca

Log messages from the Console app:

fault	11:58:50.192474 +0000	Docker	CrashReport: report: Failed to set posix_spawn_file_actions for fd -1 at index 0 with errno 9
error	11:58:50.418321 +0000	Docker	failed to read /System/Library/Preferences/Logging/Subsystems/com.apple.SystemConfiguration.plist: [24: Too many open files]
error	11:58:50.418365 +0000	Docker	failed to read /Library/Preferences/Logging/Subsystems/com.apple.SystemConfiguration.plist: [24: Too many open files]
default	11:58:50.419019 +0000	Docker	dnssd_clientstub ConnectToServer: socket failed 24 Too many open files
error	11:58:50.419427 +0000	Docker	nw_resolver_create_dns_service_locked DNSServiceCreateDelegateConnection failed: NoMemory(-65539)
error	11:58:50.453132 +0000	Docker	CrashReport: The operation couldn\U2019t be completed. (NSCocoaErrorDomain error 256.)

Steps to reproduce the behavior

  • Start Docker Desktop
  • Start a container
  • Expected: container runs to completion
  • Actual: container starts and the daemon crashes after a pretty random amount of time. Sometimes the crash happens after a couple successful runs, sometimes it happens during the very first run after the docker daemon has been (re)started

marcelloromani avatar Jan 18 '19 12:01 marcelloromani

Reporting this made me focus on something I had overlooked at first:

dnssd_clientstub ConnectToServer: socket failed 24 Too many open files

After a bit of research on this I found: https://github.com/mogui/MDWamp/issues/42 which in turn points to https://forums.developer.apple.com/message/118647#118647

It seems like Docker itself is opening a lot of fds thus leading to the crash.

  • Made sure no containers were running, i.e. docker ps -a result was empty
  • Launched the open fds count shell line below roughly at the same time as I launched the Docker app Result:
$ while true ; do now=`date +%s` ; lsof | grep -i docker > lsof_docker_${now}.log && echo "lsof_docker_${now}.log `cat lsof_docker_${now}.log|wc -l`" ; done
lsof_docker_1547819186.log        9    <= Docker daemon starting
lsof_docker_1547819213.log      469
lsof_docker_1547819251.log     1038
lsof_docker_1547819281.log     1527
lsof_docker_1547819302.log     1917
lsof_docker_1547819328.log     2316
lsof_docker_1547819354.log     2721
lsof_docker_1547819387.log     3225
lsof_docker_1547819411.log     3616
lsof_docker_1547819434.log     3966
lsof_docker_1547819454.log     4306
lsof_docker_1547819480.log     4713
lsof_docker_1547819499.log       24
lsof_docker_1547819513.log        3    <= Docker daemon crashed
lsof_docker_1547819527.log        3

Docker Desktop for Mac unusable for me at the moment.

marcelloromani avatar Jan 18 '19 12:01 marcelloromani

I'm having the exact same issue. I couldn't get a diagnostic because Docker for mac crashes before generating the diagnostic.

  • Error: Failed to set posix_spawn_file_actions for fd -1 at index 0 with errno 9

  • System log Jan 24 09:39:43 Docker[83830]: BUG in libdispatch client: kevent add: "Bad file descriptor" - 0x9 { 0x6000037126c0[read], ident: 4294967295 / 0xffffffff, handler: 0x7fff3c90bf18 }

  • Daemon log

      error 10:25:16.740597 +0100 Docker  nw_resolver_create_dns_service_locked DNSServiceCreateDelegateConnection failed: NoMemory(-65539)
      error 10:25:16.746735 +0100 Docker  CrashReport: The operation couldn\U2019t be completed. (NSCocoaErrorDomain error 256.)
      error 10:25:17.751994 +0100 Docker  Wizard: Wizard.show cannot get window from WizardWindowController
      error 10:25:17.883460 +0100 Docker  nw_resolver_create_dns_service_locked [C15] DNSServiceGetAddrInfo failed: Unknown(-65537)
      error 10:25:17.884114 +0100 Docker  TIC TCP Conn Failed [15:0x6000033dcc00]: 10:-72000 Err(-65537)
      error 10:25:17.887062 +0100 Docker  Task <01EEBEFC-80D6-49A0-910B-30198E14C530>.<1> HTTP load failed (error code: -1003 [10:-72000])
      error 10:25:17.887215 +0100 Docker  Task <01EEBEFC-80D6-49A0-910B-30198E14C530>.<1> finished with error - code: -1003
    
  • MacOS Version: 10.14.3 (18D42)

  • Docker for mac versions that crash with this error message:

    • 2.0.0.0
    • 2.0.0.2

vhf avatar Jan 24 '19 09:01 vhf

As an FYI for anyone reading, this is a showstopper for me at the moment, so I went back to docker-machine which has worked reliably so far despite using the same version of the docker engine as Docker Desktop.

This made me think the issue is with the Mac OS integration, not docker engine itself (bear in mind this is just speculation on my part).

marcelloromani avatar Jan 24 '19 13:01 marcelloromani

I've got the same issue after updating macos to 10.14.3 (18D109). Is there any estimation on when it'll be fixed or maybe there's a workaround?

ivangorbachev avatar Feb 18 '19 11:02 ivangorbachev

Facing same issue for me also

simula67 avatar Mar 29 '19 05:03 simula67

Installed Docker for Mac Version 2.0.0.3 (31259)

I haven't seen the issue since then.

marcelloromani avatar Mar 29 '19 09:03 marcelloromani

I am seeing this issue for Version 2.0.0.3 (31259)

sameergarg avatar Apr 23 '19 12:04 sameergarg

Not sure if this will help anyone, but I had changed the password on my machine without restarting and I think this was potentially the cause of it. After restarting my mac, docker started working.

floralWallpaper avatar Apr 30 '19 14:04 floralWallpaper

Facing same issue in Version 2.0.0.3

yolossn avatar Jun 24 '19 07:06 yolossn

I'm wondering if this error is in some (obscure) way related to https://github.com/docker/for-mac/issues/3557#issuecomment-502324468

marcelloromani avatar Jun 24 '19 11:06 marcelloromani

Issues go stale after 90d of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30d of inactivity.

Prevent issues from auto-closing with an /lifecycle frozen comment.

If this issue is safe to close now please do so.

Send feedback to Docker Community Slack channels #docker-for-mac or #docker-for-windows. /lifecycle stale

docker-robott avatar Sep 22 '19 01:09 docker-robott

Meet this issue while upgrade my Macbook to macOS 10.15. Seems it's all right now after uninstalling and reinstalled Docker for Mac.

kxxoling avatar Oct 09 '19 03:10 kxxoling

Had this same issue a little while after updating to Catalina. Also can't generate diagnostics because the UI to do it is obscured. It's happening with both edge and stable (started on Edge, downgraded to stable), after a factory reset and a manual factory reset (deleting Library/Containers/com.docker.docker/Data and ~/.docker entirely.)

Going to try

glyph avatar Oct 21 '19 23:10 glyph

Update: I'm not seeing the bug any more since installing: Docker desktop 2.1.0.4 (39773) macOS: 10.14.6 (18G103)

Will reopen if I see the bug again.

marcelloromani avatar Oct 29 '19 11:10 marcelloromani

It started happen again when trying to update Docker on MacOS Catalina (10.15.2 (19C57)). The current version of the Docker is 2.1.0.5, trying to update to 2.2.0.0.

UPDATE: Actually this error is shown regardless whether I am trying to install an update or just trying to start docker.

Andremoniy avatar Jan 27 '20 05:01 Andremoniy

I am having the same issue as @Andremoniy I uninstalled and downloaded the latest version which didn't help

Docker version: 2.2.0.4 Engine version 19.03.8 OS: Catalina 10.15.3

ed0906 avatar Mar 13 '20 15:03 ed0906

Docker version 19.03.8, build afacb8b OS: Catalina 10.15.3

Same problem

superman-lopez avatar Mar 26 '20 07:03 superman-lopez

@marcelloromani is it worth leaving this open as so many others continue to have this issue?

tgsmith61591 avatar May 13 '20 21:05 tgsmith61591

I'm having same issue, started today

docker: 2.2.0.5 os: 10.15.4

gvazqu1 avatar May 14 '20 20:05 gvazqu1

I am getting this error just now and docker won't even start. Any ideas how to resolve this?

Catalina 10.15.3 I got the latest version from https://hub.docker.com/editions/community/docker-ce-desktop-mac

[Update] This worked for me https://github.com/docker/for-mac/issues/4566#issuecomment-628663357

donvito avatar May 15 '20 07:05 donvito