preload_app = true causing - ActiveModel::MissingAttributeError: missing attribute: some_attr
avner.cohen at fiverr.com
Mon Jan 21 07:55:30 UTC 2013
Thanks Eric, I'll use this to explore the issue.
I suspect the issue is indeed around sockets, I found a reply from you
from a while back that seems to point on memcache as another thing I
need to manage at the worker level:
That being said, I'm extremely surprised there is no published unicorn
startup scripts that consider the common use case of a deployment
stack that includes:
Rails + Active Record
I'll post my final script once I conclude the investigation.
On Sun, Jan 20, 2013 at 11:17 AM, Eric Wong <normalperson at yhbt.net> wrote:
> Avner Cohen <avner.cohen at fiverr.com> wrote:
>> Thanks for the quick reply, and aplogies for not providing full info.
>> I do have these set up, here is my full configuration:
>> # -*- encoding : utf-8 -*-
>> worker_processes 4
>> working_directory "."
>> listen 3000
>> timeout 120
>> preload_app true
>> before_fork do |server, worker|
>> defined?(ActiveRecord::Base) and ActiveRecord::Base.connection.disconnect!
>> after_fork do |server, worker|
>> defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
> Interesting. I haven't kept up with changes in Rails over the
> past few years. Hopefully somebody else on the list, has...
> Which database and adapter are you using?
> Do you have anything else that opens a socket at application startup?
> (e.g. memcache, redis, ..., especially anything that would interact
> with ActiveRecord/Model)
> Can you try just using one worker_process + preload_app=true and
> doing "lsof -p" on both the PID of the master and single worker
> to show open sockets (and any other FDs which may be inadvertantly
> The only stream socket which should be shared are the listeners.
More information about the mongrel-unicorn