Client cache exception
I have a tiled server that is serving tiff series data using https://github.com/bluesky/tiled/blob/6b1ee862e571a6e6493f5446652996600ec98638/tiled/adapters/tiff.py#L199.
Code that animates each 2D image eventually encounters a client cache exception, listed below. I will try also with similar data that's in h5 and see if I can reproduce there:
Traceback (most recent call last):
File "/opt/miniconda3/envs/tiled_client/lib/python3.11/site-packages/tornado/ioloop.py", line 919, in _run
val = self.callback()
^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/tiled_client/lib/python3.11/site-packages/matplotlib/backend_bases.py", line 1226, in _on_timer
ret = func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/tiled_client/lib/python3.11/site-packages/matplotlib/animation.py", line 1426, in _step
still_going = super()._step(*args)
^^^^^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/tiled_client/lib/python3.11/site-packages/matplotlib/animation.py", line 1119, in _step
self._draw_next_frame(framedata, self._blit)
File "/opt/miniconda3/envs/tiled_client/lib/python3.11/site-packages/matplotlib/animation.py", line 1138, in _draw_next_frame
self._draw_frame(framedata)
File "/opt/miniconda3/envs/tiled_client/lib/python3.11/site-packages/matplotlib/animation.py", line 1767, in _draw_frame
self._drawn_artists = self._func(framedata, *self._args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/var/folders/gt/96zz11ls51542p5f9_cwq9w40000gn/T/ipykernel_11304/583051564.py", line 11, in updatefig
im.set_array(spiral[i])
~~~~~~^^^
File "/opt/miniconda3/envs/tiled_client/lib/python3.11/site-packages/tiled/client/array.py", line 176, in __getitem__
return self.read(slice)
^^^^^^^^^^^^^^^^
File "/opt/miniconda3/envs/tiled_client/lib/python3.11/site-packages/tiled/client/array.py", line 256, in read
...
File "/opt/miniconda3/envs/tiled_client/lib/python3.11/site-packages/tiled/client/cache.py", line 198, in load_content
f"{len(content):_}",
^^^^^^^^^^^^
TypeError: object of type 'NoneType' has no len()```
This is likely to be resolved when we completely rewrite the client cache, any day now. But to be safe I will leave this open so we can verify that.
This entire module was erased and rewritten from scratch so I feel confident that this exact bug is gone. It would be still be useful for @dylanmcreynolds to confirm that the new cache interacts OK with his TIFF series.
This is in v0.1.0a99 now. Note that the cache is (still) off by default, so to exercise it and test this you have to do something like:
from tiled.client.cache import Cache
c = from_uri("...", cache=Cache())
It's been about a year and this hasn't come up again so I will assume that the cache rewrite resolved the issue.