Replies: 2 comments 7 replies
-
The problem that you are facing is not that there are coroutines waiting to run, but that the showdown code run in the main thread at garbage collection time ideally needs the loop to still be running. I think In any case, it is anticipated that you would either use a filesystem instance in async or blocking mode, not both. If in async more, you would be much better creating the instance within an async context, not what you do here.
An alternative would be to specifically provide the loop in the constructor ( It should be noted that
(which also has an async variant). |
Beta Was this translation helpful? Give feedback.
-
This post is motivated by an error on the CI for this PR: scikit-hep/uproot5#1012 (this other PR is where the error originally appeared and has some useful information too). I tried to come up with a standalone reproducer: I thought if I learn how to properly close all resources then the error would disappear. However it's been difficult to provide a representative reproducer code. After many attempts to figure it out, I think this error is only specific to s3fs but I'm not 100% sure. When I disable the tests involving s3fs, the exception disappears consistently. I would bet that s3fs is not properly closing something but I couldn't find out what. I also couldn't reproduce the error on a brand new repository even if I used the exact same code on a new pytest suite so at this point I don't think this error is ever going to show up but still I would like to fix it (so we can add I would say the problem is somewhere here: https://github.com/fsspec/s3fs/blob/main/s3fs/core.py#L541-L560 but I couldn't find it.
In this code fsspec is not used behind the scenes as it's using a different handler ( |
Beta Was this translation helpful? Give feedback.
-
I am using fsspec to concurrently fetch data. This data is being sent into a queue and processed as soon as it's recieved. For this I am using the async api (
_cat_file
, etc.).I first began by providing my own loop to fsspec but it led to some race conditions that were difficult to fix. Later I found out fsspec provides its own loop via
fsspec.asyn.get_loop
so I used this instead. I understand that fsspec creates a daemon thread that manages this loop and properly closes all resources when the main thread finishes.Below is some code that interfaces with fsspec in way similar to my application. It works but there are some warnings. These warnings sometimes cause the pytest suite to fail so there is something that needs fixing, I just can't find it.
(full log at https://github.com/scikit-hep/uproot5/actions/runs/6616614189/job/17971248151#step:7:880). In this particular case it fails for
fsspec_xrootd
but I've seen this same error fors3fs
.In the code below if I don't try to close the loop, there are no warnings. However this is not the case in my other code (scikit-hep/uproot5#999) so that is the motivation to learn how these resources are managed.
Thanks!
Beta Was this translation helpful? Give feedback.
All reactions