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

Docker for mac reboots when trying to delete files

Open aldenpeterson-wf opened this issue 9 years ago • 6 comments

Expected behavior

Using the following files:

$ cat docker_command.sh 
#!/usr/bin/env bash
docker run  -v "${PWD}":"/scripts" google/dart:1.17.1 /scripts/scripts.sh
 
$ cat scripts.sh 
#!/usr/bin/env bash
set -ex
cd /scripts
# Run pub upgrade a few times to likely somewhere catastrophically 
pub upgrade --verbosity warning
pub upgrade --verbosity warning
pub upgrade --verbosity warning
pub upgrade --verbosity warning
pub upgrade --verbosity warning
pub upgrade --verbosity warning
 
$ cat pubspec.yaml 
name: gg_docker_daemon
dependencies:
  http: ^0.11.0
dev_dependencies:
  test: "^0.12.0"

That docker image is:

$ docker images | grep 'google'
google/dart         1.17.1              498d1c3051d5        8 months ago        227 MB

I expect running that script will not crash the docker daemon running on the host machine.

Actual behavior

Running the docker_command script consistently allows me to crash the docker daemon on my Mac (all three files in the same directory and running ./docker_command.sh):

$ ./docker_command.sh 
+ cd /scripts
+ pub upgrade --verbosity warning
+ pub upgrade --verbosity warning
+ pub upgrade --verbosity warning
+ pub upgrade --verbosity warning
Deletion failed, path = './packages' (OS Error: Input/output error, errno = 5)

Occasionally this hits an error 39 and recovers gracefully from Docker's perspective. But it fairly consistently will hit the above situation, which then triggers a full restart of the docker daemon on the host machine after logging a fatal "Unknown exception caught: End_of_file" in the docker syslogs.

The syslogs for docker are pretty basic at this point, except for that uncaught exception:

Feb 24 18:31:18 alden-rMBP Docker[34220] <Error>: Unknown exception caught: End_of_file
Feb 24 18:31:18 alden-rMBP Docker[34220] <Error>: Fatal unexpected exception: End_of_file
Feb 24 18:31:18 alden-rMBP Docker[34092] <Notice>: Reap com.docker.osxfs (pid 34220): exit status 1
Feb 24 18:31:19 alden-rMBP Docker[34092] <Notice>: Stop 1 children with order 1: com.docker.driver.amd64-linux (pid 34222)
Feb 24 18:31:19 alden-rMBP Docker[34092] <Notice>: Signal terminated to com.docker.driver.amd64-linux (pid 34222)
Feb 24 18:31:19 alden-rMBP Docker[34222] <Notice>: sending SIGTERM to com.docker.hyperkit pid 34227
Feb 24 18:31:19 alden-rMBP Docker[34100] <Notice>: VM shutdown at 2017-02-24 18:31:19 -0600 CST

Information

$ docker info
Containers: 19
 Running: 0
 Paused: 0
 Stopped: 19
Images: 2
Server Version: 1.13.1
Storage Driver: aufs
 Root Dir: /var/lib/docker/aufs
 Backing Filesystem: extfs
 Dirs: 50
 Dirperm1 Supported: true
Logging Driver: json-file
Cgroup Driver: cgroupfs
Plugins: 
 Volume: local
 Network: bridge host ipvlan macvlan null overlay
Swarm: inactive
Runtimes: runc
Default Runtime: runc
Init Binary: docker-init
containerd version: aa8187dbd3b7ad67d8e5e3a15115d3eef43a7ed1
runc version: 9df8b306d01f59d3a8029be411de015b7304dd8f
init version: 949e6fa
Security Options:
 seccomp
  Profile: default
Kernel Version: 4.9.8-moby
Operating System: Alpine Linux v3.5
OSType: linux
Architecture: x86_64
CPUs: 4
Total Memory: 1.952 GiB
Name: moby
ID: NTJL:ZWZ2:7NIR:FTRX:273G:4CRZ:4KG2:FWW3:W3F6:JDSF:VBR4:75WV
Docker Root Dir: /var/lib/docker
Debug Mode (client): false
Debug Mode (server): true
 File Descriptors: 16
 Goroutines: 26
 System Time: 2017-02-25T00:35:57.102862002Z
 EventsListeners: 1
No Proxy: *.local, 169.254/16
Registry: https://index.docker.io/v1/
Experimental: true
Insecure Registries:
 127.0.0.0/8
Live Restore Enabled: false

I found that changing the docker system resources seemed to have no effect on this.

$ docker version
Client:
 Version:      1.13.1
 API version:  1.26
 Go version:   go1.7.5
 Git commit:   092cba3
 Built:        Wed Feb  8 08:47:51 2017
 OS/Arch:      darwin/amd64
Server:
 Version:      1.13.1
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   092cba3
 Built:        Wed Feb  8 08:47:51 2017
 OS/Arch:      linux/amd64
 Experimental: true

I am on OSX: 10.11.6 (15G1217)

  Model Name:	MacBook Pro
  Model Identifier:	MacBookPro11,5
  Processor Name:	Intel Core i7
  Processor Speed:	2.5 GHz
  Number of Processors:	1
  Total Number of Cores:	4
  L2 Cache (per Core):	256 KB
  L3 Cache:	6 MB
  Memory:	16 GB

Steps to reproduce the behavior

Create the three files above and run the docker_command.sh script until the docker daemon crashes.

It appears to be unique to 1.13.1 as I could not reproduce on older versions of docker.

aldenpeterson-wf avatar Feb 28 '17 00:02 aldenpeterson-wf

Thanks for reporting this and for the easy reproduction -- it works well. This is a serious issue and we're investigating now.

dsheets avatar Feb 28 '17 16:02 dsheets

Both the ENOTEMPTY (39) and EIO (5) (due to the uncaught End_of_file) are due to bad handling of deletions during directory reads. It appears that pub likes to delete files from directories while it is consuming dirents from the opendir fd via readdir. While this practice is inadvisable, we should not fail in this circumstance (ENOTEMPTY) and we certainly should not crash.

dsheets avatar Feb 28 '17 18:02 dsheets

@dsheets yeah, agreed.

I was pretty sure that pub was doing dumb things in order to cause this, but also that it shouldn't bring down the docker daemon itself.

aldenpeterson-wf avatar Feb 28 '17 18:02 aldenpeterson-wf

@dsheets has this been deployed in a version of docker for mac so I can close this?

aldenpeterson-wf avatar May 01 '17 21:05 aldenpeterson-wf

@aldenpeterson-wf this has been shipped on the Edge channel from 17.03.1-ce-rc1-mac3. It will be in stable from 17.06 unless the release team decides to cherry-pick it. Thanks for your report!

dsheets avatar May 02 '17 08:05 dsheets

Closed issues are locked after 30 days of inactivity. This helps our team focus on active issues.

If you have found a problem that seems similar to this, please open a new issue.

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

docker-robott avatar Jun 22 '20 03:06 docker-robott