Skip to content

RuntimeError: threads can only be started once #1254

Closed

Description

@fabrizio5680

Expected behaviour:

While daemon running, I should still be able to run a manual execution.

Actual behaviour:

It's seeing process is there but crashes because of Runtime error regards threads.

Steps to reproduce:

  • Step 1: start daemon flexget daemon start -d
  • Step 2: run standard execution flexget execute --verbose

Log:

There is a FlexGet process already running for this config, sending execution there.
Traceback (most recent call last):
  File "/opt/bin/flexget", line 11, in <module>
    sys.exit(main())
  File "/opt/lib/python3.5/site-packages/flexget/__init__.py", line 42, in main
    manager.start()
  File "/opt/lib/python3.5/site-packages/flexget/manager.py", line 294, in start
    client.handle_cli(self.args)
  File "/opt/lib/python3.5/site-packages/rpyc/core/netref.py", line 196, in __call__
    return syncreq(_self, consts.HANDLE_CALL, args, kwargs)
  File "/opt/lib/python3.5/site-packages/rpyc/core/netref.py", line 71, in syncreq
    return conn.sync_request(handler, oid, *args)
  File "/opt/lib/python3.5/site-packages/rpyc/core/protocol.py", line 441, in sync_request
    raise obj
RuntimeError: threads can only be started once

========= Remote Traceback (1) =========
Traceback (most recent call last):
  File "/opt/lib/python3.5/site-packages/rpyc/core/protocol.py", line 305, in _dispatch_request
    res = self._HANDLERS[handler](self, *args)
  File "/opt/lib/python3.5/site-packages/rpyc/core/protocol.py", line 535, in _handle_call
    return self._local_objects[oid](*args, **dict(kwargs))
  File "/opt/lib/python3.5/site-packages/flexget/ipc.py", line 80, in exposed_handle_cli
    self.manager.handle_cli(options)
  File "/opt/lib/python3.5/contextlib.py", line 77, in __exit__
    self.gen.throw(type, value, traceback)
  File "/opt/lib/python3.5/site-packages/flexget/logger.py", line 88, in capture_output
    yield
  File "/opt/lib/python3.5/site-packages/flexget/ipc.py", line 80, in exposed_handle_cli
    self.manager.handle_cli(options)
  File "/opt/lib/python3.5/site-packages/flexget/manager.py", line 333, in handle_cli
    self.execute_command(command_options)
  File "/opt/lib/python3.5/site-packages/flexget/manager.py", line 365, in execute_command
    self.task_queue.start()
  File "/opt/lib/python3.5/site-packages/flexget/task_queue.py", line 35, in start
    self._thread.start()
  File "/opt/lib/python3.5/threading.py", line 840, in start
    raise RuntimeError("threads can only be started once")
RuntimeError: threads can only be started once

Additional information:

  • Flexget Version: 2.1.1
  • Python Version: 3.5
  • Installation method: pip install
  • OS and version: Android 4.4 AMLogic s805

Activity

  1. orlandosantos commented on Aug 10, 2016

    @orlandosantos

    I've got the same error message;

    There is a FlexGet process already running for this config, sending execution there.
    Traceback (most recent call last):
    File "./bin/flexget", line 11, in
    sys.exit(main())
    File "/opt/local/lib/python3.5/site-packages/flexget/init.py", line 42, in main
    manager.start()
    File "/opt/local/lib/python3.5/site-packages/flexget/manager.py", line 295, in start
    client.handle_cli(self.args)
    File "/opt/local/lib/python3.5/site-packages/rpyc/core/netref.py", line 196, in call
    return syncreq(_self, consts.HANDLE_CALL, args, kwargs)
    File "/opt/local/lib/python3.5/site-packages/rpyc/core/netref.py", line 71, in syncreq
    return conn.sync_request(handler, oid, *args)
    File "/opt/local/lib/python3.5/site-packages/rpyc/core/protocol.py", line 441, in sync_request
    raise obj
    RuntimeError: threads can only be started once

    ========= Remote Traceback (1) =========
    Traceback (most recent call last):
    File "/opt/local/lib/python3.5/site-packages/rpyc/core/protocol.py", line 305, in _dispatch_request
    res = self._HANDLERS[handler](self, *args)
    File "/opt/local/lib/python3.5/site-packages/rpyc/core/protocol.py", line 535, in _handle_call
    return self._local_objects[oid](*args, **dict%28kwargs%29)
    File "/opt/local/lib/python3.5/site-packages/flexget/ipc.py", line 81, in exposed_handle_cli
    self.manager.handle_cli(options)
    File "/opt/local/lib/python3.5/contextlib.py", line 77, in exit
    self.gen.throw(type, value, traceback)
    File "/opt/local/lib/python3.5/site-packages/flexget/logger.py", line 83, in capture_output
    yield
    File "/opt/local/lib/python3.5/site-packages/flexget/ipc.py", line 81, in exposed_handle_cli
    self.manager.handle_cli(options)
    File "/opt/local/lib/python3.5/site-packages/flexget/manager.py", line 334, in handle_cli
    self.execute_command(command_options)
    File "/opt/local/lib/python3.5/site-packages/flexget/manager.py", line 366, in execute_command
    self.task_queue.start()
    File "/opt/local/lib/python3.5/site-packages/flexget/task_queue.py", line 36, in start
    self._thread.start()
    File "/opt/local/lib/python3.5/threading.py", line 840, in start
    raise RuntimeError("threads can only be started once")
    RuntimeError: threads can only be started once

  2. crawln45 commented on Aug 12, 2016

    @crawln45
    Contributor

    try running

    flexget --verbose execute
    

    See if it still crashes.

  3. jordanade commented on Sep 9, 2016

    @jordanade

    With that I get:

    $ flexget --verbose execute
    There is a FlexGet process already running for this config, sending execution there.
    usage: flexget [-h] [-V] [--test] [-c CONFIG] [--logfile LOGFILE]
                   [--loglevel LEVEL] [--bugreport] [--profile [OUTFILE]] [--cron]
                   [--debug-db-sessions] [--debug-warnings]
                   <command> ...
    flexget: error: unrecognized arguments: --verbose
    
  4. jordanade commented on Sep 16, 2016

    @jordanade

    Assuming you meant "flexget execute --verbose", it makes no difference. Still crashes with "RuntimeError: threads can only be started once" and no additional detail. Also same result with latest version 2.3.27.

  5. xmun2k commented on Oct 6, 2016

    @xmun2k

    I have this issue as well. Running 2.3.41 with Python3

  6. liiight commented on Oct 6, 2016

    @liiight
    Member

    @gazpachoking any clue?

  7. xmun2k commented on Oct 6, 2016

    @xmun2k

    It seems to be something related to Python3 - I reverted back to Python27 and i'm not having this issue anymore.

  8. fabrizio5680 commented on Oct 19, 2016

    @fabrizio5680
    Author

    Still occurring running 2.3.42 and Python 3.5.1, while in daemon. Running flexget execute with any flags or none.

  9. jordanade commented on Oct 19, 2016

    @jordanade

    Sometimes I restart and the problem goes away...hmm

  10. gazpachoking commented on Nov 2, 2016

    @gazpachoking
    Member

    So, do any of you have any other errors before this? It looks like somehow one of the threads the daemon is supposed to be running has died at some point before you get the posted error message. I'm interested if we can get to the bottom of why that thread died.

  11. added a commit that references this issue on Nov 2, 2016
  12. reopened this on Nov 2, 2016
  13. jordanade commented on Nov 4, 2016

    @jordanade

    Where would I look to find these other errors? My flexget.log just has normal stuff in it.

  14. fabrizio5680 commented on Nov 14, 2016

    @fabrizio5680
    Author

    Can say using flexget 2.5.19 and not seeing this error

  15. cvium commented on Nov 14, 2016

    @cvium
    Contributor

    That's not too surprising since I fixed the crash, but there's still the underlying issue of the task queue thread dying unexpectedly.

    Look in your logs for an ERROR with the text Task queue has died unexpectedly. Restarting it

  16. jordanade commented on Dec 10, 2016

    @jordanade

    Don't see that error in my logs.

  17. gazpachoking commented on Jan 15, 2019

    @gazpachoking
    Member

    Haven't seen any action here, hoping this is squashed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions