Skip to content

Conversation

@aggieNick02
Copy link

@aggieNick02 aggieNick02 commented Nov 15, 2022

long time (9 years).

We do this by using spawn.get_preparation_data() and then using the values in that dictionary appropriately. This lets us also fix the setting of sys.path (which never worked) and other minor properties of the forkserver process.

While updating the test to verify these fixes, we also discovered that forkserver was not flushing stdout/stderr before it forked to create a new process. This caused the updated test to fail because unflushed output in the forkserver would then be printed by the forked process as well. This is now fixed too.

…n for a

long time (9 years).

We do this by using spawn.get_preparation_data() and then using the
values in that dictionary appropriately. This lets us also fix the
setting of sys.path (which never worked) and other minor properties of
the forkserver process.

While updating the test to verify these fixes, we also discovered that
forkserver was not flushing stdout/stderr before it forked to create a
new process. This caused the updated test to fail because unflushed
output in the forkserver would then be printed by the forked process as
well. This is now fixed too.
@aggieNick02
Copy link
Author

One minor thing I noticed incase @pitrou remembers from several years ago. In Lib/test/mp_preload.py, the file begins with an import multiprocessing then multiprocessing.Lock() . Any idea what purpose the call to multiprocessing.Lock() serves? Some sort of required initialization?

@pitrou
Copy link
Member

pitrou commented Nov 16, 2022

@aggieNick02 I suppose it's a simple check that multiprocessing is usable from a preloaded module?

@aggieNick02
Copy link
Author

@aggieNick02 I suppose it's a simple check that multiprocessing is usable from a preloaded module?

Ah ok, thanks!

@brettcannon brettcannon removed their request for review November 16, 2022 21:47
@thesamesam
Copy link
Contributor

Is this one obsolete ("dupe" of #126631 and #135295)?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants