-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems with background threads #53
Comments
fsspec might find this useful. We have an unreliable guard against |
Sounds good. I don't think that opened files are a problem, at least not as long as they are not asynchronous, see man fork. I did not have problems with those and I think that I open some before the fork and it works after the work.
Here is the libfuse wiki mentioning the problem with threads and fork and the recommendation to start those in the Btw, currently, I simply have this check to avoid hangs. (Argh, and while linking this, I noticed that the |
It is good practice, I suppose, but still you need remediation in the case you have threads but then want to fork. Note that even a console ipython session has extra threads, which is only a problem if you try to do anything with them; they don't exist in the child.
(If you pass a thread object to the child, you can still check |
I am trying to use this library with FUSE. However, I have noticed:
SSHFileSystem
seems to start background threads. I have this problem myself in rapidgzip with the thread pool, for which I added a method to join all threads, so that the process can be forked into the background, where the thread pool gets automatically restarted on first usage. It would be nice to have a similar API for SSHFilesystem.The running threads according to
import threading; threading.enumerate()
are: MainThread, fsspecIO,asyncio_0
. Maybe I am running into #42 Then again, looking at the code, it does not seem like there is any logic for joining or canceling that thread at all!?On further inspection, the program also hangs inside
sshfs.file.SSHFile.close
when calling it manually, which itself hangs in SSHFile._close, which itself hangs in fsspec.asyn.sync_wrapper, which hangs in this loop.It would already be helpful if
SSHFile.close
would forward kwargs like all the other methods that are initialized with__mirror_method
, so that an argument withtimeout = 3
, for example, can be specified. Some kind of timeout should then also be used in__exit__
.The text was updated successfully, but these errors were encountered: