4

I've upgraded my Ruby version from 2.5.x to 2.6.x (and uninstalled the 2.5.x version). And now Puma server stops working when instantiating a client of Google Cloud Text-to-Speech:

client = Google::Cloud::TextToSpeech.text_to_speech

It just exits without giving an error (in Command Prompt). And there is a 'Segmentation fault' message in the 'bash' terminal.

Puma config-file:

max_threads_count = ENV.fetch("RAILS_MAX_THREADS") { 5 }
min_threads_count = ENV.fetch("RAILS_MIN_THREADS") { max_threads_count }
threads min_threads_count, max_threads_count
port        ENV.fetch("PORT") { 3000 }
environment ENV.fetch("RAILS_ENV") { ENV['RACK_ENV'] || "development" }
pidfile ENV.fetch("PIDFILE") { "tmp/pids/server.pid" }
# workers ENV.fetch("WEB_CONCURRENCY") { 2 }
preload_app!
plugin :tmp_restart

The method that works with Google Cloud Text-to-Speech:

require "google/cloud/text_to_speech"

# Instantiates a client
client = Google::Cloud::TextToSpeech.text_to_speech
  
...

Gemfile:

gem 'rails',                       '6.0.1'
gem 'puma',                        '3.12.2'
gem 'google-cloud-text_to_speech', '1.1.1'
...

OS Windows 10.

I'm confused. I don't understand why it happens and how to fix it. I've tried to use the last gem-versions for 'puma' and 'google-cloud-text_to_speech', reinstalled the Google SDK, but it continues happening.

Maybe something's wrong with my credentials? I get the nil value when running the configure method (before instantiating the client):

(byebug) Google::Cloud::TextToSpeech.configure
<Config: endpoint="texttospeech.googleapis.com" credentials=nil scope=nil lib_name=nil lib_version=nil interceptors=nil timeout=nil metadata=nil retry_policy=nil quota_project=nil>

Can somebody please help me?

Ivan
  • 85
  • 9
  • What is the total segmentation fault error message? Please attach it to the question. A segmentation fault is usually either a bug in Ruby, or an incompatible binary library is getting loaded for some reason. – Casper Dec 05 '21 at 18:59
  • @Casper That's all I have: https://monosnap.com/file/ZhyxZrMmoSRk0Hjh6I8zyby1HStFB8 '514' line here is the joins operation (`Model.joins("INNER JOIN... `). But when I'm debugging this spot it works fine and the issue happens later when I'm trying to instantiate a TextToSpeech client. – Ivan Dec 06 '21 at 20:57

2 Answers2

0

Try reinstalling ruby-debug

sudo gem uninstall ruby-debug
sudo gem install ruby-debug

And, can you expand your question with including your Gemfile, and Gemfile.lock

Another aproach may be deleting Gemfile.lock then running bundle install

rm -rf Gemfile.lock
bundle install
Baran Yeni
  • 314
  • 5
  • 14
  • Hi, Baran. I've tried to delete the `Gemfile.lock` and do `bundle install`, but it hasn't helped me. I can see the same issue. As for `sudo gem...` - I can't do that on Windows. Gemfile files: https://www.dropbox.com/s/4gw3nfbtd2a09dt/gemfile.zip?dl=0 – Ivan Dec 08 '21 at 20:04
0

Ok, I've found the reason for this mess.

It's not about the Ruby version update. I run bundle update after re-installing Rails, and it updated google-cloud-text_to_speech-v1 and google-cloud-text_to_speech-v1beta1 versions in my 'Gemfile.lock' file. And with these updated versions I had the errors I described above.

So, the solution is: do not run complete bundle update, update only exact spots you need (in my case I just had to run bundle update mimemagic in order to have the ability to start Rails server).

Ivan
  • 85
  • 9