preload_app = true causing - ActiveModel::MissingAttributeError: missing attribute: some_attr

Eric Wong normalperson at
Sun Jan 20 09:17:50 UTC 2013

Avner Cohen <avner.cohen at> wrote:
> Eric,
> 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!
> end
> after_fork do |server, worker|
>   defined?(ActiveRecord::Base) and ActiveRecord::Base.establish_connection
> end

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 mailing list