Marco Zanger
Marco Zanger

Reputation: 23

Ruby + Sequel + Sinatra + MySQL connection issues

Hi have a simple web app built in ruby, sinatra and sequel connected to a mysql DB. Im using

Ubuntu 14.04.3 LTS ruby 2.0.0 gem 'sinatra', '1.4.5' gem 'slim', '2.0.3' gem 'sequel', '4.38.0' mysql Ver 14.14 Distrib 5.5.54, for debian-linux-gnu (x86_64) using readline 6.3

Im having an issue that the app fails when accessing different parts of the application throwing random errors with status 500 (there is bug, since after trying a few times it works). Im suspecting is a problem with Sequel + Mysql. The app works for a while, then it stops working and then it works again by itself.

I know there is no much description but Im clueless. Any idea?

Upvotes: 0

Views: 495

Answers (1)

Jeremy Evans
Jeremy Evans

Reputation: 12149

If you are using preload_app in your Unicorn configuration, but aren't disconnecting Sequel's database connections before the fork, that could possibly cause the errors you are seeing. I think both Sequel's and Unicorn's documentation explain the issue:

https://bogomips.org/unicorn/Unicorn/Configurator.html http://sequel.jeremyevans.net/rdoc/files/doc/code_order_rdoc.html#label-Disconnect+If+Using+Forking+Webserver+with+Code+Preloading

Upvotes: 1

Related Questions