<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: AJAX and Session &#8220;Race Conditions&#8221;</title>
	<atom:link href="http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/</link>
	<description></description>
	<pubDate>Sat, 30 Aug 2008 04:44:36 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: ringobob</title>
		<link>http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/#comment-14936</link>
		<dc:creator>ringobob</dc:creator>
		<pubDate>Fri, 03 Mar 2006 01:59:58 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1441#comment-14936</guid>
		<description>for example (sorry for the second post), keep a stack of requests, ordered by the submitted timestamp, and just compare the current request submit time to the top of the stack, if it's newer execute as normal, if it's older fit it in the stack and act appropriately (e.g. re-execute from current request to the end, don't execute at all, warn user, etc.).

All of this assumes that you won't be sending requests quicker than 1/millisecond, at least not with Date's getTime().  I'd guess that's a pretty reasonable assumption in most cases.</description>
		<content:encoded><![CDATA[<p>for example (sorry for the second post), keep a stack of requests, ordered by the submitted timestamp, and just compare the current request submit time to the top of the stack, if it&#8217;s newer execute as normal, if it&#8217;s older fit it in the stack and act appropriately (e.g. re-execute from current request to the end, don&#8217;t execute at all, warn user, etc.).</p>
<p>All of this assumes that you won&#8217;t be sending requests quicker than 1/millisecond, at least not with Date&#8217;s getTime().  I&#8217;d guess that&#8217;s a pretty reasonable assumption in most cases.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: ringobob</title>
		<link>http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/#comment-14935</link>
		<dc:creator>ringobob</dc:creator>
		<pubDate>Fri, 03 Mar 2006 01:42:15 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1441#comment-14935</guid>
		<description>Well, my AJAX is kind of ready made to handle that... I've experienced issues with a single instance of IE returning cached results if I access the same URI, without re-accessing the script.  So, I just pop a timestamp on the end of each query string in order to differentiate it and force IE to call the script.  For the record, the type of app this has given me issues with is the kind of hybrid HTML++ - Client/SOA much like the script.aculo.us shopping cart you linked to in one of the linked articles.

If this is evidence of some greater deficiency in my code, I'd be happy to hear it, I'm not fond of hacks like this (meaningless querystring variables), but that was the only solution I could find in ~15 minutes of Googling.

Regardless, it would be trivial to use this to keep track of call order.</description>
		<content:encoded><![CDATA[<p>Well, my AJAX is kind of ready made to handle that&#8230; I&#8217;ve experienced issues with a single instance of IE returning cached results if I access the same URI, without re-accessing the script.  So, I just pop a timestamp on the end of each query string in order to differentiate it and force IE to call the script.  For the record, the type of app this has given me issues with is the kind of hybrid HTML++ - Client/SOA much like the script.aculo.us shopping cart you linked to in one of the linked articles.</p>
<p>If this is evidence of some greater deficiency in my code, I&#8217;d be happy to hear it, I&#8217;m not fond of hacks like this (meaningless querystring variables), but that was the only solution I could find in ~15 minutes of Googling.</p>
<p>Regardless, it would be trivial to use this to keep track of call order.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: elmer</title>
		<link>http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/#comment-14707</link>
		<dc:creator>elmer</dc:creator>
		<pubDate>Wed, 01 Mar 2006 15:34:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1441#comment-14707</guid>
		<description>would keeping a cookie counter that gets updated before each request help? if the server receives out of order reuests it would buffer and process in-order or time-out as the network stack does? I can see a mild problem when the user branches a web.app in the same browser...</description>
		<content:encoded><![CDATA[<p>would keeping a cookie counter that gets updated before each request help? if the server receives out of order reuests it would buffer and process in-order or time-out as the network stack does? I can see a mild problem when the user branches a web.app in the same browser&#8230;</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Ajaxian &#187; AJAX and Session &#8220;Race Conditions&#8221;</title>
		<link>http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/#comment-14628</link>
		<dc:creator>Ajaxian &#187; AJAX and Session &#8220;Race Conditions&#8221;</dc:creator>
		<pubDate>Tue, 28 Feb 2006 13:56:01 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1441#comment-14628</guid>
		<description>[...] From the SitePoint PHP Blog, there&#8217;s a new post from Harry Fuecks that talks about issues concerning race conditions and Ajax. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] From the SitePoint PHP Blog, there&#8217;s a new post from Harry Fuecks that talks about issues concerning race conditions and Ajax. [&#8230;]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: wei</title>
		<link>http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/#comment-14616</link>
		<dc:creator>wei</dc:creator>
		<pubDate>Tue, 28 Feb 2006 03:56:50 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1441#comment-14616</guid>
		<description>If you only care about the latests request/response, you can drop late requests/responses using a counter, 1 keep by the client for responses, 1 keep by the server for requests. If you care about all responses/requests, don't use AJAX.</description>
		<content:encoded><![CDATA[<p>If you only care about the latests request/response, you can drop late requests/responses using a counter, 1 keep by the client for responses, 1 keep by the server for requests. If you care about all responses/requests, don&#8217;t use AJAX.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Luckymonkey &#187; AJAX - pushing JS to places you don&#8217;t want to go?</title>
		<link>http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/#comment-14600</link>
		<dc:creator>Luckymonkey &#187; AJAX - pushing JS to places you don&#8217;t want to go?</dc:creator>
		<pubDate>Mon, 27 Feb 2006 20:45:11 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1441#comment-14600</guid>
		<description>[...] (inspired by : SitePoint Blogs » AJAX and Session “Race Conditions”) [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] (inspired by : SitePoint Blogs » AJAX and Session “Race Conditions”) [&#8230;]</p>]]></content:encoded>
	</item>
	<item>
		<title>By: ajking</title>
		<link>http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/#comment-14593</link>
		<dc:creator>ajking</dc:creator>
		<pubDate>Mon, 27 Feb 2006 17:23:32 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1441#comment-14593</guid>
		<description>Excellent, everybody is in agreement (with Chris Shifflet): if you care about the order in which requests are processed, make sure you do something about it? :-)</description>
		<content:encoded><![CDATA[<p>Excellent, everybody is in agreement (with Chris Shifflet): if you care about the order in which requests are processed, make sure you do something about it? :-)</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Ren</title>
		<link>http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/#comment-14592</link>
		<dc:creator>Ren</dc:creator>
		<pubDate>Mon, 27 Feb 2006 17:03:06 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1441#comment-14592</guid>
		<description>Or server could reply couldn't perform request 5, because missing requests 3 &#38; 4, and client could re-send them.</description>
		<content:encoded><![CDATA[<p>Or server could reply couldn&#8217;t perform request 5, because missing requests 3 &amp; 4, and client could re-send them.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Ren</title>
		<link>http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/#comment-14591</link>
		<dc:creator>Ren</dc:creator>
		<pubDate>Mon, 27 Feb 2006 16:59:09 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1441#comment-14591</guid>
		<description>I may have been too hasty with the "ways to prevent that", some experiements so far havent been too favourable :)

Another off the top of head idea, is take a leaf out of TCP/IPs book, and use ajax request sequence numbers (like packet sequence numbers) if requests come out of order, then server could wait until preceding packets arrive.</description>
		<content:encoded><![CDATA[<p>I may have been too hasty with the &#8220;ways to prevent that&#8221;, some experiements so far havent been too favourable :)</p>
<p>Another off the top of head idea, is take a leaf out of TCP/IPs book, and use ajax request sequence numbers (like packet sequence numbers) if requests come out of order, then server could wait until preceding packets arrive.</p>]]></content:encoded>
	</item>
	<item>
		<title>By: Joshua Eichorn</title>
		<link>http://www.sitepoint.com/blogs/2006/02/27/ajax-and-session-race-conditions/#comment-14590</link>
		<dc:creator>Joshua Eichorn</dc:creator>
		<pubDate>Mon, 27 Feb 2006 16:53:57 +0000</pubDate>
		<guid isPermaLink="false">http://www.sitepoint.com/blogs/?p=1441#comment-14590</guid>
		<description>Just a note the solution is not sync calls, it will never be sync calls.

With any sort of decent AJAX library you can easily add support to keep your async calls ordered.  Switching to sync will just leave you with a locked UI and higher latency.

HTML_AJAX already has support for keeping AJAX reponses ordered (http://blog.joshuaeichorn.com/archives/2006/02/13/ajax-and-latency/), and if anyone has a reasonable test case, I can add support for ordering requests too the server as well (though its going to take some client side retry code to make it robust.</description>
		<content:encoded><![CDATA[<p>Just a note the solution is not sync calls, it will never be sync calls.</p>
<p>With any sort of decent AJAX library you can easily add support to keep your async calls ordered.  Switching to sync will just leave you with a locked UI and higher latency.</p>
<p>HTML_AJAX already has support for keeping AJAX reponses ordered (http://blog.joshuaeichorn.com/archives/2006/02/13/ajax-and-latency/), and if anyone has a reasonable test case, I can add support for ordering requests too the server as well (though its going to take some client side retry code to make it robust.</p>]]></content:encoded>
	</item>
</channel>
</rss>
