spring icon indicating copy to clipboard operation
spring copied to clipboard

rails with spring gem and google/cloud/firestore thread fault

Open davingee opened this issue 6 years ago • 10 comments

if i install google/cloud/firestore i get a threading fault.

Environment details

  • OS: Mac OS Catalina 10.15
  • Ruby version: ruby-2.4.5
  • Gem name and version: google-cloud-firestore (1.1.0)

Steps to reproduce

  1. install rails (5.2.3)
  2. install spring (2.1.0)
  3. rails c

Code example

  require "google/cloud/firestore"
  
  firestore = Google::Cloud::Firestore.new(
    project_id: 'project_id',
    credentials: "/path.json"
  )

  city_ref = firestore.doc "cities/LA"

  data = {
    name:    "Los Angeles",
    state:   "CA",
    country: "USA"
  }

  city_ref.set data

Full backtrace

2.4.5 :019 >     city_ref.set data
objc[17615]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[17615]: +[__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.

davingee avatar Nov 09 '19 05:11 davingee

@davingee I'm having a similar issue, what OS are you on?

pcriv avatar Nov 25 '19 15:11 pcriv

Same here. Catalina 10.15.1, Rails 6.0.1, ruby-2.6.5

jpaas avatar Nov 28 '19 21:11 jpaas

For me it only started in the past couple of days. We've been using spring 2.1.0 for a while now. The crash happens if I try using ActiveRecord in a rails console.

jpaas avatar Nov 28 '19 21:11 jpaas

Did you see this issue?

pcriv avatar Nov 28 '19 21:11 pcriv

Yep watching that one too. My workaround atm is to uninstall spring from my rails project. 😢

jpaas avatar Nov 29 '19 16:11 jpaas

@jpaas my workaround so far it's running all commands with DISABLE_SPRING=1

pcriv avatar Dec 19 '19 11:12 pcriv

Ah that's handy. Thanks @pablocrivella !

jpaas avatar Dec 19 '19 14:12 jpaas

Re-installing PostgreSQL fixed the issue for me. Check https://github.com/ged/ruby-pg/issues/311#issuecomment-576837101

pcriv avatar Jan 24 '20 08:01 pcriv

I just tried it but it didn't help.

In my setup I am running postgres in a Docker container. I use Homebrew to install postgresql just for the lib so that I can use rails in macland.

rails s running on Catalina works fine against my Docker postgres.

rails c running on Catalina always segfaults.

jpaas avatar Jan 24 '20 14:01 jpaas

I had the same issue when using google-cloud-translate (3.2.2) in rails console While rails server works fine with both puma and passenger.

objc[60612]: +[__NSCFConstantString initialize] may have been in progress in another thread when fork() was called.
objc[60612]: +[__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.
  • ruby 3.0.2p107 (2021-07-07 revision 0db68f0233) [x86_64-darwin20]
  • Rails 6.0.4.1
  • ruby Spring version 3.0.0
  • MacOS 11.4 Big Sur
    grpc (1.38.0)
      google-protobuf (~> 3.15)
      googleapis-common-protos-types (~> 1.0)

gaga5lala avatar Nov 22 '21 07:11 gaga5lala