Skip to content

azure objstorage: Cannot run the event loop while another loop is running

	

{args: ['Cannot run the event loop while another loop is running'], message: 'Cannot run the event loop while another loop is running', module: 'builtins', traceback: [
'Traceback (most recent call last):\n',
'  File "/usr/lib/python3/dist-packages/swh/objstorage/backends/azure.py", line 83, in call_async\n    return loop.run_until_complete(f(*args))\n',
'  File "/usr/lib/python3.7/asyncio/base_events.py", line 571, in run_until_complete\n    self.run_forever()\n',
'  File "/usr/lib/python3.7/asyncio/base_events.py", line 529, in run_forever\n    \'Cannot run the event loop while another loop is running\')\n',
'RuntimeError: Cannot run the event loop while another loop is running\n',
'\nDuring handling of the above exception, another exception occurred:\n\n',
'Traceback (most recent call last):\n',
'  File "/usr/lib/python3/dist-packages/swh/core/api/asynchronous.py", line 71, in middleware_handler\n    return await handler(request)\n',
'  File "/usr/lib/python3/dist-packages/swh/core/api/asynchronous.py", line 178, in decorated_meth\n    result = obj_meth(**kw)\n',
'  File "/usr/lib/python3/dist-packages/swh/core/db/common.py", line 62, in _meth\n    return meth(self, *args, db=db, cur=cur, **kwargs)\n'
], type: 'RuntimeError'}

This can cause the following error when used by the vault backend to retrieve a bundle:

https://sentry.softwareheritage.org/organizations/swh/issues/8896/?referrer=phabricator_plugin https://sentry.softwareheritage.org/share/issue/b83e5c21aaa1468ca417937bd2600833/

RemoteException: <RemoteException 500 RuntimeError: ['Cannot run the event loop while another loop is running']>
(8 additional frame(s) were not displayed)
...
  File "swh/web/common/archive.py", line 1287, in _vault_request
    return vault_fn(bundle_type, swhid, **kwargs)
  File "swh/core/api/__init__.py", line 181, in meth_
    return self.post(meth._endpoint_path, post_data)
  File "swh/core/api/__init__.py", line 278, in post
    return self._decode_response(response)
  File "swh/core/api/__init__.py", line 354, in _decode_response
    self.raise_for_status(response)
  File "swh/core/api/__init__.py", line 344, in raise_for_status
    raise exception from None

Migrated from T3981 (view on Phabricator)

Edited by Phabricator Migration user