473,781 Members | 2,491 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1396
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_c lose() 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_c lose() 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_c lose() 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
2919
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 flawlessly for a couple of years under Windows 2000 server but now is very inconsistent following a recent upgrade to Windows server 2003. Following a login, the login info is passed to this asp page that checks an Access database for the user name and...
3
1459
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 intranet with in the region of 500 users (not at all times though) but it's intended to be able to be used accross a variety of environments with different numbers of users and different grades of servers. As I have no definite info on what the...
14
2603
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 create the object only when you actually use it. - Causes poor performance because the thread that created the object has to service all requests for it. Assuming I can live with the memory and performance implications (a big if,
3
2996
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 ldb for the life of the application even after calling oldebconnection.close and gc.collect. Any ideas?
6
2387
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 sessions (average) the memory rises about 300 MB's in an hour. I've checked the database (SQL Server 2000) and seen that there are lots of sleeping connections. (about 400!!!) I thought somewhere in the code they left the connection open, so decided...
14
2264
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 at a page.I have a search criteria to search the records based on the data range i give This is what i have done, in the !IsPostBack section. I am setting up the oracle connection, creating dataset object, datadapter and i aslo load the data...
14
2382
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 User B has access to 5, now when both of us hits to the server at the same time then their session variables gets mixedup means either User A and USer B will have now 5 companies or both have 10 companies. Now again when User A hits to the server...
3
1936
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 it in each method where i require to open an connection 2. open an connection in seesion so that, it is available in session of the user thorugh out
9
2487
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 at the same time. I'm currently using the database but also looking at a php only solution. Thanks in advance. -- Forje
0
9639
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10308
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10143
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9939
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8964
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7486
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6729
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5507
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3633
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.