Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tornado5 #9448

Closed
wants to merge 2 commits into from
Closed

Tornado5 #9448

wants to merge 2 commits into from

Conversation

scottbelden
Copy link

Resolves #8913

Testing Plan: Ran ./tools/test-all

A few notes:

Running API tests...
2018-05-17 17:42:25.094 INFO [] Tornado   0.0% busy over the past  0.3 seconds
2018-05-17 17:42:25.246 WARN [django.server] "POST /api/v1/users HTTP/1.1" 400 67
2018-05-17 17:42:25.500 INFO [process_queue] Not using RabbitMQ queue workers in the test suite.
2018-05-17 17:42:25.904 ERR  [] Traceback (most recent call last):
  File "/srv/zulip-py3-venv/lib/python3.4/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/srv/zulip-py3-venv/lib/python3.4/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/srv/zulip/zerver/lib/rest.py", line 131, in rest_dispatch
    return target_function(request, **kwargs)
  File "/srv/zulip/zerver/decorator.py", line 607, in _wrapped_view_func
    return view_func(request, *args, **kwargs)
  File "/srv/zulip-py3-venv/lib/python3.4/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/srv/zulip/zerver/decorator.py", line 577, in _wrapped_func_arguments
    raise err
  File "/srv/zulip/zerver/decorator.py", line 570, in _wrapped_func_arguments
    return rate_limit()(view_func)(request, profile, *args, **kwargs)
  File "/srv/zulip/zerver/decorator.py", line 755, in wrapped_func
    return func(request, *args, **kwargs)
  File "/srv/zulip/zerver/lib/request.py", line 187, in _wrapped_view_func
    return view_func(request, *args, **kwargs)
  File "/srv/zulip/zerver/views/streams.py", line 249, in remove_subscriptions_backend
    acting_user=user_profile)
  File "/srv/zulip/zerver/lib/actions.py", line 2634, in bulk_remove_subscriptions
    queue_json_publish("deferred_work", event)
  File "/srv/zulip/zerver/lib/queue.py", line 317, in queue_json_publish
    from zerver.worker.queue_processors import get_worker
  File "/srv/zulip/zerver/worker/queue_processors.py", line 36, in <module>
    from zerver.tornado.socket import req_redis_key, respond_send_message
  File "/srv/zulip/zerver/tornado/socket.py", line 277, in <module>
    'disabled_transports': ['eventsource', 'htmlfile']})
  File "/srv/zulip-py3-venv/lib/python3.4/site-packages/sockjs/tornado/router.py", line 94, in __init__
    self.io_loop = io_loop or ioloop.IOLoop.instance()
  File "/srv/zulip-py3-venv/lib/python3.4/site-packages/tornado/ioloop.py", line 221, in instance
    return IOLoop.current()
  File "/srv/zulip-py3-venv/lib/python3.4/site-packages/tornado/ioloop.py", line 282, in current
    loop = asyncio.get_event_loop()
  File "/usr/lib/python3.4/asyncio/events.py", line 576, in get_event_loop
    return get_event_loop_policy().get_event_loop()
  File "/usr/lib/python3.4/asyncio/events.py", line 522, in get_event_loop
    % threading.current_thread().name)
RuntimeError: There is no current event loop in thread 'Thread-22'.
  • This doesn't subclass or do anything to Tornado's AsyncIOLoop. Their docs (https://github.com/tornadoweb/tornado/blob/branch5.0/tornado/platform/asyncio.py#L167-L237) seem to imply that referencing those classes is deprecated. Instead we use the Policy to make sure that when tornado calls asyncio.get_event_loop() it returns our custom event loop. One way I verified this manually was to modify the tornado source at tornado.platform.asyncio to add this print statement:
class BaseAsyncIOLoop(IOLoop):
    def initialize(self, asyncio_loop, **kwargs):
        self.asyncio_loop = asyncio_loop
        print('--- BaseAsyncIOLoop: init asyncio loop: {}'.format(asyncio_loop))

NOTE: If you have that print in and run the dev script, the first print will still be the standard Unix event loop rather than our custom one. This is because that script starts the ioloop without setting the policy: https://github.com/zulip/zulip/blob/master/tools/run-dev.py#L417-L422.

@timabbott Let me know if there are any changes you would like. Hopefully this all makes sense...

@zulipbot zulipbot added size: XL area: dependencies difficult Issues which we expect to be quite difficult labels May 17, 2018
@zulipbot
Copy link
Member

Hello @zulip/server-dependencies members, this pull request was labeled with the "area: dependencies" label, so you may want to check it out!

@scottbelden
Copy link
Author

Is the python 3.5 test failure due to the changes here or was that just something that periodically fails?

@timabbott
Copy link
Sponsor Member

I haven't seen that one fail nondeterministically; let me try to reproduce.

@timabbott
Copy link
Sponsor Member

It looks like it's having a problem with installing this: sinwar/sockjs-tornado@b31696b

@sinwar did you do anything with that branch recently?

@scottbelden scottbelden force-pushed the tornado5 branch 2 times, most recently from fbd10c9 to 0f22190 Compare May 22, 2018 11:48
@zulipbot
Copy link
Member

Heads up @scottbelden, we just merged some commits that conflict with the changes your made in this pull request! You can review this repository's recent commits to see where the conflicts occur. Please rebase your feature branch against the upstream/master branch and resolve your pull request's merge conflicts accordingly.

@andersk
Copy link
Member

andersk commented May 3, 2022

Closed in favor of

@andersk andersk closed this May 3, 2022
@scottbelden scottbelden deleted the tornado5 branch May 3, 2022 03:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: dependencies difficult Issues which we expect to be quite difficult has conflicts size: XL
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade tornado to latest version
5 participants