Skip to content

Use uuid.uuid4() as the key in serialization. - #7893

Merged
sklam merged 4 commits into
numba:mainfrom
stuartarchibald:fix/7881
Mar 23, 2022
Merged

sklam merged 4 commits into
numba:mainfrom
stuartarchibald:fix/7881

Conversation

@stuartarchibald

Copy link
Copy Markdown
Contributor

As title, this is to avoid fork()+exec() calls made by uuid1().

Fixes #7881

As title, this is to avoid fork()+exec() calls made by uuid1().

Fixes numba#7881
Comment thread numba/tests/test_withlifting.py Outdated

@linux_only
@needs_strace
def test_no_fork_in_compilation(self):

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to self. This test probably needs to be run as a subprocess test on the basis that previous execution of something which triggers a stateful call e.g. uuid.uuid1.getnode() is pretty likely.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Addressed in d114552

Forces the no fork on compile test to run in a subprocess to
avoid state from already initialised modules.
@stuartarchibald
stuartarchibald marked this pull request as ready for review March 10, 2022 13:09

@sklam sklam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch! uuid4 should be sufficient given its use in cloudpickle and its implementation should never depend on fork (hopefully).

There are a few comments esp. in the strace code regarding the handling of the subprocess

Comment thread numba/core/dispatcher.py
u = self.__uuid
if u is None:
u = str(uuid.uuid1())
u = str(uuid.uuid4())

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: cloudpickle uses uuid4 for tracking unique classes. If it's safe for cloudpickle, it is safe for Numba

Comment thread numba/tests/support.py Outdated
Comment thread numba/tests/support.py Outdated
Comment thread numba/tests/support.py Outdated
Comment thread numba/tests/support.py
@sklam sklam added 4 - Waiting on author Waiting for author to respond to review and removed 3 - Ready for Review labels Mar 16, 2022
@stuartarchibald stuartarchibald added 4 - Waiting on reviewer Waiting for reviewer to respond to author and removed 4 - Waiting on author Waiting for author to respond to review labels Mar 17, 2022
@stuartarchibald stuartarchibald added this to the Numba 0.56 RC milestone Mar 17, 2022

@sklam sklam left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch!

@sklam sklam added 5 - Ready to merge Review and testing done, is ready to merge and removed 4 - Waiting on reviewer Waiting for reviewer to respond to author labels Mar 23, 2022
@sklam
sklam merged commit 9752c87 into numba:main Mar 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

5 - Ready to merge Review and testing done, is ready to merge Effort - medium Medium size effort needed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

objmode() triggers fork()

2 participants