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

Embedded ruby for macOS 13 Ventura crashes #13035

Closed
fnordfish opened this issue Dec 21, 2022 · 4 comments
Closed

Embedded ruby for macOS 13 Ventura crashes #13035

fnordfish opened this issue Dec 21, 2022 · 4 comments

Comments

@fnordfish
Copy link
Contributor

fnordfish commented Dec 21, 2022

We are trying to fix an issue over at BerlinVagrant/vagrant-dns#72

On macOS Ventura 13, when the vagrant-dns plugin tries to start its daemon, that process crashes with:

objc[3646]: +[NSPlaceholderMutableString initialize] may have been in progress in another thread when fork() was called.
objc[3646]: +[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.

This seems to be a common issue and a widely suggested "solution" is to set an env var OBJC_DISABLE_INITIALIZE_FORK_SAFETY=yes, but I find that a bit dangerous and it's also seems not to be working for everyone.

Debug output

see above.

Expected behavior

Should not crash

Actual behavior

Crashes

Reproduction information

Vagrant version

Vagrant 2.3.4

Host operating system

macOS 13.1

Guest operating system

"bionic64", but not relevant

Steps to reproduce

(Creating or booting a box is not necessary)

  1. vagrant plugin install vagrant-dns --plugin-version 2.2.2
  2. start the daemon:
$ vagrant dns --start
vagrant-dns: process with pid 7480 started.
  1. Check if the daemon is still running
$ vagrant dns --status
pid-file for killed process 7480 found ($HOME/.vagrant.d/tmp/dns/daemon/vagrant-dns.pid), deleting.
vagrant-dns: no instances running
  1. check logfile
$ cat $HOME/.vagrant.d/tmp/dns/daemon/vagrant-dns.output
objc[3646]: +[NSPlaceholderMutableString initialize] may have been in progress in another thread when fork() was called.
objc[3646]: +[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.
What it should look like

In development mode, using a fresh install of ruby 2.7.7 it works:

$ bin/vagrant dns --start
You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.

vagrant-dns: process with pid 7785 started.
$ bin/vagrant dns --status
You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.

vagrant-dns: running [pid 7785]
$ bin/vagrant dns --stop
You appear to be running Vagrant outside of the official installers.
Note that the installers are what ensure that Vagrant has all required
dependencies, and Vagrant assumes that these dependencies exist. By
running outside of the installer environment, Vagrant may not function
properly. To remove this warning, install Vagrant using one of the
official packages from vagrantup.com.

vagrant-dns: trying to stop process with pid 7785 sending TERM and waiting 20s ...
vagrant-dns: process with pid 7785 successfully stopped.

Vagrantfile

Vagrant.configure("2") do |config|
  # config.vm.provider "vmware_fusion"
  config.vm.box     = 'hashicorp/bionic64'

  config.dns.tld      = "test"
  config.dns.patterns = /^.*machine.test$/

  config.vm.hostname = "machine"
  config.vm.network :private_network, ip: "33.33.33.60"
  config.vm.synced_folder ".", "/vagrant", disabled: true

  VagrantDNS::Config.listen = [[:udp, "0.0.0.0", 5300]]
  VagrantDNS::Config.ttl = 30
end

Observations

My freshly installed ruby:

$ruby -v
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-darwin22]

The embedded ruby:

$ /opt/vagrant/embedded/bin/ruby -v
ruby 2.7.6p219 (2022-04-12 revision c9c2245c0a) [x86_64-darwin19]

A very simple test script and some description how/when it breaks can be found here: BerlinVagrant/vagrant-dns#72 (comment)

@chrisroberts
Copy link
Member

Hi,

We have just started work to update the embedded Ruby to version 3.1.3. Once that work has been merged into the installers repo we'll start to have nightly builds with the updated Ruby version that can be tested to verify if it provides a fix for this issue. I'll ping here once the work has been completed and the nightly builds are available.

@soapy1
Copy link
Contributor

soapy1 commented Feb 24, 2023

Following up, the embedded Ruby has been updated to 3.0.5. You can download the nightly installers at https://github.com/hashicorp/vagrant-installers/releases/v2.3.5.dev+main

@fnordfish
Copy link
Contributor Author

fnordfish commented Mar 20, 2023

Managed to successfully test the above test-script as well as vagrant-dns 2.2.2 against vagrant 2.3.5.dev+main.

@chrisroberts
Copy link
Member

Closing this as the updated version of Ruby in the installers appears to have resolved the issue. If you still experience any issues, please feel free to open a new issue.

Cheers!

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jul 3, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants