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

sqlite3.OperationalError: database is locked during __aexit__ #1816

Closed
atemate opened this issue Nov 5, 2020 · 2 comments
Closed

sqlite3.OperationalError: database is locked during __aexit__ #1816

atemate opened this issue Nov 5, 2020 · 2 comments

Comments

@atemate
Copy link
Contributor

atemate commented Nov 5, 2020

Code


async def _parse_neuro_image(image: str) -> neuro_api.RemoteImage:
    async with neuro_api.get() as client:
        return client.parse.remote_image(image)

runs in parallel (5 parallel processes). Sometimes we get errors:

Exception ignored in: <function BaseEventLoop.__del__ at 0x7f45726a94d0>
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/asyncio/base_events.py", line 626, in __del__
    source=self)
ResourceWarning: unclosed event loop <_UnixSelectorEventLoop running=False closed=False debug=False>
Exception ignored in: <socket.socket fd=21, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: unclosed <socket.socket fd=21, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
Exception ignored in: <socket.socket fd=22, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: unclosed <socket.socket fd=22, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
Traceback (most recent call last):
  File "/opt/hostedtoolcache/Python/3.7.9/x64/bin/neuro-extras", line 33, in <module>
    sys.exit(load_entry_point('neuro-extras', 'console_scripts', 'neuro-extras')())
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/home/runner/work/neuro-extras/neuro-extras/neuro_extras/main.py", line 865, in image_build
    force_overwrite=force_overwrite,
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/neuromation/cli/asyncio_utils.py", line 122, in run
    return runner.run(main)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/neuromation/cli/asyncio_utils.py", line 54, in run
    return self._loop.run_until_complete(main_task)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/asyncio/base_events.py", line 587, in run_until_complete
    return future.result()
  File "/home/runner/work/neuro-extras/neuro-extras/neuro_extras/main.py", line 760, in _build_image
    target_image = await _parse_neuro_image(image_uri)
  File "/home/runner/work/neuro-extras/neuro-extras/neuro_extras/main.py", line 232, in _parse_neuro_image
    return client.parse.remote_image(image)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/neuromation/api/utils.py", line 86, in __aexit__
    await self._ret.close()  # type: ignore
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/neuromation/api/client.py", line 60, in close
    self._core._save_cookies(db)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/neuromation/api/core.py", line 87, in _save_cookies
    _save_cookies(db, to_save)
  File "/opt/hostedtoolcache/Python/3.7.9/x64/lib/python3.7/site-packages/neuromation/api/core.py", line 227, in _save_cookies
    (cookie.key, cookie["domain"], cookie["path"], cookie.value, now),
sqlite3.OperationalError: database is locked
@asvetlov
Copy link
Contributor

asvetlov commented Nov 6, 2020

I think we can just suppress such errors.
There is nothing critical if the storage cookie is not saved on conflict.

@asvetlov
Copy link
Contributor

Fixed by #1816

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants