<?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"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Buggy/Broken Tomcat 6 Comet NIO APIs</title>
	<atom:link href="http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/feed/" rel="self" type="application/rss+xml" />
	<link>http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/</link>
	<description>Software plumbing using middleware wrenches</description>
	<lastBuildDate>Thu, 09 Feb 2012 19:51:59 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: billburke</title>
		<link>http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/#comment-4155</link>
		<dc:creator><![CDATA[billburke]]></dc:creator>
		<pubDate>Fri, 21 Jan 2011 19:28:20 +0000</pubDate>
		<guid isPermaLink="false">http://billburke.wordpress.com/?p=170#comment-4155</guid>
		<description><![CDATA[You could take a look at our &lt;a href=&quot;http://jboss.org/hornetq/rest&quot; rel=&quot;nofollow&quot;&gt;HornetQ-REST interface&lt;/a&gt;.  You&#039;ll have to tell me if it falls under your &quot;long poll&quot; implementation.   It is beta, but going final when HornetQ 2.2 comes out next month.]]></description>
		<content:encoded><![CDATA[<p>You could take a look at our <a href="http://jboss.org/hornetq/rest" rel="nofollow">HornetQ-REST interface</a>.  You&#8217;ll have to tell me if it falls under your &#8220;long poll&#8221; implementation.   It is beta, but going final when HornetQ 2.2 comes out next month.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ilya Goberman</title>
		<link>http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/#comment-4154</link>
		<dc:creator><![CDATA[Ilya Goberman]]></dc:creator>
		<pubDate>Fri, 21 Jan 2011 17:09:38 +0000</pubDate>
		<guid isPermaLink="false">http://billburke.wordpress.com/?p=170#comment-4154</guid>
		<description><![CDATA[I have had a mixed experience with Tomcat Comet/NIO. It is certainly very buggy. 
The bug with &quot;closing down sockets when it shouldn’t&quot; (https://issues.apache.org/bugzilla/show_bug.cgi?id=50044) is actually fixed in Tomcat 7. But somehow they manage to introduce a new bugs very often. The latest version 7.0.6, for example, does not detect client disconnects: https://issues.apache.org/bugzilla/show_bug.cgi?id=50627
One other major problem is that writes block when client buffer reaches 32K. If I have a thread sending updates to multiple clients, it may block if one of the clients is &quot;slow consumer&quot; stopping data flow to multiple clients. There does not seem to be a workaround for it as Tomcat Comet API does not expose the size of this client queue. The only thing I can do is to allocate a thread per client - very ugly.

So my question is: are there any other &quot;production ready&quot; APIs in Java that handle Comet? I am not interested in long poll implementations or beta releases. I am starting to believe that there is nothing available in the Java world. Am I wrong?
Any input is appreciated. Thanks]]></description>
		<content:encoded><![CDATA[<p>I have had a mixed experience with Tomcat Comet/NIO. It is certainly very buggy.<br />
The bug with &#8220;closing down sockets when it shouldn’t&#8221; (<a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=50044" rel="nofollow">https://issues.apache.org/bugzilla/show_bug.cgi?id=50044</a>) is actually fixed in Tomcat 7. But somehow they manage to introduce a new bugs very often. The latest version 7.0.6, for example, does not detect client disconnects: <a href="https://issues.apache.org/bugzilla/show_bug.cgi?id=50627" rel="nofollow">https://issues.apache.org/bugzilla/show_bug.cgi?id=50627</a><br />
One other major problem is that writes block when client buffer reaches 32K. If I have a thread sending updates to multiple clients, it may block if one of the clients is &#8220;slow consumer&#8221; stopping data flow to multiple clients. There does not seem to be a workaround for it as Tomcat Comet API does not expose the size of this client queue. The only thing I can do is to allocate a thread per client &#8211; very ugly.</p>
<p>So my question is: are there any other &#8220;production ready&#8221; APIs in Java that handle Comet? I am not interested in long poll implementations or beta releases. I am starting to believe that there is nothing available in the Java world. Am I wrong?<br />
Any input is appreciated. Thanks</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: billburke</title>
		<link>http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/#comment-3792</link>
		<dc:creator><![CDATA[billburke]]></dc:creator>
		<pubDate>Fri, 29 Oct 2010 13:33:05 +0000</pubDate>
		<guid isPermaLink="false">http://billburke.wordpress.com/?p=170#comment-3792</guid>
		<description><![CDATA[Got a test to reproduce this?  also, please move discussions to resteasy-dev list.]]></description>
		<content:encoded><![CDATA[<p>Got a test to reproduce this?  also, please move discussions to resteasy-dev list.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shredder</title>
		<link>http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/#comment-3790</link>
		<dc:creator><![CDATA[Shredder]]></dc:creator>
		<pubDate>Fri, 29 Oct 2010 06:20:40 +0000</pubDate>
		<guid isPermaLink="false">http://billburke.wordpress.com/?p=170#comment-3790</guid>
		<description><![CDATA[I&#039;ve just been trying to use RestEasy + JBoss 5.1 + Tomcat6 APR wrapper. Running into problems when using RestEasy Async stuff via JBossWebDispatcherServlet, as well as JAX-WS separately. In other words, one&#039;s using async, while all the others are using sync servlet handling. When an async response is sent at roughly the same time as a sync response, I keep getting &#039;Stream closed&#039;. I&#039;m putting this down to the race conditions described here. Any ideas at a workaround?]]></description>
		<content:encoded><![CDATA[<p>I&#8217;ve just been trying to use RestEasy + JBoss 5.1 + Tomcat6 APR wrapper. Running into problems when using RestEasy Async stuff via JBossWebDispatcherServlet, as well as JAX-WS separately. In other words, one&#8217;s using async, while all the others are using sync servlet handling. When an async response is sent at roughly the same time as a sync response, I keep getting &#8216;Stream closed&#8217;. I&#8217;m putting this down to the race conditions described here. Any ideas at a workaround?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: What java comet-style framework is the most mature and robust? &#124; DeveloperQuestion.com</title>
		<link>http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/#comment-3767</link>
		<dc:creator><![CDATA[What java comet-style framework is the most mature and robust? &#124; DeveloperQuestion.com]]></dc:creator>
		<pubDate>Thu, 14 Oct 2010 16:31:23 +0000</pubDate>
		<guid isPermaLink="false">http://billburke.wordpress.com/?p=170#comment-3767</guid>
		<description><![CDATA[[...] Comet, Jetty                There seems to be significant issues with Tomcat6/Comet/NIO (example). Are the majority of people doing asynchronous http using something else? Jetty/continuations? [...]]]></description>
		<content:encoded><![CDATA[<p>[...] Comet, Jetty                There seems to be significant issues with Tomcat6/Comet/NIO (example). Are the majority of people doing asynchronous http using something else? Jetty/continuations? [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: billburke</title>
		<link>http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/#comment-2518</link>
		<dc:creator><![CDATA[billburke]]></dc:creator>
		<pubDate>Mon, 06 Apr 2009 19:12:15 +0000</pubDate>
		<guid isPermaLink="false">http://billburke.wordpress.com/?p=170#comment-2518</guid>
		<description><![CDATA[@Nisse:

I guess the whole Tomcat community is screwed then.  The Tomcat Comet guys don&#039;t seem to know what they are doing or how to fix the problem.  And Remy is an idiot ;-)  Not my experience with him, but to each is own.]]></description>
		<content:encoded><![CDATA[<p>@Nisse:</p>
<p>I guess the whole Tomcat community is screwed then.  The Tomcat Comet guys don&#8217;t seem to know what they are doing or how to fix the problem.  And Remy is an idiot <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />   Not my experience with him, but to each is own.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: nisse</title>
		<link>http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/#comment-2516</link>
		<dc:creator><![CDATA[nisse]]></dc:creator>
		<pubDate>Mon, 06 Apr 2009 17:03:33 +0000</pubDate>
		<guid isPermaLink="false">http://billburke.wordpress.com/?p=170#comment-2516</guid>
		<description><![CDATA[But Remy is one of the most incompetent programmers around.
the code he produces show very silly beginner mistakes, and a complete lack of understanding of any more advanced concepts, such as basic threadsafety.

he shoud be draged outside and shot in the head.]]></description>
		<content:encoded><![CDATA[<p>But Remy is one of the most incompetent programmers around.<br />
the code he produces show very silly beginner mistakes, and a complete lack of understanding of any more advanced concepts, such as basic threadsafety.</p>
<p>he shoud be draged outside and shot in the head.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: billburke</title>
		<link>http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/#comment-2491</link>
		<dc:creator><![CDATA[billburke]]></dc:creator>
		<pubDate>Wed, 01 Apr 2009 13:31:22 +0000</pubDate>
		<guid isPermaLink="false">http://billburke.wordpress.com/?p=170#comment-2491</guid>
		<description><![CDATA[@Vlad

Try out JBossWeb.  Remy has done a lot of work to stabilize this stuff.  Would be interesting to know whether or not this is true :)]]></description>
		<content:encoded><![CDATA[<p>@Vlad</p>
<p>Try out JBossWeb.  Remy has done a lot of work to stabilize this stuff.  Would be interesting to know whether or not this is true <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vlad</title>
		<link>http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/#comment-2490</link>
		<dc:creator><![CDATA[Vlad]]></dc:creator>
		<pubDate>Wed, 01 Apr 2009 12:31:31 +0000</pubDate>
		<guid isPermaLink="false">http://billburke.wordpress.com/?p=170#comment-2490</guid>
		<description><![CDATA[I have been trying to debug comet problems in Tomcat 6 (6.0.16). 

It works OK most of the time but there are race conditions in both APR and NIO connectors which lead to Tomcat closing down sockets when it shouldn&#039;t. If you set up clients and the Tomcat config to use HTTP keepalives you will see that occasionally a client request will fail because of a TCP RST. If you use the APR connector with HTTPS this will also show up as a SEGV in openssl function:  ssl3_write_pending.

If you look at the Tomcat code in org.apache.coyote.http11.Http11AprProcessor#proces(), for example, you can see that the SocketState to return can depend on &#039;comet&#039; boolean value. This value can be set from within process() or event() or in the action() callback. It is set in the action() callback from Response.finish() when closing a writer / stream.  

The comet flag is not protected by locking but can be set from multiple threads if the response is sent on a separate thread. It is not thread safe. Code in the process() and event() functions appears to assume that the comet flag will not be set by another thread but that is possible. Also, because it is not protected by locking changes made in one thread may not be visible to another thread, or only become visible after an indeterminate interval (esp. on multi-processor machines). 

Implementing async API - which is inherently multi-threaded - in a non-threadsafe way is crazy. 

This one problem can be worked-around by making Http11AprProcessor methods process(), event() and action() synchronized. This locking protects the &#039;comet&#039; flag. May be similar fix for the NIO connector.]]></description>
		<content:encoded><![CDATA[<p>I have been trying to debug comet problems in Tomcat 6 (6.0.16). </p>
<p>It works OK most of the time but there are race conditions in both APR and NIO connectors which lead to Tomcat closing down sockets when it shouldn&#8217;t. If you set up clients and the Tomcat config to use HTTP keepalives you will see that occasionally a client request will fail because of a TCP RST. If you use the APR connector with HTTPS this will also show up as a SEGV in openssl function:  ssl3_write_pending.</p>
<p>If you look at the Tomcat code in org.apache.coyote.http11.Http11AprProcessor#proces(), for example, you can see that the SocketState to return can depend on &#8216;comet&#8217; boolean value. This value can be set from within process() or event() or in the action() callback. It is set in the action() callback from Response.finish() when closing a writer / stream.  </p>
<p>The comet flag is not protected by locking but can be set from multiple threads if the response is sent on a separate thread. It is not thread safe. Code in the process() and event() functions appears to assume that the comet flag will not be set by another thread but that is possible. Also, because it is not protected by locking changes made in one thread may not be visible to another thread, or only become visible after an indeterminate interval (esp. on multi-processor machines). </p>
<p>Implementing async API &#8211; which is inherently multi-threaded &#8211; in a non-threadsafe way is crazy. </p>
<p>This one problem can be worked-around by making Http11AprProcessor methods process(), event() and action() synchronized. This locking protects the &#8216;comet&#8217; flag. May be similar fix for the NIO connector.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: billburke</title>
		<link>http://bill.burkecentral.com/2008/11/12/buggybroken-tomcat-6-comet-nio-apis/#comment-2459</link>
		<dc:creator><![CDATA[billburke]]></dc:creator>
		<pubDate>Thu, 12 Feb 2009 15:07:30 +0000</pubDate>
		<guid isPermaLink="false">http://billburke.wordpress.com/?p=170#comment-2459</guid>
		<description><![CDATA[Paul,

Yes, i flushed the toilet.]]></description>
		<content:encoded><![CDATA[<p>Paul,</p>
<p>Yes, i flushed the toilet.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

