github
html_url | issue_url | id | node_id | user | created_at | updated_at | author_association | body | reactions | issue | performed_via_github_app |
---|---|---|---|---|---|---|---|---|---|---|---|
https://github.com/simonw/datasette/pull/1481#issuecomment-945020210 | https://api.github.com/repos/simonw/datasette/issues/1481 | 945020210 | IC_kwDOBm6k_c44U90y | 9599 | 2021-10-16T23:19:51Z | 2021-10-16T23:19:51Z | OWNER | Since that Janus PR hasn't been merged yet, one temporary option for a fix would be to entirely vendor the fixed Janus - https://github.com/aio-libs/janus/blob/9e13d3fb74e2c93d7501443b370a455d1b302b1f/janus/__init__.py - since it's only a single module. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 | |
https://github.com/simonw/datasette/pull/1481#issuecomment-944986367 | https://api.github.com/repos/simonw/datasette/issues/1481 | 944986367 | IC_kwDOBm6k_c44U1j_ | 9599 | 2021-10-16T19:07:38Z | 2021-10-16T19:09:02Z | OWNER | This is blocking an upgrade for the Homebrew Datasette package: https://github.com/Homebrew/homebrew-core/pull/86932 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 | |
https://github.com/simonw/datasette/pull/1481#issuecomment-939185319 | https://api.github.com/repos/simonw/datasette/issues/1481 | 939185319 | IC_kwDOBm6k_c43-tSn | 9599 | 2021-10-09T00:04:54Z | 2021-10-09T00:04:54Z | OWNER | I applied my PR against Janus to my local copy of Datasette like so: pip uninstall janus pip install https://github.com/aio-libs/janus/archive/9e13d3fb74e2c93d7501443b370a455d1b302b1f.zip Then I ran the Datasette tests and got a much happier pass rate. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 | |
https://github.com/simonw/datasette/pull/1481#issuecomment-939180313 | https://api.github.com/repos/simonw/datasette/issues/1481 | 939180313 | IC_kwDOBm6k_c43-sEZ | 9599 | 2021-10-08T23:41:39Z | 2021-10-08T23:41:39Z | OWNER | I submitted a PR to Janus with a workaround for this: https://github.com/aio-libs/janus/pull/359 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 | |
https://github.com/simonw/datasette/pull/1481#issuecomment-939100803 | https://api.github.com/repos/simonw/datasette/issues/1481 | 939100803 | IC_kwDOBm6k_c43-YqD | 9599 | 2021-10-08T20:33:42Z | 2021-10-08T20:33:42Z | OWNER | There's a tiny chance this could be a bug in Python 3.10 itself - I filed an issue here: https://bugs.python.org/issue45416 - in which I said: > In Python 3.10 it is not possible to instantiate an asyncio.Condition that wraps an asyncio.Lock without raising a "loop argument must agree with lock" exception. > > This code raises that exception: > > asyncio.Condition(asyncio.Lock()) > > This worked in previous Python versions. > > Note that the error only occurs if an event loop is running. Here's a simple script that replicates the problem: > > import asyncio > > # This runs without an exception: > print(asyncio.Condition(asyncio.Lock())) > > # This does not work: > async def example(): > print(asyncio.Condition(asyncio.Lock())) > > # This raises "ValueError: loop argument must agree with lock": > asyncio.run(example()) | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 | |
https://github.com/simonw/datasette/pull/1481#issuecomment-939079727 | https://api.github.com/repos/simonw/datasette/issues/1481 | 939079727 | IC_kwDOBm6k_c43-Tgv | 9599 | 2021-10-08T19:50:52Z | 2021-10-08T19:50:52Z | OWNER | And here's the relevant Janus code: https://github.com/aio-libs/janus/blob/d7970f8b76bcac2e087067ca4575ac845e481874/janus/__init__.py#L24-L42 ```python class Queue(Generic[T]): def __init__(self, maxsize: int = 0) -> None: self._loop = current_loop() self._maxsize = maxsize self._init(maxsize) self._unfinished_tasks = 0 self._sync_mutex = threading.Lock() self._sync_not_empty = threading.Condition(self._sync_mutex) self._sync_not_full = threading.Condition(self._sync_mutex) self._all_tasks_done = threading.Condition(self._sync_mutex) self._async_mutex = asyncio.Lock() # "loop argument must agree with lock" exception is raised here: self._async_not_empty = asyncio.Condition(self._async_mutex) self._async_not_full = asyncio.Condition(self._async_mutex) self._finished = asyncio.Event() self._finished.set() ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 | |
https://github.com/simonw/datasette/pull/1481#issuecomment-939078872 | https://api.github.com/repos/simonw/datasette/issues/1481 | 939078872 | IC_kwDOBm6k_c43-TTY | 9599 | 2021-10-08T19:49:08Z | 2021-10-08T19:49:08Z | OWNER | Here's the code that raises that error: https://github.com/python/cpython/blob/bb3e0c240bc60fe08d332ff5955d54197f79751c/Lib/asyncio/locks.py#L219-L234 ```python class Condition(_ContextManagerMixin, mixins._LoopBoundMixin): """Asynchronous equivalent to threading.Condition. This class implements condition variable objects. A condition variable allows one or more coroutines to wait until they are notified by another coroutine. A new Lock object is created and used as the underlying lock. """ def __init__(self, lock=None, *, loop=mixins._marker): super().__init__(loop=loop) if lock is None: lock = Lock() elif lock._loop is not self._get_loop(): raise ValueError("loop argument must agree with lock") ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 | |
https://github.com/simonw/datasette/pull/1481#issuecomment-939078095 | https://api.github.com/repos/simonw/datasette/issues/1481 | 939078095 | IC_kwDOBm6k_c43-THP | 9599 | 2021-10-08T19:47:29Z | 2021-10-08T19:47:29Z | OWNER | Only mention I can find of that "loop argument must agree with lock" error is here - which doesn't have any tips for a workaround yet: https://giters.com/django/channels_redis/issues/278 | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 | |
https://github.com/simonw/datasette/pull/1481#issuecomment-939076399 | https://api.github.com/repos/simonw/datasette/issues/1481 | 939076399 | IC_kwDOBm6k_c43-Ssv | 9599 | 2021-10-08T19:43:33Z | 2021-10-08T19:43:33Z | OWNER | So maybe this is an issue with Janus? I'm using https://pypi.org/project/janus/ 0.6.1 which is the latest release, from October 2020. | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 | |
https://github.com/simonw/datasette/pull/1481#issuecomment-939075686 | https://api.github.com/repos/simonw/datasette/issues/1481 | 939075686 | IC_kwDOBm6k_c43-Shm | 9599 | 2021-10-08T19:42:00Z | 2021-10-08T19:42:00Z | OWNER | Running `pytest -x --pdb` helped me see this error: ``` File "/Users/simon/Dropbox/Development/datasette/datasette/views/base.py", line 122, in dispatch_request await self.ds.refresh_schemas() File "/Users/simon/Dropbox/Development/datasette/datasette/app.py", line 344, in refresh_schemas await self._refresh_schemas() File "/Users/simon/Dropbox/Development/datasette/datasette/app.py", line 349, in _refresh_schemas await init_internal_db(internal_db) File "/Users/simon/Dropbox/Development/datasette/datasette/utils/internal_db.py", line 5, in init_internal_db await db.execute_write( File "/Users/simon/Dropbox/Development/datasette/datasette/database.py", line 102, in execute_write return await self.execute_write_fn(_inner, block=block) File "/Users/simon/Dropbox/Development/datasette/datasette/database.py", line 113, in execute_write_fn reply_queue = janus.Queue() File "/Users/simon/.local/share/virtualenvs/py310-Z8fTATkJ/lib/python3.10/site-packages/janus/__init__.py", line 39, in __init__ self._async_not_empty = asyncio.Condition(self._async_mutex) File "/Users/simon/.pyenv/versions/3.10.0/lib/python3.10/asyncio/locks.py", line 234, in __init__ raise ValueError("loop argument must agree with lock") ValueError: loop argument must agree with lock ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 | |
https://github.com/simonw/datasette/pull/1481#issuecomment-939074818 | https://api.github.com/repos/simonw/datasette/issues/1481 | 939074818 | IC_kwDOBm6k_c43-SUC | 9599 | 2021-10-08T19:40:23Z | 2021-10-08T19:40:23Z | OWNER | Then I created myself a temporary 3.10 environment using `pipenv` like so: cd /tmp mkdir py310 cd py310 pipenv shell --python /Users/simon/.pyenv/versions/3.10.0/bin/python And used that with my Datasette checkout like so: cd ~/.../datasette pip install -e '.[test]' pytest | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 | |
https://github.com/simonw/datasette/pull/1481#issuecomment-938142436 | https://api.github.com/repos/simonw/datasette/issues/1481 | 938142436 | IC_kwDOBm6k_c436urk | 9599 | 2021-10-07T20:44:43Z | 2021-10-07T20:44:43Z | OWNER | The 3.10 tests failed a lot. Trying to run this locally: ``` /tmp % pyenv install 3.10 python-build: definition not found: 3.10 The following versions contain `3.10' in the name: 3.10.0a6 3.10-dev miniconda-3.10.1 miniconda3-3.10.1 See all available versions with `pyenv install --list'. If the version you need is missing, try upgrading pyenv: brew update && brew upgrade pyenv ``` So trying: brew update && brew upgrade pyenv Then did this: ``` /tmp % brew upgrade pyenv ==> Upgrading 1 outdated package: pyenv 1.2.24.1 -> 2.1.0 ``` This decided to upgrade everything by downloaded everything on the internet. Aah, Homebrew. But it looks like I have `3.10.0` available to `pyenv` now. ``` /tmp % pyenv install 3.10.0 python-build: use openssl@1.1 from homebrew python-build: use readline from homebrew Downloading Python-3.10.0.tar.xz... -> https://www.python.org/ftp/python/3.10.0/Python-3.10.0.tar.xz Installing Python-3.10.0... ... ``` | { "total_count": 0, "+1": 0, "-1": 0, "laugh": 0, "hooray": 0, "confused": 0, "heart": 0, "rocket": 0, "eyes": 0 } |
1020436713 |