Skip to content
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

Fix nfs test setup fail #2022

Merged
merged 2 commits into from
Dec 3, 2024
Merged

Fix nfs test setup fail #2022

merged 2 commits into from
Dec 3, 2024

Conversation

phoebusm
Copy link
Collaborator

@phoebusm phoebusm commented Nov 26, 2024

Reference Issues/PRs

What does this implement or fix?

Seg fault in moto start up during fixture creation
Test affected: test_nfs_backed_s3_storage, test_read_path_with_dot

Any other comments?

For both test test_nfs_backed_s3_storage and test_read_path_with_dot , both needs to start up a new moto server respectively:

  • test_nfs_backed_s3_storage
    Sole user of nfs_backed_s3_storage
    The moto server for nfs_backed_s3_storage will always be started at the spot
  • test_read_path_with_dot
    MotoNfsBackedS3StorageFixtureFactory and MotoS3StorageFixtureFactory will created moto server for themselves at the spot

Probably due to some underlying changes of the running image and version incompatibility, moto will seg fault at places related file descriptor, e.g. cannot read a json file packed in the moto wheel, or seg fault at importing werkzeug. I think it's due to file descriptor not being handled properly while using multiprocess fork to start up the server. The issue is gone once switched the startup method to spawn
The issue will be gone as well if the fixture is set autouse , to get the server started along with other storage fixture. e.g. s3_storage . I think that could be explained by different states of file descriptor at the time. So in another word, the issue should affect any late moto server start up.
As it only happens at py3.7, which is deprecated, I don't think it's worth opening a ticket for my observation.

Checklist

Checklist for code changes...
  • Have you updated the relevant docstrings, documentation and copyright notice?
  • Is this contribution tested against all ArcticDB's features?
  • Do all exceptions introduced raise appropriate error messages?
  • Are API changes highlighted in the PR description?
  • Is the PR labelled as enhancement or bug so it appears in autogenerated release notes?

@phoebusm phoebusm force-pushed the fix/nfs_test_setup_fail branch 3 times, most recently from be4da7e to 2d1247c Compare December 2, 2024 14:27
@phoebusm phoebusm marked this pull request as ready for review December 2, 2024 14:59
@phoebusm phoebusm force-pushed the fix/nfs_test_setup_fail branch from 2d1247c to 11e075d Compare December 2, 2024 15:12
@@ -339,7 +337,8 @@ def _start_server(self):
self.client_cert_file = ""
self.client_cert_dir = self.working_dir

self._p = multiprocessing.Process(
spawn_context = multiprocessing.get_context('spawn')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could we have a comment explaining what the spawn_context is for and how it avoids the issue?

@phoebusm phoebusm merged commit b0c174c into master Dec 3, 2024
124 of 125 checks passed
@phoebusm phoebusm deleted the fix/nfs_test_setup_fail branch December 3, 2024 11:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants