Infinite loop with multiprocessing #950
-
Describe the bug
This then requires a This is probably related to #570 How To Reproduce from pyfakefs.fake_filesystem_unittest import TestCase
from multiprocessing import shared_memory
class ExampleTestCase(TestCase):
def setUp(self):
self.setUpPyfakefs()
def test_shared_memory(self):
mem = shared_memory.SharedMemory(name="test", create=True, size=128)
mem.close()
mem.unlink() Your environment
|
Beta Was this translation helpful? Give feedback.
Replies: 3 comments
-
Unfortunately, this won't work, at least not out of the box, due to the limitations of I could not reproduce the inifinite loop so far, but I got another error related to the mentioned problem. Currently, I don't have a solution for this (other than patching it away). |
Beta Was this translation helpful? Give feedback.
-
Thanks for having a look. |
Beta Was this translation helpful? Give feedback.
-
Not really. The problem is the mixture of faked on non-faked calls, e.g. the usage of faked descriptors in the real fs and vice verse. Even if you would map this into the fake fs, the returned descriptors would still be from the real fs (due to the C calls), which do not exist in the fake fs (or if they do exist, they point to something else, which could lead to all kinds of undefined behavior). |
Beta Was this translation helpful? Give feedback.
Unfortunately, this won't work, at least not out of the box, due to the limitations of
pyfakefs
. Multiprocessing is one of the modules not playing nice withpyfakefs
due to the use of system C functions to access the file system. In this case, it usesposixshmem
, which is a C module, to access the shared memory. This will work in the real filesystem, so either the file is not found, or if the file exists there, a real file descriptor is returned, which is not found in the fake filesystem.I could not reproduce the inifinite loop so far, but I got another error related to the mentioned problem. Currently, I don't have a solution for this (other than patching it away).