merofeev / docker-windows-volume-watcher

A tool to notify Docker contianers about changes in mounts on Windows.
MIT License
188 stars 30 forks source link

Error on when it notices change #3

Closed joacimjakobsen closed 5 years ago

joacimjakobsen commented 7 years ago

Hi, whenever your script finds a change it gives me error. Do you have any suggestions?

printout:

Exception in thread Thread-9:
Traceback (most recent call last):
  File "c:\python\lib\threading.py", line 916, in _bootstrap_inner
    self.run()
  File "c:\python\lib\site-packages\watchdog\observers\api.py", line 199, in run
    self.dispatch_events(self.event_queue, self.timeout)
  File "c:\python\lib\site-packages\watchdog\observers\api.py", line 368, in dispatch_events
    handler.dispatch(event)
  File "c:\python\lib\site-packages\watchdog\events.py", line 454, in dispatch
    _method_map[event_type](event)
  File "c:\python\lib\site-packages\docker_volume_watcher\container_notifier.py", line 49, in __change_handler
    self.notify(absolute_path)
  File "c:\python\lib\site-packages\docker_volume_watcher\container_notifier.py", line 65, in notify
    ['stat', '-c', '%a', absolute_path], privileged=True)
  File "c:\python\lib\site-packages\docker\models\containers.py", line 162, in exec_run
    resp['Id'], detach=detach, tty=tty, stream=stream, socket=socket
  File "c:\python\lib\site-packages\docker\utils\decorators.py", line 34, in wrapper
    return f(self, *args, **kwargs)
  File "c:\python\lib\site-packages\docker\utils\decorators.py", line 19, in wrapped
    return f(self, resource_id, *args, **kwargs)
  File "c:\python\lib\site-packages\docker\api\exec_api.py", line 156, in exec_start
    return self._read_from_socket(res, stream, tty)
  File "c:\python\lib\site-packages\docker\api\client.py", line 377, in _read_from_socket
    return six.binary_type().join(gen)
  File "c:\python\lib\site-packages\docker\utils\socket.py", line 73, in frames_iter
    n = next_frame_size(socket)
  File "c:\python\lib\site-packages\docker\utils\socket.py", line 60, in next_frame_size
    data = read_exactly(socket, 8)
  File "c:\python\lib\site-packages\docker\utils\socket.py", line 45, in read_exactly
    next_data = read(socket, n - len(data))
  File "c:\python\lib\site-packages\docker\utils\socket.py", line 32, in read
    return os.read(socket.fileno(), n)
OSError: [Errno 9] Bad file descriptor

Thanks

merofeev commented 7 years ago

Hi @joacimjakobsen, looks like docker python api cannot properly contact docker daemon to execute stat command inside the container. To further investigate this problem could you post here versions of docker and pypiwin32 pypi packages that are installed on your system. Please also verify that user account you use to execute the script has enough privileges to execute:

docker exec --privileged your-container-name-here whoami
joacimjakobsen commented 7 years ago

docker exec --privileged your-container-name-here whoami Says : root

Version:

PS C:\Dev\fdk> docker version
Client:
 Version:      17.06.2-ce
 API version:  1.30
 Go version:   go1.8.3
 Git commit:   cec0b72
 Built:        Tue Sep  5 19:57:19 2017
 OS/Arch:      windows/amd64

Server:
 Version:      17.06.2-ce
 API version:  1.30 (minimum version 1.12)
 Go version:   go1.8.3
 Git commit:   cec0b72
 Built:        Tue Sep  5 19:59:19 2017
 OS/Arch:      linux/amd64
 Experimental: true

pypiwin32 version is 220

merofeev commented 7 years ago

Ok, thanks for this information. I need also the version of docker python package, i.e:

pip show docker

Then I will try to replicate this issue on my system. By the way, what Windows version are you using?

joacimjakobsen commented 7 years ago
PS C:\Dev\fdk\applications\registration> pip show docker
Name: docker
Version: 2.5.1
Summary: A Python library for the Docker Engine API.
Home-page: https://github.com/docker/docker-py
Author: Joffrey F
Author-email: joffrey@docker.com
License: Apache License 2.0
Location: c:\python\lib\site-packages
Requires: six, websocket-client, requests, docker-pycreds

Windows version : 10.0.15063 Build 15063

merofeev commented 6 years ago

Dear @joacimjakobsen , Sorry for such huge delay with the response. Finally, I got some time to look into this. I have setup exactly the same versions of pypiwin32 and docker-py you are using, however I wasn't able to donwgrade my docker installation to 17.06.2-ce (I'm currently on 17.09.0-ce). However, I wasn't able to reproduce this issue.

So, at this point the best option I can suggest is upgrading docker to 17.09.0-ce and checking whether this fixes issue.

merofeev commented 5 years ago

Closing this issue, since there was awhile since the last activity. Please feel free to comment, if you have the described problem.