docker / for-mac

Bug reports for Docker Desktop for Mac
https://www.docker.com/products/docker#/mac
2.43k stars 117 forks source link

Volume get detached after error with osxfs notifications #2777

Open waj opened 6 years ago

waj commented 6 years ago

I was having an issue with an Elixir/Phoenix project and after some time debugging and reducing the problem I finally got something minimal that can be easily reproduced.

This started to happen after I upgraded to Docker for Mac Version 18.03.0-ce-mac60 (23751). Diagnostics ID: CF39864B-6DD4-477F-99A6-6455DC6EC617

The problem is that sometimes a Docker volume gets detached. Here's an example to reproduce the issue:

docker-compose.yml:

version: '2'
volumes:
  vol:

services:
  app:
    build: .
    working_dir: /app
    volumes:
      - './:/app'
      - 'vol:/app/vol'

Dockerfile:

FROM debian:jessie

RUN \
  apt-get update && \
  DEBIAN_FRONTEND=noninteractive apt-get install -y inotify-tools && \
  apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*

First, I start the container and confirm that the volume is mounted:

$ docker-compose run --rm app bash
root@d1bad28a1d5a:/app# mount | grep vol
/dev/sda1 on /app/vol type ext4 (rw,relatime,stripe=1024,data=ordered)

Now I start inotifywait to listen to some events on the /app directory (mounted from host)

root@d1bad28a1d5a:/app# inotifywait -m -r .
Setting up watches.  Beware: since -r was given, this may take a while!
Watches established.

On another terminal, in the host I run this command to rapidly create and delete files:

$ while true; do touch foo; rm foo; done

In the container I can see the notifications flooding the screen:

./ DELETE foo
./ CREATE foo
./ CREATE foo
./ DELETE foo
...

However at the same time, I can see in the Console.app logs coming from the com.docker.osxfs process complaining about missed files:

transfused: Event unlink /Users/waj/docker-foo/foo error: No such file or directory

Once that happen (very quickly indeed), in the container I cancel the inotifywait session and verify that the volume is not mounted anymore:

root@d1bad28a1d5a:/app# mount | grep vol
root@d1bad28a1d5a:/app#
rchomat commented 6 years ago

https://github.com/docker/for-mac/issues/2019 may be linked to this one ?

artyfarty commented 6 years ago

Volumes that suddenly dismount or stop updating correctly is a common problem for me and my coworkers. No idea how to fix this for now. docker-sync is nice but has its own stability issues

artyfarty commented 6 years ago

By the way. Why mount shows

osxfs on /***** type fuse.osxfs (rw,nosuid,nodev,relatime,user_id=0,group_id=0,allow_other,max_read=1048576)

Why max_read=1048576? Isn't it a problem?

max_read=N With this option the maximum size of read operations can be set. The default is infinite. Note that the size of read requests is limited anyway to 32 pages (which is 128kbyte on i386).

WHY

waj commented 6 years ago

I can confirm this is still happening with Docker for Mac Version 18.03.1-ce-mac64 (24245)

paschdan commented 6 years ago

I can confirm this happens on Version 18.05.0-ce-mac66 (24545)

docker-robott commented 6 years ago

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

artyfarty commented 6 years ago

The problem persists. /remove-lifecycle stale

paschdan commented 6 years ago

/remove-lifecycle stale

docker-robott commented 5 years ago

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

artyfarty commented 5 years ago

/remove-lifecycle stale

waj commented 5 years ago

I just tested this on Docker for Mac Version 2.0.0.2 (30215), and still happening. This is really annoying. Is there any way I can contribute to fix this issue? I'm pretty sure it's something related with osxfs and the forwarding of inotify events. Is that code open source?

docker-robott commented 5 years ago

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

nguyenvietyen commented 5 years ago

/remove-lifecycle stale

waj commented 5 years ago

/remove-lifecycle stale

waj commented 5 years ago

Just upgraded to Docker Desktop 2.1.0.1 (37199) and still the same problem.

macrael commented 5 years ago

I think I may be having the same problem.

 --mount type=volume,source=code-node,destination=/code/node_modules/ \
 --mount type=bind,source="$(pwd)",destination=/code \

I can reliably make the node_modules volume get unmounted simply by running touch node_modules on the host.

This seems wrong!

docker-robott commented 4 years ago

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

artyfarty commented 4 years ago

/remove-lifecycle stale Thou shalth not silence Us, Machine.

docker-robott commented 4 years ago

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

waj commented 4 years ago

/remove-lifecycle stale

waj commented 4 years ago

Still happening with Docker for Mac 2.2.0.5 2 years now with this really annoying bug reported multiple times: #3479, #3976, #2019, https://github.com/moby/moby/issues/40109

kurko commented 4 years ago

2.3.0.3 as well.

docker-robott commented 4 years ago

Issues go stale after 90 days of inactivity. Mark the issue as fresh with /remove-lifecycle stale comment. Stale issues will be closed after an additional 30 days 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

artyfarty commented 4 years ago

/remove-lifecycle stale /lifecycle frozen

At least this issue is stable in this endless cycle of being marked as stale shortly after somebody tells that it still exists.

daveisfera commented 4 years ago

I just tried this with 2.3.6.1 and could not reproduce the issue so I believe that the issues with event notifications have been fixed in the edge build