Question: Is ThreadPoolExecutor
a known incompatible library?
#1140
Replies: 5 comments
-
Interesting... I haven't seen this yet, probably because nobody has used The behavior is strange though. So far, the problems usually appear as a faked file function trying to access a real file or vice verse, resulting in an exception, mostly |
Beta Was this translation helpful? Give feedback.
-
If I find time this week, I could try to isolate this to an streamlined example. I guess this is further complicated by also using:
If I don't find time before the holidays, I'll at least point you to the project code:
Maybe I have some battle scars from my IoT days, but I suppose I could have some of these problematic tests write to actual disk. PITA I could probably work around for local testing, but shouldn't be an issue on the GitHub Action runners. |
Beta Was this translation helpful? Give feedback.
-
Thank you! I'm also not sure when I will tackle this - I've a couple of other things in my queue, and there are the holidays of course. If you are doing more integrated tests, sometimes you can't get around using the real filesystem. A good compromise is to use a RAM disk as file system, if that is possible, that would cleaning it up easy. Anyway I'm interested to understand the problem, even if cannot be fixed easily - it sounds a bit wierd. |
Beta Was this translation helpful? Give feedback.
-
I've had some issues with mixing I've thought about using a RAM disk or setting up a local container to run these in, but that's a lot of overhead and maintenance I'd like to try to avoid. The more steps I add to my setup process, the less likely folks will be willing to try to fork and contribute to the project. I'm sure I could find a way to streamline that, but the appeal to me to use Total props for maintaining this project btw, I've really enjoyed using it so far. |
Beta Was this translation helpful? Give feedback.
-
As the real discussion happened in the other repo, I'm copying the relevant comments over from there, and will turn this into a discussion issue.
Originally posted by @mrbean-bremen in #265
Originally posted by @schuylermartin45 in #265
Originally posted by @mrbean-bremen in #265
Originally posted by @schuylermartin45 in #265
Originally posted by @mrbean-bremen in #265 |
Beta Was this translation helpful? Give feedback.
-
Describe the bug
Not sure if this is a bug yet, as much as a sanity check/question. I recently started using the
ThreadPoolExecutor
context fromconcurrent.futures
to parallelize network requests.I've had tests running using
pyfakefs
for about a month or so now. As soon as I added the thread pool, some tests started taking a significant amount of time. I'm talking about from going from milliseconds to 30 seconds.I thought it was a deadlock at first but the tests always eventually resolve. There is also no such slow down outside of the testing environment. Although I haven't ruled everything out, if I disable
pyfakefs
, the issue disappears.I assume this is caused for much the same reasons why
subprocess
andmultiprocessing
have known compatibility issues. I mean we are talking threads and not processes, but they probably make similar low-level calls.So here's my question: is
concurrent.futures
another library with known compatibility issues? Should it be added to the documentation I linked to above? Does the same go for the older ThreadPool library?And is there a general recommendation for working around this kind of issue? I don't really want to disable the thread pool just for the tests and I also need
pyfakefs
to mock the file system.Let me know if you would like more context or details. All of this is in an open conda project so I can grab some GitHub Action logs if that would be useful. Thanks!
Beta Was this translation helpful? Give feedback.
All reactions