cpoppema / docker-flexget

An auto updating FlexGet container.
82 stars 39 forks source link

Flexget docker container cpu is high #15

Closed adamwinn closed 7 years ago

adamwinn commented 7 years ago

I saw my docker container cpu was high, like 30%, and I tailed the log file and saw the below being outputted every second.

2017-09-20 11:05 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 11:05 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 11:05 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 11:05 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 11:05 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 11:05 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 11:05 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 11:05 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 11:05 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 11:05 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 11:05 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 11:05 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 11:05 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 11:05 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 11:05 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 11:05 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 11:05 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 11:05 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 11:05 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 11:05 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 11:05 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 11:05 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 11:05 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 11:05 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 11:05 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 11:05 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 11:05 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 11:05 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 11:05 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 11:05 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 11:05 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 11:05 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 11:05 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 11:05 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 11:05 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 11:05 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 11:05 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 11:05 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 11:05 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 11:05 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 11:05 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 11:05 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 11:05 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 11:05 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 11:05 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 11:05 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 11:05 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 11:05 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 11:05 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 11:05 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 11:05 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 11:05 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 11:05 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 11:05 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
adamwinn commented 7 years ago

I'm also seeing this in the logs too

2017-09-20 17:11:22 stdout  2017-09-20 11:11 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 17:11:22 stdout  There is a FlexGet process already running for this config, sending execution there.
2017-09-20 17:11:22 stdout  2017-09-20 11:11 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 17:11:22 stdout  2017-09-20 11:11 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 17:11:22 stdout  2017-09-20 11:11 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 17:11:22 stdout  2017-09-20 11:11 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 17:11:22 stdout  2017-09-20 11:11 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 17:11:21 stdout  error: [Errno 111] Connection refused
2017-09-20 17:11:21 stdout      return getattr(self._sock,name)(*args)
2017-09-20 17:11:21 stdout    File "/usr/lib/python2.7/socket.py", line 228, in meth
2017-09-20 17:11:21 stdout      s.connect(sockaddr)
2017-09-20 17:11:21 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 102, in _connect
2017-09-20 17:11:21 stdout      return cls(cls._connect(host, port, **kwargs))
2017-09-20 17:11:21 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 132, in connect
2017-09-20 17:11:21 stdout      channel = rpyc.Channel(rpyc.SocketStream.connect('127.0.0.1', port))
2017-09-20 17:11:21 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/ipc.py", line 158, in __init__
2017-09-20 17:11:21 stdout      client = IPCClient(ipc_info['port'], ipc_info['password'])
2017-09-20 17:11:21 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/manager.py", line 305, in start
2017-09-20 17:11:21 stdout      manager.start()
2017-09-20 17:11:21 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/__init__.py", line 42, in main
2017-09-20 17:11:21 stdout  Traceback (most recent call last):
2017-09-20 17:11:21 stdout  2017-09-20 11:11 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 17:11:21 stdout  There is a FlexGet process already running for this config, sending execution there.
2017-09-20 17:11:21 stdout  2017-09-20 11:11 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 17:11:21 stdout  2017-09-20 11:11 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 17:11:21 stdout  2017-09-20 11:11 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 17:11:21 stdout  2017-09-20 11:11 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 17:11:21 stdout  2017-09-20 11:11 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 17:11:20 stdout  error: [Errno 111] Connection refused
2017-09-20 17:11:20 stdout      return getattr(self._sock,name)(*args)
2017-09-20 17:11:20 stdout    File "/usr/lib/python2.7/socket.py", line 228, in meth
2017-09-20 17:11:20 stdout      s.connect(sockaddr)
2017-09-20 17:11:20 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 102, in _connect
2017-09-20 17:11:20 stdout      return cls(cls._connect(host, port, **kwargs))
2017-09-20 17:11:20 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 132, in connect
2017-09-20 17:11:20 stdout      channel = rpyc.Channel(rpyc.SocketStream.connect('127.0.0.1', port))
2017-09-20 17:11:20 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/ipc.py", line 158, in __init__
2017-09-20 17:11:20 stdout      client = IPCClient(ipc_info['port'], ipc_info['password'])
2017-09-20 17:11:20 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/manager.py", line 305, in start
2017-09-20 17:11:20 stdout      manager.start()
2017-09-20 17:11:20 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/__init__.py", line 42, in main
2017-09-20 17:11:20 stdout  Traceback (most recent call last):
2017-09-20 17:11:20 stdout  2017-09-20 11:11 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 17:11:20 stdout  There is a FlexGet process already running for this config, sending execution there.
2017-09-20 17:11:20 stdout  2017-09-20 11:11 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 17:11:20 stdout  2017-09-20 11:11 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 17:11:20 stdout  2017-09-20 11:11 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 17:11:20 stdout  2017-09-20 11:11 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 17:11:19 stdout  2017-09-20 11:11 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 17:11:18 stdout  error: [Errno 111] Connection refused
2017-09-20 17:11:18 stdout      return getattr(self._sock,name)(*args)
2017-09-20 17:11:18 stdout    File "/usr/lib/python2.7/socket.py", line 228, in meth
2017-09-20 17:11:18 stdout      s.connect(sockaddr)
2017-09-20 17:11:18 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 102, in _connect
2017-09-20 17:11:18 stdout      return cls(cls._connect(host, port, **kwargs))
2017-09-20 17:11:18 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 132, in connect
2017-09-20 17:11:18 stdout      channel = rpyc.Channel(rpyc.SocketStream.connect('127.0.0.1', port))
2017-09-20 17:11:18 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/ipc.py", line 158, in __init__
2017-09-20 17:11:18 stdout      client = IPCClient(ipc_info['port'], ipc_info['password'])
2017-09-20 17:11:18 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/manager.py", line 305, in start
2017-09-20 17:11:18 stdout      manager.start()
2017-09-20 17:11:18 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/__init__.py", line 42, in main
2017-09-20 17:11:18 stdout  Traceback (most recent call last):
2017-09-20 17:11:18 stdout  2017-09-20 11:11 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 17:11:18 stdout  There is a FlexGet process already running for this config, sending execution there.
2017-09-20 17:11:18 stdout  2017-09-20 11:11 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 17:11:18 stdout  2017-09-20 11:11 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 17:11:18 stdout  2017-09-20 11:11 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 17:11:18 stdout  2017-09-20 11:11 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 17:11:18 stdout  2017-09-20 11:11 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 17:11:16 stdout  error: [Errno 111] Connection refused
2017-09-20 17:11:16 stdout      return getattr(self._sock,name)(*args)
2017-09-20 17:11:16 stdout    File "/usr/lib/python2.7/socket.py", line 228, in meth
2017-09-20 17:11:16 stdout      s.connect(sockaddr)
2017-09-20 17:11:16 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 102, in _connect
2017-09-20 17:11:16 stdout      return cls(cls._connect(host, port, **kwargs))
2017-09-20 17:11:16 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 132, in connect
2017-09-20 17:11:16 stdout      channel = rpyc.Channel(rpyc.SocketStream.connect('127.0.0.1', port))
2017-09-20 17:11:16 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/ipc.py", line 158, in __init__
2017-09-20 17:11:16 stdout      client = IPCClient(ipc_info['port'], ipc_info['password'])
2017-09-20 17:11:16 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/manager.py", line 305, in start
2017-09-20 17:11:16 stdout      manager.start()
2017-09-20 17:11:16 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/__init__.py", line 42, in main
2017-09-20 17:11:16 stdout  Traceback (most recent call last):
2017-09-20 17:11:16 stdout  2017-09-20 11:11 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 17:11:16 stdout  There is a FlexGet process already running for this config, sending execution there.
2017-09-20 17:11:16 stdout  2017-09-20 11:11 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 17:11:16 stdout  2017-09-20 11:11 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 17:11:16 stdout  2017-09-20 11:11 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 17:11:16 stdout  2017-09-20 11:11 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 17:11:16 stdout  2017-09-20 11:11 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 17:11:15 stdout  error: [Errno 111] Connection refused
2017-09-20 17:11:15 stdout      return getattr(self._sock,name)(*args)
2017-09-20 17:11:15 stdout    File "/usr/lib/python2.7/socket.py", line 228, in meth
2017-09-20 17:11:15 stdout      s.connect(sockaddr)
2017-09-20 17:11:15 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 102, in _connect
2017-09-20 17:11:15 stdout      return cls(cls._connect(host, port, **kwargs))
2017-09-20 17:11:15 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 132, in connect
2017-09-20 17:11:15 stdout      channel = rpyc.Channel(rpyc.SocketStream.connect('127.0.0.1', port))
2017-09-20 17:11:15 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/ipc.py", line 158, in __init__
2017-09-20 17:11:15 stdout      client = IPCClient(ipc_info['port'], ipc_info['password'])
2017-09-20 17:11:15 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/manager.py", line 305, in start
2017-09-20 17:11:15 stdout      manager.start()
2017-09-20 17:11:15 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/__init__.py", line 42, in main
2017-09-20 17:11:15 stdout  Traceback (most recent call last):
2017-09-20 17:11:15 stdout  2017-09-20 11:11 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 17:11:15 stdout  There is a FlexGet process already running for this config, sending execution there.
2017-09-20 17:11:15 stdout  2017-09-20 11:11 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 17:11:15 stdout  2017-09-20 11:11 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 17:11:15 stdout  2017-09-20 11:11 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 17:11:15 stdout  2017-09-20 11:11 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 17:11:15 stdout  2017-09-20 11:11 DEBUG    manager                       Config file /config/config.yml selected
2017-09-20 17:11:13 stdout  error: [Errno 111] Connection refused
2017-09-20 17:11:13 stdout      return getattr(self._sock,name)(*args)
2017-09-20 17:11:13 stdout    File "/usr/lib/python2.7/socket.py", line 228, in meth
2017-09-20 17:11:13 stdout      s.connect(sockaddr)
2017-09-20 17:11:13 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 102, in _connect
2017-09-20 17:11:13 stdout      return cls(cls._connect(host, port, **kwargs))
2017-09-20 17:11:13 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 132, in connect
2017-09-20 17:11:13 stdout      channel = rpyc.Channel(rpyc.SocketStream.connect('127.0.0.1', port))
2017-09-20 17:11:13 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/ipc.py", line 158, in __init__
2017-09-20 17:11:13 stdout      client = IPCClient(ipc_info['port'], ipc_info['password'])
2017-09-20 17:11:13 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/manager.py", line 305, in start
2017-09-20 17:11:13 stdout      manager.start()
2017-09-20 17:11:13 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/__init__.py", line 42, in main
2017-09-20 17:11:13 stdout  Traceback (most recent call last):
2017-09-20 17:11:13 stdout  2017-09-20 11:11 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
2017-09-20 17:11:13 stdout  There is a FlexGet process already running for this config, sending execution there.
2017-09-20 17:11:13 stdout  2017-09-20 11:11 DEBUG    manager                       os.path.supports_unicode_filenames: False
2017-09-20 17:11:13 stdout  2017-09-20 11:11 DEBUG    manager                       flexget detected io encoding: utf-8
2017-09-20 17:11:13 stdout  2017-09-20 11:11 DEBUG    manager                       sys.getfilesystemencoding: UTF-8
2017-09-20 17:11:13 stdout  2017-09-20 11:11 DEBUG    manager                       sys.defaultencoding: ascii
2017-09-20 17:11:13 stdout  2017-09-20 11:11 DEBUG    manager                       Config file /config/config.yml selected
cpoppema commented 7 years ago

Hi @adamwinn, thanks for reporting this. Can you provide (an excerpt of) your config.yml so I can try to reproduce this on my machine ?

adamwinn commented 7 years ago

I think I might have fixed it myself. There was a rogue .config-lock file left over from when I rebooted my NAS, I think it was. When my NAS came back up, it said the flexget container wasn't shut down properly.

https://discuss.flexget.com/t/errno-111-connection-refused/1765/2 https://discuss.flexget.com/t/daemon-not-stopping-or-giving-status/3614

cpoppema commented 7 years ago

Great! It might happen under specific conditions. When I killed the container that runs flexget, it also left behind a .config-lock file. Flexget, however, had no trouble starting after restarting that container.

I can simply add a script that removes a .config-lock file in the config directory when starting up, since under normal shutdown conditions flexget removes it by itself:

2017-09-23 18:08 INFO     web_server                    Shutting down web server
2017-09-23 18:08 DEBUG    manager                       Shutting down
2017-09-23 18:08 DEBUG    manager                       Removed /config/.config-lock
*** Shutting down runit daemon (PID 40)...
*** Killing all processes...

I'll put it on my TODO, but for now I will close this issue. Thanks for reporting back.

adamwinn commented 7 years ago

@cpoppema Ya, it has no problem starting up like that, but the problem is it keeps trying to connect to the daemon and spits out all the error info to the log files and also makes the cpu run high.

There is a FlexGet process already running for this config, sending execution there.
2017-09-20 17:11:13 stdout  error: [Errno 111] Connection refused
2017-09-20 17:11:13 stdout      return getattr(self._sock,name)(*args)
2017-09-20 17:11:13 stdout    File "/usr/lib/python2.7/socket.py", line 228, in meth
2017-09-20 17:11:13 stdout      s.connect(sockaddr)
2017-09-20 17:11:13 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 102, in _connect
2017-09-20 17:11:13 stdout      return cls(cls._connect(host, port, **kwargs))
2017-09-20 17:11:13 stdout    File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 132, in connect
2017-09-20 17:11:13 stdout      channel = rpyc.Channel(rpyc.SocketStream.connect('127.0.0.1', port))
2017-09-20 17:11:13 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/ipc.py", line 158, in __init__
2017-09-20 17:11:13 stdout      client = IPCClient(ipc_info['port'], ipc_info['password'])
2017-09-20 17:11:13 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/manager.py", line 305, in start
2017-09-20 17:11:13 stdout      manager.start()
2017-09-20 17:11:13 stdout    File "/usr/local/lib/python2.7/dist-packages/flexget/__init__.py", line 42, in main
2017-09-20 17:11:13 stdout  Traceback (most recent call last):

All that churning and log output in my original comment happens about every second.

adamwinn commented 7 years ago

I just shut down my docker container gracefully and rebooted my nas. Upon bootup, flexget was going nuts again because /config/.config-lock hadn't been removed

cpoppema commented 7 years ago

For me, Connection refused happens once when a .config-lock already exists.

2017-09-24 11:19 DEBUG    manager                       Sending command to running FlexGet process: [u'-c', u'/config/config.yml', u'--loglevel', u'debug', u'daemon', u'start', u'--autoreload-config']
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/flexget/__init__.py", line 42, in main
    manager.start()
  File "/usr/local/lib/python2.7/dist-packages/flexget/manager.py", line 305, in start
    client = IPCClient(ipc_info['port'], ipc_info['password'])
  File "/usr/local/lib/python2.7/dist-packages/flexget/ipc.py", line 158, in __init__
    channel = rpyc.Channel(rpyc.SocketStream.connect('127.0.0.1', port))
  File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 132, in connect
    return cls(cls._connect(host, port, **kwargs))
  File "/usr/local/lib/python2.7/dist-packages/rpyc/core/stream.py", line 102, in _connect
    s.connect(sockaddr)
  File "/usr/lib/python2.7/socket.py", line 228, in meth
    return getattr(self._sock,name)(*args)
error: [Errno 111] Connection refused

If I look inside the .config-lock file after killing the container it contains (this is with my sample config yml):

PID: 49
password: XYgtJpgFyuzLQoP
port: 45207

So, after reporting the error once when restarting the container, flexget does start and it updates the .config-lock's contents with a new PID/password/port. If the file is not being overwritten on your NAS, it makes me believe there might be file permission issues. I tested by removing x from /config and more often than not I had the same issue (sometimes it took a second restart to consistently have this error).

So this works for me:

 $    ls -la config/
drwxr-xr-x 2 cornelis cornelis    4096 Sep 24 13:34 .

While this doesn't:

 $    chmod go-x config/
 $    ls -la config/
drwxr--r-- 2 cornelis cornelis    4096 Sep 24 13:34 .

This is how it looks like inside the container, so you can see the folder owner is the same as abc.

 $    docker exec flexget /sbin/setuser abc ls -la /config
total 10684
drwxr--r--  2 abc  abc     4096 Sep 24 11:47 .
drwxr-xr-x 24 root root    4096 Sep 23 18:06 ..
-rw-r--r--  1 abc  abc       46 Sep 24 11:47 .config-lock
...