On 24.07.2010, at 16:37, Jordi Boggiano wrote:

> Heya,
> 
> I just wanted to raise this issue before it's too late.. currently the
> Session class relies on __destruct() to trigger the flush to the
> session storage backend. Now I agree in theory it's all fine, at the
> end of the request it's flushed, done. I might have questions about
> what happens with integration tests if multiple tests are ran in the
> same process it might never be garbage collected, but I have no clue
> there how it's implemented.
> 
> The problem lies more that I've experienced issues with Memcache in my
> own session implementation that used __destruct() in the past. Namely
> the connection to memcache was lost or something, anyway it seemed
> like the shutdown order wasn't correct, and when the session tried to
> flush I got an exception... So in the end I had to force it to flush
> from the response class, after sending the output. Anyway I didn't try
> it with memcache and Sf2 yet, so maybe I was just unlucky and it
> wouldn't occur in this case, but I'd say it's worth a try before
> settling on the current implementation.


Yeah, there are plenty of issues with relying on __destruct() at shutdown, due 
to PHP getting in all sorts of trouble with doing things in the order one 
intends (and PHP doesnt really know about your intentions). So its usually a 
good idea to actually manually desctruct any objects that rely on other objects 
during their destruction.

Another thing that is semi related, just like Jordi suggested for the HTTP 
response (where it might make sense to start returning content as early as 
possible), one might want to force flushing early. For example  if I know that 
users have a lot of parallel connections and I have to prevent race conditions 
for changes in the session, I might want to minimize the time between reading 
and writing the session in each session.

regards,
Lukas Kahwe Smith
[email protected]



-- 
If you want to report a vulnerability issue on symfony, please send it to 
security at symfony-project.com

You received this message because you are subscribed to the Google
Groups "symfony developers" 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/symfony-devs?hl=en

Reply via email to