1

I have the following issue when booting app on Heroku :

2018-02-20T23:55:19.456182+00:00 heroku[worker.1]: Starting process with command `bundle exec sidekiq -e production -C config/sidekiq.yml`
2018-02-20T23:55:20.180974+00:00 heroku[worker.1]: State changed from starting to up
2018-02-20T23:55:23.590432+00:00 app[worker.1]: 4 TID-78no8 INFO: Booting Sidekiq 4.2.10 with redis options {:url=>"redis://h:REDACTED@ec2-34-252-234-97.eu-west-1.compute
.amazonaws.com:27639"}
2018-02-20T23:55:24.455410+00:00 heroku[worker.1]: Process exited with status 1
2018-02-20T23:55:24.466303+00:00 heroku[worker.1]: State changed from up to crashed
2018-02-20T23:55:24.271262+00:00 app[worker.1]: I, [2018-02-20T23:55:24.271106 #4]  INFO -- : DB Connection Pool size for Sidekiq Server before disconnect is: 1
2018-02-20T23:55:24.274465+00:00 app[worker.1]: could not connect to server: No such file or directory
2018-02-20T23:55:24.274469+00:00 app[worker.1]:         Is the server running locally and accepting
2018-02-20T23:55:24.274471+00:00 app[worker.1]:         connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Seems to be a problem with redis but can't figure out what's wrong.

sidekiq.yml

development:
  :concurrency: 5
production:
  :concurrency: 20
:queues:
  - default
  - mailers

Procfile

web: bundle exec puma -C config/puma.rb
worker: bundle exec sidekiq -e production -C config/sidekiq.yml

Config vars

REDIS_URL   redis://h:pe........stuff.here..........9fa3@ec2-34-252-234-97.eu-west-1.compute.amazonaws.com:27639

Redis.rb

$redis = Redis.new(url: ENV["REDIS_URL"])
Maxence
  • 2,029
  • 4
  • 18
  • 37
  • How did you solve this? I'm running into the same issue – gwalshington Apr 06 '18 at 21:26
  • Well my problem was from the Sidekiq initializer file. I followed a tutorial on internet which provided 'faulty' code. I am replying to my question right now, you can try it... – Maxence Apr 06 '18 at 22:04
  • I actually just found the answer - anyone in the future, this post solved my issue. It was not a bad configuration of the db at all. https://stackoverflow.com/questions/22813929/redistogo-and-sidekiq-on-heroku-cant-connect/49701613#49701613 – gwalshington Apr 06 '18 at 22:08
  • Oh yes it can be a problem with Redis. But in my case Redis was ok. (I tweaked everything possible with Redis before I found out the proble was the Sidekiq initializer ...) – Maxence Apr 06 '18 at 22:11
  • Interesting. I was getting the same error on a PS db that has been running with no issues for over a year, so I knew the config wasn't wrong – gwalshington Apr 06 '18 at 22:12

2 Answers2

1

Read the error carefully:

Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"?

Your database is misconfigured.

Mike Perham
  • 21,300
  • 6
  • 59
  • 61
  • Thanks Mike. found a similar thread https://stackoverflow.com/questions/42756028/sidekiq-error-could-not-connect-to-server-no-such-file-or-directory but not really helpful. When I run console on my app, i can query the database though. I then guess the database can be properly configured but some access between different services not working properly ? – Maxence Feb 21 '18 at 12:49
  • OK Heroku documentation mentions this very issue https://devcenter.heroku.com/articles/heroku-postgresql#troubleshooting it seems to be a "$path" problem. I have little knowledge of these kind of issues but will look further. – Maxence Feb 21 '18 at 12:58
  • Ok fixed. I removed the block in my sidekiq config as per thread above. Now I get some error 'ERR max number of clients reached' and have come upon your explanation here Mike : https://github.com/mperham/sidekiq/issues/117 Is it still valid as written in 2012 ? And is there a good tutorial on the web for this ? I will write a new question in that respect. – Maxence Feb 22 '18 at 15:08
0

What kind of fixed the inital error message is changing my sidekiq.rb initalizer file to :

if Rails.env.production?
  Sidekiq.configure_client do |config|
    config.redis = { url: ENV['REDIS_URL'], size: 1}
  end
  Sidekiq.configure_server do |config|
    config.redis = { url: ENV['REDIS_URL']}
  end
end
Maxence
  • 2,029
  • 4
  • 18
  • 37