Oracle instant client with gem ruby-oci8 not able to connect with DB in rails c

早过忘川 提交于 2019-12-11 04:24:52

问题


I am using Oracle instant client in my project and using ruby-oci8 gem. I am using Mac Mojave OS

I am able to run the rails server and server does connect with database but when I run rails c and try to connect with any table it throws following error.

    Running via Spring preloader in process 95609
    Loading development environment (Rails 5.1.1)
    User.last
objc[96849]: +[__NSPlaceholderDictionary initialize] may have been in progress in another thread when fork() was called.
objc[96849]: +[__NSPlaceholderDictionary 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.
/Users/arvindmehra/.rvm/gems/ruby-2.4.0/gems/ruby-oci8-2.2.5/lib/oci8/oci8.rb:142: [BUG] Illegal instruction at 0x007fff6efbf2e5
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin18]

I am not able to connect with DB using rails console, strange thing is rails server is working and Application is able to connect with DB.


回答1:


I was finally able to solve it by upgrading ruby version to 2.4.4 and adding export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES. I guess issue is with Combination of OSX Mojave and ruby-2.4.0 and its actually working for OSX High Sierra



来源:https://stackoverflow.com/questions/54253460/oracle-instant-client-with-gem-ruby-oci8-not-able-to-connect-with-db-in-rails-c

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!