Package: x2gobroker
Version: 0.0.4.0-3

Approximately half the time, wget -O - http://127.0.0.1/x2gobroker/
yields a 500 Internal Server Error. /var/log/x2gobroker/wsgi.log shows
the following:

> wsgilog.log: Mon, 18 Mar 2019 16:01:12 ERROR Server got itself in trouble
> Traceback (most recent call last):
>   File "/usr/lib/python3/dist-packages/wsgilog/__init__.py", line 192, in 
> __call__
>     return self.application(environ, start_response)
>   File "/usr/lib/x2gobroker/wsgi/x2gobroker-wsgi", line 408, in _application
>     return _tornado_application(environ, start_response)
>   File "/usr/lib/python3/dist-packages/tornado/wsgi.py", line 83, in __call__
>     return WSGIAdapter(self)(environ, start_response)
>   File "/usr/lib/python3/dist-packages/tornado/wsgi.py", line 242, in __call__
>     self.application(request)
>   File "/usr/lib/python3/dist-packages/tornado/wsgi.py", line 207, in <lambda>
>     application, request)
>   File "/usr/lib/python3/dist-packages/tornado/web.py", line 2097, in __call__
>     return dispatcher.execute()
>   File "/usr/lib/python3/dist-packages/tornado/web.py", line 2228, in execute
>     **self.path_kwargs)
>   File "/usr/lib/python3/dist-packages/tornado/gen.py", line 297, in wrapper
>     future = _create_future()
>   File "/usr/lib/python3/dist-packages/tornado/gen.py", line 187, in 
> _create_future
>     future = Future()
>   File "/usr/lib/python3.7/asyncio/events.py", line 644, in get_event_loop
>     % threading.current_thread().name)
> RuntimeError: There is no current event loop in thread 'Dummy-1'.
This issue appears to be the same as in this tornado bug:

https://github.com/tornadoweb/tornado/issues/2371

The following workaround is suggested:

> import asyncio
> from tornado.platform.asyncio import AnyThreadEventLoopPolicy
> asyncio.set_event_loop_policy(AnyThreadEventLoopPolicy())

The error disappeared after adding these lines right after "### launch
as WSGI application ###" in /usr/bin/x2gobroker.

I am using a freshly installed Debian testing VM with two vCPUs. I used
the following command to install the packages: apt install apache2
x2gobroker x2gobroker-wsgi. To get this result I also had to apply the
fixes to my two recent bug reports on x2gobroker and x2gobroker-wsgi.

Reply via email to