vagrant-dns: macOS 13.x Ventura, daemon crashes on start
When starting the daemon on macOS 13.0 Beta Ventura the daemon appears to crash on startup,
The following log lines are output:
objc[15801]: +[NSPlaceholderMutableString initialize] may have been in progress in another thread when fork() was called. objc[15801]: +[NSPlaceholderMutableString 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.
Running the service in the foreground with:
vagrant dns --start --ontop
Runs fine as a workaround, no errors logged.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Reactions: 1
- Comments: 21 (14 by maintainers)
Commits related to this issue
- Merge pull request #73 from BerlinVagrant/72-workaround-darwin22-crash workaround darwin22 crash #72 — committed to BerlinVagrant/vagrant-dns by fnordfish a year ago
Merged the work-around and released as 2.2.3
This seems to be something happening every now and then with stuff that usually works well under linux but doesn’t like macOS in that regard. If it’s the same issue it isn’t limited to macOS 13.0 either.
See https://github.com/ansible/ansible/issues/49207 for example for details, but the gist is trying to
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
in your shell before you execute the crashing commands.The quick and dirty way would be to directly apply the patch:
curl -s https://patch-diff.githubusercontent.com/raw/BerlinVagrant/vagrant-dns/pull/73.patch | (cd ~/.vagrant.d/gems/2.7.6/gems/vagrant-dns-2.2.2; git apply)
Or, you could clone this repo, checkout the
72-workaround-darwin22-crash
branch, and build it (requires a working ruby 2.7 installation):It’s all pretty weird. It also seems to have something to do with XCode 14.
Here’s a small sample script that runs just fine with a fresh install of ruby 2.7.7:
gem install daemons
Runing with Vagrants Ruby
Using the daemons gem installed in vagrants gemdir (as a dependency of vagrant-dns):
No luck:
Using inline bundler:
This works:
I’ve no idea what’s really going on and what’s the best approach to actually fixing it.
I still believe, that it would be nice if Vagrant could update ruby to 2.7.7 (see https://bugs.ruby-lang.org/issues/19005 and https://bugs.ruby-lang.org/issues/18912) and maybe even ship a different ruby for Ventura/XCode 14?
There’s one hot-fix we could do in
vagrant-dns
:In https://github.com/BerlinVagrant/vagrant-dns/blob/master/lib/vagrant-dns/service.rb#L30-L32, when we move the
require
statements before the daemonized block, so that everything is loaded in the parent process already.@mpdude Yes, I was working on an issue but wanted to get a testable script first.
Finally updated to Ventura. Tested in development with a fresh install of ruby 2.7.6 (
ruby-install ruby 2.7.6 -- --enable-shared
) and that one works. So I believe the ruby Vagrants ships is not good on Ventura:versus