You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Missing rectangles in zarr dataset loaded from GCS #691
I have had some issue with loading slices from some zarr dataset stored on GCS. I don't know where the problem could be coming from so am posting it here in case someone has experienced something similar.
The figure below shows what is going on. Upon slicing and loading some zarr dataset stored on GCS using xarray, I'm getting missing squares (often in the northern hemisphere). The squares change their positions each time I reload the same slice, sometimes they appear for one single variable, sometimes for more than one (at different locations), sometimes they don't happen at all. The rectangle sizes match the chunking which for this dataset corresponds to 25 degrees in lat/lon so it looks like entire chunks are randomly failing to be transferred for some reason.
Has someone seen something similar or would have an idea about this please?
Perhaps GCS is not returning the data reliably? So @martindurant might have some suggestions on how to get some debugging out of gcsfs. I seem to recall a trick to turn on http logging.
Sorry for taking long to reply, I am only now getting back on this. Thanks for the suggestions @rabernat, @martindurant. There is nothing obvious from those logs though, and the problem still persists, intermittently. I may try and recreate this zarr dataset and check again. I'd be interested to hear if someone has found some similar behaviour in the past, this looks like a bit of a serious issue and I don't know where it would be coming from..
I'm seeing similar intermittent errors with data in the gs://pangeo-parcels bucket.
Here's a gist showing that calculations fail with group not found at pathValueErrors and, if computation is done with retries=10, the statistics change intermittently:
I honestly cannot think of why this is happening - help appreciated in debugging when/how this happens, the exact error, etc. If it happens in one thread, apparently not a race condition or effect of session sharing. If we are lucky, it is merely one particular exception from the remote backend which we don't consider as retriable, but should (e.g., API rate limit).
Waiting for the OK from @willirath ; who may want to run with Client() (i.e., a LocalCluster of dask processes, launched from the same environment) to test
Zarr deciding that where a chunk does not exist, it should be nan is the right behaviour. The question is, what error is actually coming out of gcsfs (FileNotFound instead of some permission error in the file-system layer, and/or IndexError in the mapper) and what errors would be right for zarr. Is gcsfs retrying the underlying error? This info should be in the logs, or else the logging should be improved!
Just to say we're hitting something like this currently, looking at the fsspec code I think there may still be a possibility that transient errors from storage are getting propagated as KeyErrors to zarr, which then fills in the chunk with missing data. Have raised an issue here: fsspec/filesystem_spec#255.
We're currently using this workaround which can be used where you know all chunks should be there for an array, i.e., you never expect a KeyError to get raised from the store for any reason.
Over in pydata/xarray#3831, we have been discussing how to set up ecosystem-wide integration testing for all of the interconnected packages one needs to use xarray + zarr on the cloud. I'd love to get your thoughts on how best to do this.
Activity
rabernat commentedon Aug 12, 2019
Hi @rafa-guedes - could you share more information about your dataset? Like the xarray repr and the zarr
.infoproperty of one of the arrays?rafa-guedes commentedon Aug 12, 2019
Hi @rabernat please find some more info below.
rabernat commentedon Aug 14, 2019
Perhaps GCS is not returning the data reliably? So @martindurant might have some suggestions on how to get some debugging out of gcsfs. I seem to recall a trick to turn on http logging.
martindurant commentedon Aug 14, 2019
You can set the level
gcsfs.core.logger.set_level("DEBUG"), so long as you have some logging initialised (likelogging.basicConfig()).rafa-guedes commentedon Sep 13, 2019
Sorry for taking long to reply, I am only now getting back on this. Thanks for the suggestions @rabernat, @martindurant. There is nothing obvious from those logs though, and the problem still persists, intermittently. I may try and recreate this zarr dataset and check again. I'd be interested to hear if someone has found some similar behaviour in the past, this looks like a bit of a serious issue and I don't know where it would be coming from..
willirath commentedon Oct 1, 2019
I'm seeing similar intermittent errors with data in the gs://pangeo-parcels bucket.
Here's a gist showing that calculations fail with
group not found at pathValueErrorsand, if computation is done withretries=10, the statistics change intermittently:https://nbviewer.jupyter.org/gist/willirath/b7af4bc9a93a79b81772910f8ee5c630
willirath commentedon Oct 1, 2019
Is there a way of forcing Zarr to retry if a chunk cannot be read rather than setting the chunk to all NaNs?
rabernat commentedon Oct 1, 2019
martindurant commentedon Oct 1, 2019
Does it happen if you set the number of threads per worker to one?
willirath commentedon Oct 1, 2019
Yes, configuring
KubeClusterto use--nthreads 2does not seem to change anything.martindurant commentedon Oct 1, 2019
and
--nthreads 1?willirath commentedon Oct 1, 2019
Errr, yes, I meant and --nthreads 1.
martindurant commentedon Oct 1, 2019
I honestly cannot think of why this is happening - help appreciated in debugging when/how this happens, the exact error, etc. If it happens in one thread, apparently not a race condition or effect of session sharing. If we are lucky, it is merely one particular exception from the remote backend which we don't consider as retriable, but should (e.g., API rate limit).
willirath commentedon Oct 1, 2019
Is there an easy way of preventing GCSFS from retrying at all?
martindurant commentedon Oct 1, 2019
Not super-easy: the GCSFileSystem class has an attribute
.retries, so this can be set to 1 in every worker with aclient.runcallI would also run with
GCSFS_DEBUG=truegcsfs.utils.is_retriable is the place where errors are sorted.
26 remaining items
martindurant commentedon Oct 11, 2019
Finished without a NaN:
(I do this via the dask array so that I don't have to worry about interpretation of NaN - even one would make the result be NaN)
rafa-guedes commentedon Oct 12, 2019
Could we close this?
martindurant commentedon Oct 12, 2019
Waiting for the OK from @willirath ; who may want to run with
Client()(i.e., a LocalCluster of dask processes, launched from the same environment) to testwillirath commentedon Oct 12, 2019
I've just created a setup with KubeCluster on the pangeo binder. Stay tuned...
willirath commentedon Oct 12, 2019
I still get NaN's.
Gist (still running, so there will be an update) is here: https://gist.github.com/willirath/b40b0b6f281cb1a46fcf848150ca0367
My impression is that the errors occur a lot less frequent. But this might be due to adapted rate limits on the GCS side?
willirath commentedon Oct 12, 2019
rafa-guedes commentedon Oct 14, 2019
I repeated my tests 1000 times now on a 4-worker local cluster, no nans at all for me
martindurant commentedon Oct 14, 2019
OK, so closing this, and maybe @willirath is facing a different issue (another rate limit?). More logging may tell.
willirath commentedon Oct 19, 2019
I've raised zarr-developers/zarr-python#486 hoping to find out how to more easily trigger an Exception upon errors when loading chunks.
martindurant commentedon Oct 19, 2019
Zarr deciding that where a chunk does not exist, it should be nan is the right behaviour. The question is, what error is actually coming out of gcsfs (FileNotFound instead of some permission error in the file-system layer, and/or IndexError in the mapper) and what errors would be right for zarr. Is gcsfs retrying the underlying error? This info should be in the logs, or else the logging should be improved!
alimanfoo commentedon Mar 24, 2020
Just to say we're hitting something like this currently, looking at the fsspec code I think there may still be a possibility that transient errors from storage are getting propagated as
KeyErrorsto zarr, which then fills in the chunk with missing data. Have raised an issue here: fsspec/filesystem_spec#255.alimanfoo commentedon Mar 24, 2020
We're currently using this workaround which can be used where you know all chunks should be there for an array, i.e., you never expect a
KeyErrorto get raised from the store for any reason.alimanfoo commentedon Mar 27, 2020
For information, changes merged upstream in fsspec that should protect against this happening: fsspec/filesystem_spec#259
rabernat commentedon Mar 27, 2020
Thanks for tracking this down @alimanfoo!
Over in pydata/xarray#3831, we have been discussing how to set up ecosystem-wide integration testing for all of the interconnected packages one needs to use xarray + zarr on the cloud. I'd love to get your thoughts on how best to do this.