[Mongrel] Sharing a mongrel cluster in a multi-url environment

John Almberg jalmberg at identry.com
Thu Jan 29 09:32:36 EST 2009


On Jan 28, 2009, at 5:45 PM, David Vrensk wrote:

> I don't think this is mongrel's fault, but it's interesting  
> nonetheless.
>
> Could you have apache log the incoming cookie value to shed some  
> more light on what happens?  I believe that the cookie you see is  
> not the cookie that the client sends, but a new cookie that Rails  
> generates when it cannot find the cookie from the request in its  
> current db.
>
> My theory (aka wild guess) is that Rails picks up the cookie before  
> you change/set the database connection.  Like this:
>
> User1 requests the login page.
> Rails connects to db1 and renders the page.
> User1 logs in and is given a cookie, and session data is stored in  
> db1.
> User1 does something and all is good.
> User2 requests the login page.
> Rails connects to db2 and renders.
> User1 requests a new page.
> Rails is connected to db2 and fails to find the cookie.
> Rails connects to db1 and redirects user.
>
> Now, this isn't exactly what's happening in your logs, but add the  
> fact that the different requests are being handled by different  
> mongrels, each with their Rails stacks and db connections, and you  
> have a fine mess.

H'mmm. This is an interesting idea. I will do some testing to see if  
this is the problem
.
> Could you try running just one mongrel for a short while to  
> minimise the number of moving parts?

Yes, I tried that and it made no difference. In fact, the log trace I  
sent was with one mongrel in the mongrel cluster.

I will get back with results of the db testing later today.

Thanks for the idea.

-- John




More information about the Mongrel-users mailing list