Hmm,

So I have now tried both the DB.disconnect in the passenger block, and
attempting to use the after_connect proc to reconnect automatically,
but neither of these help, so I don't think it can be because (or only
because) of issues to do with passenger forking.

I'm going to try setting the read_timeout value to a higher number and
see if that has any impact, but I'm at a bit of a loss at the moment.

R


On Jan 7, 7:21 pm, Aman Gupta <[email protected]> wrote:
> On Fri, Jan 7, 2011 at 2:54 AM, Roland Swingler
> <[email protected]>wrote:
>
> > > This code looks like you are attempting to disconnect after the fork,
> > > instead of before forking.  Also, you don't need to call
> > > Sequel.connect again, just DB.disconnect should be enough.  But make
> > > sure it is called before forking, not after.
>
> > Ah - so is reconnecting to the DB handled for me by the connection
> > pool as soon as I try to use the Database object (I tried in the
> > console and it seems to work that way)?
>
> > The problem here is that I don't think I have any way of running code
> > before fork is called, because it isn't a Daemon I'm writing myself,
> > but Passenger. As far as I can tell from the passenger documentation,
> > this is the only point at which I can hook into the passenger forking/
> > spawning method.
>
> I am using DB.disconnect
> inside PhusionPassenger.on_event(:starting_worker_process) without any
> issues.
>
>   Aman
>
>
>
>
>
>
>
>
>
> > I'm probably being really dense, but why is it important to disconnect
> > before rather than after the fork?
>
> > AFAIK, the connection won't actually ever be used in the parent
> > process (a passenger ApplicationSpawner), only in child processes -
> > does this make a difference as to whether it matters whether you
> > disconnect pre/post fork?
>
> > Maybe this is more of a issue for the passenger mailing list.
>
> > @Aaron
> > > don't forget that there may be a stateful
> > > firewall that is expiring state and denying packets (thus causing the
> > > disconnect).
>
> > I don't think this is the problem because I have a rails app working
> > on the same setup which works fine.
>
> > Thanks for everyone's help so far, much appreciated.
>
> > Cheers,
> > Roland
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "sequel-talk" group.
> > To post to this group, send email to [email protected].
> > To unsubscribe from this group, send email to
> > [email protected]<sequel-talk%2bunsubscr...@googlegr 
> > oups.com>
> > .
> > For more options, visit this group at
> >http://groups.google.com/group/sequel-talk?hl=en.

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/sequel-talk?hl=en.

Reply via email to