-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called #38560
Comments
@conradwt thanks for reporting the issue, if you run I have had this same issue a number of times, usually when I'm updating the o/s version (on Mac), you may have to add something like the below into your bash file.
|
@hahmed I'm not seeing an issue with
|
Thank you for the report but this is an issue between ruby and MacOS. Could you please report to ruby? |
@rafaelfranca I’ll notify my students of this issue because they are all experiencing it at this time. Thus, I have them to hold-off on using |
I'm also getting this error :( |
For me, adding below to |
I can confirm that when running rails test on Apple M1 Max (16-inch 2021, Rails 6.0, Ruby 2.6.8) we got this error as well:
Solved by disabling spring completely. Thank you! |
Also getting this error on 14" M1 Max. But not on my Mac Mini M1 🤔 |
Same here, works on Mac Mini M1 but not on M1 Max. Disabling Spring works. |
same here with M1 Max, rails 4.2, ruby 2.6.8 doesn't work. Disabling spring doesn't help |
M1 Pro,
|
I was getting the same error using Rails 6.1.4.1 and ruby-2.7.5 [ arm64 ]. Setting |
Setting export |
same here, export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES solve the problem. I got this problem after upgrading hubspot-api-client to 10.1.1 M1 Max, Ruby 2.7.4 Rails 6.0.4 |
Started happening when I changed from ImageMagick to Vips Adding
In my .env fixed the problem. |
is working like charm 🎉 love you all guys 😃 |
For context this is the Ruby issue for this, it would be fixed in more recent versions of Ruby, so I suggest upgrading Ruby if possible |
Same here, had to |
For anyone coming across this, I don't think this is an Apple silicon + Ruby issue, as I get exactly the same error when using Using |
this works fine |
This started happening for me after installing the M1 Pro, Rails 6.1, Ruby 2.7 |
@sergey-arkhipov Couple of questions to run through on macOS:
|
ActiveRecord::ConnectionNotEstablished
invalid gssencmode value: "false"
...
raise ActiveRecord::DatabaseConnectionError.hostname_error(conn_params[:host])
else
raise ActiveRecord::ConnectionNotEstablished, error.message
end
end |
The correct value is |
Thanks. Yes. it's working. No errors. |
Ah, right, sorry about that. Yes, |
I'm still curious if |
Note that puma may not be the only thing forking in development, e.g. spring, etc. Also, rather than |
It crashes, I just tested my (Sinatra) app locally and on GitHub Actions (macos-13). You can see the logs at https://github.com/Starkast/wikimum/actions/runs/7487844025/job/20381074065#step:6:29 |
Thanks. I think there are actually two separate crashes here when the GSSAPI code is used; I had been thinking they were the same:
For now, I suppose we should document If anyone knows who to talk at Apple to get more attention to the second seg fault, please let me know! |
I am trying to fix this on a program that I am going to be selling. How can I implement that in the code so it automatically runs for everyone that downloads the program? |
I was running into this with puma using workers (fork'd) and vips and curl via ethon. I added the following to puma.rb, which solved my issue without simply squelching warnings: before_fork do
# ensure native libraries are initialized before forking
if RUBY_PLATFORM =~ /darwin/
require 'ethon'
Ethon::Easy.new
require 'vips'
end
end |
Yes, as I mentioned in #38560 (comment), the crash can happen from any library that attempts to call macOS API calls after the fork. The However, most people are being burned by the |
Worked for me. I've added to |
Apple's response to the bug report mentioned in #38560 (comment):
|
Squelches some warnings like these: objc[18501]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called. objc[18501]: +[__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. rails/rails#38560
Disabling spring is a bit extreme. If the Try run |
Try just reload you laptop :) |
We added this line to ENV["OBJC_DISABLE_INITIALIZE_FORK_SAFETY"] = "YES" That way it's always set in the Spring server process, without each user having to modify their environment. |
I don't know what |
@suryart here's a good writeup: https://blog.phusion.nl/2017/10/13/why-ruby-app-servers-break-on-macos-high-sierra-and-what-can-be-done-about-it/ (found it here: php/php-src#11818) |
This issue has been automatically marked as stale because it has not been commented on for at least three months. |
Steps to reproduce
Expected behavior
I would expect to get a response saying that the Post was successfully created.
Actual behavior
System configuration
Rails version: Rails 6.0.2.1
Ruby version: ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-darwin19]
The text was updated successfully, but these errors were encountered: