473,385 Members | 1,582 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Deleting session with connection open

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
2 1376
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Geoff Winsor | last post by:
Hi, I am experiencing a problem with recalling a session variable which stores whether a person is logged in to a "members only" section of a website. This area of the site has been working...
3
by: lozd | last post by:
Hi, I was wondering if anyone could give me a good guide as to how much can be stored in the session state before performance is affected? The app I'm working on is to be hosted on an...
14
by: mjkahn | last post by:
I've read (and read!) that you shouldn't store objects in Session variables. I've read these reasons: - The object takes up memory that may not be freed until the session times out. Better to...
3
by: kris.dorey | last post by:
Hi, Ive got the following code which seems ok but when the user runs the function for a second time I get an error message stating that the mdb is in use by another process. There is still an...
6
by: Gonenc Ercan | last post by:
Hi, I ve ended up debugging a ASP.NET project (with about 380 files on the project .NET Framework 1.0 on IIS 5.0) which has a memory leak... The memory rises too fast. With about 25-30 active...
14
by: Venkat Chellam | last post by:
I have a peculiar problem. I have a simple web application which loads some data from the oracle table and display in the datagrid in the webpage and datagrid has page enabled which shows 10 rows...
14
by: aroraamit81 | last post by:
Hi, I am facing a trouble. I have some Session variables in my code and somehow my session variables are getting mixed up with other users. For example User A has access to 10 companies and...
3
by: pratham | last post by:
Hi and regards What is best method to have an connection to sql, iam using sqlserver 1. have an sqlconnection open when the application start event in global.asax so that i dont have to open...
9
by: forje | last post by:
Hi all, How to make a session "exclusive"? When one attempts to open a new session either he's warned and asked to wait or any other openned session is closed. The need is to force only one user...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.