<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wikidot="http://www.wikidot.com/rss-namespace">

	<channel>
		<title>Comments for page &quot;52 - Queue busy when trying to consume messages.&quot;</title>
		<link>http://www.openamq.org/issue:52/comments/show</link>
		<description></description>
				<copyright></copyright>
		<lastBuildDate>Sat, 04 Feb 2012 20:57:33 +0000</lastBuildDate>
		
					<item>
				<guid>http://www.openamq.org/issue:52/comments/show#post-398664</guid>
				<title>Re: Errors in sample code</title>
				<link>http://www.openamq.org/issue:52/comments/show#post-398664</link>
				<description></description>
				<pubDate>Fri, 27 Feb 2009 14:55:16 +0000</pubDate>
				<wikidot:authorName>mclaughlin77</wikidot:authorName>				<wikidot:authorUserId>221375</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>Pieter,</p> <p>Thanks for the quick fix on this and the tip about the sample code. I appreciate your help.</p> <p>Kelly</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.openamq.org/issue:52/comments/show#post-398615</guid>
				<title>Errors in sample code</title>
				<link>http://www.openamq.org/issue:52/comments/show#post-398615</link>
				<description></description>
				<pubDate>Fri, 27 Feb 2009 14:05:26 +0000</pubDate>
				<wikidot:authorName>pieterh</wikidot:authorName>				<wikidot:authorUserId>99</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>@mclaughlin77:</p> <p>There is an error in the sample code that I'll point out in case you're using this in real apps:</p> <div class="code"> <pre> <code>incoming_content = amq_content_basic_new(); incoming_content = amq_client_session_basic_arrived(session);</code> </pre></div> <p>This will cause a memory leak. The first statement is not needed. The arrived() method automatically creates a new content to return to the caller.</p> 
				 	]]>
				</content:encoded>							</item>
					<item>
				<guid>http://www.openamq.org/issue:52/comments/show#post-398610</guid>
				<title>Fixed</title>
				<link>http://www.openamq.org/issue:52/comments/show#post-398610</link>
				<description></description>
				<pubDate>Fri, 27 Feb 2009 14:02:03 +0000</pubDate>
				<wikidot:authorName>pieterh</wikidot:authorName>				<wikidot:authorUserId>99</wikidot:authorUserId>				<content:encoded>
					<![CDATA[
						 <p>The problem was due to a race condition in amq_server_channel_consume().</p> <p>You can fix it by patching amq_server_channel_agent.c:2083:</p> <div class="code"> <pre> <code>... if (self-&gt;credit == 0) self-&gt;credit = 1; amq_queue_consume (queue, consumer, self-&gt;active, nowait); ...</code> </pre></div> <p>The line '<strong>amq_queue_consume (queue, consumer, self-&gt;active, nowait);</strong>' must be moved to after the channel credit calculation.</p> <p>What was happening was that (on fast multicore systems) the amq_queue_consume() call was starting to dispatch messages <em>before</em> the channel was given credit, and so the dispatch failed, with a "busy" message (which normally indicates that the channel has used up all its credit due to an overloaded network).</p> <p>This patch will be in the next 1.3 and 1.4 releases.</p> 
				 	]]>
				</content:encoded>							</item>
				</channel>
</rss>
