By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,515 Members | 1,339 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,515 IT Pros & Developers. It's quick & easy.

Deleting session with connection open

P: n/a
I've got a function that builds a webpage containing a flash animation.
As the page goes to the browser, the browser sees the link to the
embedded FLV file and opens a new connection to retrieve it. A moment
later the page download is completed, and a few seconds after that,
depending on the user's connection speed, the FLV download completes and
the use has the content. All fine.

The issue comes if the user receives the page, but then hits the
'logout' link on it before the FLV has completely downloaded. The
browser goes to fetch the logout page (which deletes the session, etc.)
but it seems that since there's still a connection open for the FLV
stream something odd happens. It appears the session doesn't get
deleted. If, having received the logout page, the user hits their back
button, they go back to the previous page and it all still works - they
haven't been logged out.

This doesn't happen every time, so I'm guessing it's a race condition.
Can anyone explain what's happening and what I can do about it?

--
Derek Fountain on the web at http://www.derekfountain.org/
Jan 1 '08 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Tue, 01 Jan 2008 12:05:34 +0100, Derek Fountain
<no****@hursley.ibm.comwrote:
I've got a function that builds a webpage containing a flash animation.
As the page goes to the browser, the browser sees the link to the
embedded FLV file and opens a new connection to retrieve it. A moment
later the page download is completed, and a few seconds after that,
depending on the user's connection speed, the FLV download completes and
the use has the content. All fine.

The issue comes if the user receives the page, but then hits the
'logout' link on it before the FLV has completely downloaded. The
browser goes to fetch the logout page (which deletes the session, etc.)
but it seems that since there's still a connection open for the FLV
stream something odd happens. It appears the session doesn't get
deleted. If, having received the logout page, the user hits their back
button, they go back to the previous page and it all still works - they
haven't been logged out.

This doesn't happen every time, so I'm guessing it's a race condition.
Can anyone explain what's happening and what I can do about it?

1. If the FLV file is served/created/altered with PHP, get all session
variables you need straight at the beginning, and call
session_write_close() immediatelly after it before doing any other work.
2. If it's not served with PHP, there is another problem, an we'd like to
see your logout code.
--
Rik Wasmus
Jan 1 '08 #2

P: n/a
1. If the FLV file is served/created/altered with PHP, get all session
variables you need straight at the beginning, and call
session_write_close() immediatelly after it before doing any other work.
After quite a bit of Googling, I've kind of arrived at that position
myself. :) I put the session_write_close() just before the data stream
is written, and that appears to have solved it.

But thanks for your input. I arrived at what I thought was the right
place via a spot of informed guesswork; to have someone then confirm
that I have indeed arrived in the right place makes me a lot more
confident in my fix!

--
Derek Fountain on the web at http://www.derekfountain.org/
Jan 1 '08 #3

This discussion thread is closed

Replies have been disabled for this discussion.