-
Notifications
You must be signed in to change notification settings - Fork 63
Open
Description
This method is asynchronous but performs a blocking write!
https://github.com/bluesky/tiled/blob/main/tiled/adapters/zarr.py#L148-L156
The read* and write* methods are allowed to be synchronous or asynchronous; when called by the server they are wrapped in a helper function that pushes synchronous methods to a thread:
Lines 736 to 742 in 0388f21
| async def ensure_awaitable(func, *args, **kwargs): | |
| if is_coroutine_callable(func): | |
| return await func(*args, **kwargs) | |
| else: | |
| # run_sync() does not apply **kwargs to func | |
| # https://github.com/agronholm/anyio/issues/414 | |
| return await anyio.to_thread.run_sync(functools.partial(func, **kwargs), *args) |
But of course this mechanism is thwarted when we put synchronous I/O code inside an asynchronous method. This kind of bug seriously harms the scalability of the server, as the entire event loop will grind to a halt while processing this request.
The methods on this Adapter and others should be reviewed for correctness.
Kezzsim
Metadata
Metadata
Assignees
Labels
No labels