-
-
Notifications
You must be signed in to change notification settings - Fork 14.9k
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
nix: fix installCheckPhase crashes on Darwin #278802
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Ensure that `OBJC_DISABLE_INITIALIZE_FORK_SAFETY=yes` is set when starting the Nix daemon during tests, or the fetchurl.sh test will crash trying to initialize libcurl. This is happening since IPv6 support was enabled in NixOS#277471. See also: - http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html - NixOS/nix#2674
This was referenced Jan 5, 2024
thx. will need to be backported to staging-23.11 due to #277878 |
wegank
approved these changes
Jan 5, 2024
ofborg
bot
requested review from
flokli,
edolstra,
lovesegfault,
RaitoBezarius and
Artturin
January 5, 2024 01:21
ofborg
bot
added
10.rebuild-darwin: 101-500
10.rebuild-linux: 0
This PR does not cause any packages to rebuild on Linux
labels
Jan 5, 2024
delroth
added
the
12.approvals: 1
This PR was reviewed and approved by one reputable person
label
Jan 5, 2024
Successfully created backport PR for |
1 task
jfroche
added a commit
to jfroche/nixpkgs
that referenced
this pull request
Jan 23, 2024
While building nix on Darwin, I encountered an error in the `installCheckPhase`: ``` nix> building '/private/tmp/nix-build-nix-2.17.1.drv-1/nix-test/tests/fetchurl/store/mkc9z3arar02wi5jii655cjhdinx4npy-fetchurl.sh.drv'... nix> waiting for children nix> building of '/private/tmp/nix-build-nix-2.17.1.drv-1/nix-test/tests/fetchurl/store/mkc9z3arar02wi5jii655cjhdinx4npy-fetchurl.sh.drv^out' from .drv file: read 377 bytes nix> objc[70707]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. nix> objc[70707]: +[__NSCFConstantString 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. nix> waiting for children ``` I noticed that NixOS#278802 should have addressed this problem, but it didn't. The solution for me was to replace `yes` with `YES`. As it turns out, most of the references to `OBJC_DISABLE_INITIALIZE_FORK_SAFETY` use `YES` instead of `yes`. https://airflow.apache.org/blog/airflow-1.10.10/#running-airflow-on-macos http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html The objective C code that parses the environment variable is defined in the function `environ_init` in [here](https://github.com/opensource-apple/objc4/blob/cd5e62a5597ea7a31dccef089317abb3a661c154/runtime/objc-runtime.mm#L265) and it does `*opt->var = (0 == strcmp(value, "YES"));`. ``` % nix-info -m - system: `"aarch64-darwin"` - host os: `Darwin 21.3.0, macOS 12.2.1` - multi-user?: `yes` - sandbox: `yes` - version: `nix-env (Nix) 2.19.2` - channels(hetzner): `"darwin, nixpkgs-22.05-darwin"` - channels(root): `"darwin, nixpkgs-23.05-darwin"` - nixpkgs: `/Users/hetzner/git/nixpkgs` ```
13 tasks
github-actions bot
pushed a commit
that referenced
this pull request
Jan 23, 2024
While building nix on Darwin, I encountered an error in the `installCheckPhase`: ``` nix> building '/private/tmp/nix-build-nix-2.17.1.drv-1/nix-test/tests/fetchurl/store/mkc9z3arar02wi5jii655cjhdinx4npy-fetchurl.sh.drv'... nix> waiting for children nix> building of '/private/tmp/nix-build-nix-2.17.1.drv-1/nix-test/tests/fetchurl/store/mkc9z3arar02wi5jii655cjhdinx4npy-fetchurl.sh.drv^out' from .drv file: read 377 bytes nix> objc[70707]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. nix> objc[70707]: +[__NSCFConstantString 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. nix> waiting for children ``` I noticed that #278802 should have addressed this problem, but it didn't. The solution for me was to replace `yes` with `YES`. As it turns out, most of the references to `OBJC_DISABLE_INITIALIZE_FORK_SAFETY` use `YES` instead of `yes`. https://airflow.apache.org/blog/airflow-1.10.10/#running-airflow-on-macos http://sealiesoftware.com/blog/archive/2017/6/5/Objective-C_and_fork_in_macOS_1013.html The objective C code that parses the environment variable is defined in the function `environ_init` in [here](https://github.com/opensource-apple/objc4/blob/cd5e62a5597ea7a31dccef089317abb3a661c154/runtime/objc-runtime.mm#L265) and it does `*opt->var = (0 == strcmp(value, "YES"));`. ``` % nix-info -m - system: `"aarch64-darwin"` - host os: `Darwin 21.3.0, macOS 12.2.1` - multi-user?: `yes` - sandbox: `yes` - version: `nix-env (Nix) 2.19.2` - channels(hetzner): `"darwin, nixpkgs-22.05-darwin"` - channels(root): `"darwin, nixpkgs-23.05-darwin"` - nixpkgs: `/Users/hetzner/git/nixpkgs` ``` (cherry picked from commit 4844b99)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
6.topic: darwin
Running or building packages on Darwin
10.rebuild-darwin: 101-500
10.rebuild-linux: 0
This PR does not cause any packages to rebuild on Linux
12.approvals: 1
This PR was reviewed and approved by one reputable person
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of changes
Ensure that
OBJC_DISABLE_INITIALIZE_FORK_SAFETY=yes
is set when starting the Nix daemon during tests, or the fetchurl.sh test will crash trying to initialize libcurl. This is happening since IPv6 support was enabled in #277471.See also:
Fixes nix build failure in staging-next #275620. https://hydra.nixos.org/build/245525336
Things done
nix.conf
? (See Nix manual)sandbox = relaxed
sandbox = true
nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD"
. Note: all changes have to be committed, also see nixpkgs-review usage./result/bin/
)Add a 👍 reaction to pull requests you find important.