Skip to content

Mopidy doesn't exit with Tornado v5.0+ #1715

@kingosticks

Description

@kingosticks

When the HTTP extension is enabled, Mopidy with Tornado v5.0+ does not exit on receiving SIGINT. The logging shows the following and then seemingly hangs and must be killed:

^CINFO     2018-10-20 17:29:18,911 [11390:MainThread] mopidy.commands
  Interrupted. Exiting...
INFO     2018-10-20 17:29:18,912 [11390:MainThread] mopidy.commands
  Stopping Mopidy frontends
INFO     2018-10-20 17:29:18,921 [11390:MainThread] mopidy.commands
  Stopping Mopidy core
INFO     2018-10-20 17:29:18,922 [11390:MainThread] mopidy.commands
  Stopping Mopidy backends
INFO     2018-10-20 17:29:18,964 [11390:MainThread] mopidy.commands
  Stopping Mopidy audio
INFO     2018-10-20 17:29:18,966 [11390:MainThread] mopidy.commands
  Stopping Mopidy mixer

Mopidy exits cleanly when the HTTP extension is disabled.

This appears to be related to our usage of IOLoop.instance when stopping:

IOLoop.instance is now a deprecated alias for IOLoop.current. Applications that need the cross-thread communication behavior facilitated by IOLoop.instance should use their own global variable instead.

Deprecated alias for IOLoop.current().

Changed in version 5.0: Previously, this method returned a global singleton IOLoop, in contrast with the per-thread IOLoop returned by current(). In nearly all cases the two were the same (when they differed, it was generally used from non-Tornado threads to communicate back to the main thread’s IOLoop).

Reported a few times, most recently at https://discourse.mopidy.com/t/mopidy-as-service-at-shutdown/2826/

Metadata

Metadata

Assignees

Labels

A-httpArea: HTTP frontend

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions