[Catalyst] Duplicate session ids

Bill Moseley moseley at hank.org
Sun May 27 00:00:19 GMT 2007


On Sat, May 26, 2007 at 03:00:31PM -0700, mla wrote:
> The problem is that the finalize() process calls the
> Catalyst::Plugin::Session->finalize_session before finalize_cookies()
> is called.
> 
> And finalize_session() calls $c->_clear_session_instance_data after
> saving.
> 
> So by the time your finalize_cookies() is called, the session has
> been saved and cleared. When you call $c->session in finalize_cookies(),
> it's unaware that the session ever existed, so a new one is created.

Ah, I see.  This is new behavior at some point -- just not sure when
or what I upgraded to make it show up.  Just could not log into the
application.

Took a few hours to just figure out it was my access of the session in
finalize cookies that was causing the problem.  Amazing what a thirst
for a cold beverage that can generate.


> I don't know what the proper fix is. I'm still trying to understand
> the whole process flow. Maybe $c->session should raise an exception
> if it's already been saved. And then should the session try to finalize
> later (dunno if that's even possible).

Yes, it's a bit of a task winding through all the modules and recent
check-ins looking for what change caused the problem.  I still have a
stray debugging statement I added that I need to track down. ;)  I was
really wishing for some fine grain debugging statements already in the
code I could turn on so I could see the flow of the session management
process during the request.  Even some comments in the code would be
helpful.  I just have not had time to get back to it.


-- 
Bill Moseley
moseley at hank.org




More information about the Catalyst mailing list