unicorn Ruby/Rack server user+dev discussion/patches/pulls/bugs/help
 help / color / mirror / code / Atom feed
From: Avner Cohen <avner.cohen@fiverr.com>
To: Eric Wong <normalperson@yhbt.net>
Cc: unicorn list <mongrel-unicorn@rubyforge.org>
Subject: Re: preload_app = true causing - ActiveModel::MissingAttributeError: missing attribute: some_attr
Date: Mon, 21 Jan 2013 09:55:30 +0200	[thread overview]
Message-ID: <CAAZOLpUQEQ757S28470H-uForzFJbO4h-Q_jGgcVGTXrq=vQjQ@mail.gmail.com> (raw)
In-Reply-To: <20130120091750.GA3761@dcvr.yhbt.net>

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:
http://rubyforge.org/pipermail/mongrel-unicorn/2010-January/000309.html

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
Redis
Memcache

I'll post my final script once I conclude the investigation.

Best Regards,
Avner Cohen

On Sun, Jan 20, 2013 at 11:17 AM, Eric Wong <normalperson@yhbt.net> wrote:
> Avner Cohen <avner.cohen@fiverr.com> 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
> shared)?
>
> The only stream socket which should be shared are the listeners.
_______________________________________________
Unicorn mailing list - mongrel-unicorn@rubyforge.org
http://rubyforge.org/mailman/listinfo/mongrel-unicorn
Do not quote signatures (like this one) or top post when replying

  parent reply	other threads:[~2013-01-21  8:02 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-20  7:36 preload_app = true causing - ActiveModel::MissingAttributeError: missing attribute: some_attr Avner Cohen
2013-01-20  8:04 ` Eric Wong
2013-01-20  8:10   ` Avner Cohen
2013-01-20  9:17     ` Eric Wong
2013-01-20 21:39       ` Lawrence Pit
2013-01-21  7:55       ` Avner Cohen [this message]
2013-01-21  8:11         ` Lawrence Pit

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://yhbt.net/unicorn/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAAZOLpUQEQ757S28470H-uForzFJbO4h-Q_jGgcVGTXrq=vQjQ@mail.gmail.com' \
    --to=avner.cohen@fiverr.com \
    --cc=mongrel-unicorn@rubyforge.org \
    --cc=normalperson@yhbt.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://yhbt.net/unicorn.git/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).