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

CI: macos target hangs during pytest #39

Open
belm0 opened this issue Feb 17, 2023 · 5 comments
Open

CI: macos target hangs during pytest #39

belm0 opened this issue Feb 17, 2023 · 5 comments

Comments

@belm0
Copy link
Member

belm0 commented Feb 17, 2023

https://github.com/python-trio/purerpc/actions/runs/4158772667/jobs/7194217372

@belm0 belm0 changed the title CI: macos target hangs CI: macos target hangs during pytest Feb 17, 2023
belm0 added a commit that referenced this issue Feb 17, 2023
workaround unexplained hang, #39
@belm0
Copy link
Member Author

belm0 commented Feb 18, 2023

presumably related to this log:

objc[2865]: +[__NSTimeZone initialize] may have been in progress in another thread when fork() was called. We cannot safely call it or ignore it in the fork() child process. Crashing instead. Set a breakpoint on objc_initializeAfterForkError to debug.

I couldn't naively reproduce it locally.

@belm0
Copy link
Member Author

belm0 commented Feb 18, 2023

It appears to be coming from grpc, but is not considered a grpc bug per se. It generally falls under "don't use os.fork() on macOS".

grpc/grpc#31240

@belm0
Copy link
Member Author

belm0 commented Feb 18, 2023

We could disable the mac safeguard with OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
(see https://hynek.me/til/rq-macos/)

Recent Python versions don't use fork() on macOS by default, but I had the tests opt-in to it previously (9b59b66) due to another issue:

# work around pickle issue on macOS
if sys.platform == 'darwin':
    multiprocessing = multiprocessing.get_context('fork')

@belm0
Copy link
Member Author

belm0 commented Feb 18, 2023

OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES does not seem to work. I tried setting it both from the test module, and from the pytest invocation.

@belm0
Copy link
Member Author

belm0 commented Feb 18, 2023

The best way to resolve this, though it needs significant test refactoring:

# TODO: there is no reason to run the server as a separate process...
#   just use serve_async().

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

No branches or pull requests

1 participant