Closed snitko closed 9 years ago
Are you using Ruby 2.0 or higher? If so, what may be happening is the code is opening a connection to Pg first, then calling daemonize, then trying to use the connection. In Ruby 2.0+, sockets are close-on-exec by default, which means the connection to Pg is getting closed during the fork.
The simplest solution is to open connections after daemonizing, but you may have to rework some error-reporting code because you probably expect the process to exit 1 on the command line if it cannot talk to Pg.
This doesn't happen with sqlite because it will (re)open a local file handle when it needs to (I think - this would match the symptoms).
You are right. I suspected that, but couldn't quite put my finger on it. Thank you.
Not sure if this is the right repo to post this issue to, so feel free to remove it.
I've been using Sequel gem (http://sequel.jeremyevans.net/) with postgres adapter inside Goliath, which in turn uses
daemons
gem and I've noticed a very weird behavior.If Goliath is run as a daemon, it fails with the following error:
whereas if it is run normally, this never happens.
This error also doesn't happen with sqlite, both in normal and daemonized modes. Any hints as to why this might be happening?