<HTML>
<HEAD>
<TITLE>Re: [rabbitmq-discuss] Rabbitmq-c Help</TITLE>
</HEAD>
<BODY>
<FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'>You diagnosis was absolutely correct. I wrongly assumed that the Fedora repository contained the latest RabbitMQ server version, which it did not. I am, however, at another impass. I have tweaked my code a little to work with 0-9-1, but I have run into a segfault in the rabbitmq-c client, which, lets face it, is probably my doing.<BR>
The segfault occurs when I try to consume, with the following code:<BR>
<BR>
</SPAN></FONT><SPAN STYLE='font-size:11pt'><FONT FACE="Consolas, Courier New, Courier"> &nbsp;&nbsp;&nbsp;amqp_basic_consume_t s;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;s.ticket &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= 0;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;s.queue.len &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= ctx-&gt;name_len;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;s.queue.bytes &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= ctx-&gt;name;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;s.consumer_tag.len &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= 0;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;s.consumer_tag.bytes &nbsp;&nbsp;&nbsp;= NULL;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;s.no_local &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= (AMQP_NOLOCAL &amp; parms) ? 1 : 0;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;s.no_ack &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= (AMQP_NOACK &amp; parms) ? 1 : 0;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;s.exclusive &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= (AMQP_EXCLUSIVE &amp; parms) ? 1 : 0;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;s.nowait &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;= 0;<BR>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;amqp_method_number_t method_ok = AMQP_BASIC_CONSUME_OK_METHOD;<BR>
&nbsp;&nbsp;&nbsp;&nbsp;res = (amqp_rpc_reply_t)amqp_simple_rpc(<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;cnn-&gt;conn,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AMQP_CHANNEL,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;AMQP_BASIC_CONSUME_METHOD,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;method_ok,<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&amp;s<BR>
&nbsp;&nbsp;&nbsp;&nbsp;);</FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"> <BR>
<BR>
The backtrace is:<BR>
<BR>
</FONT><FONT FACE="Consolas, Courier New, Courier">#0 &nbsp;0x00bbd416 in __kernel_vsyscall ()<BR>
#1 &nbsp;0x00248d71 in raise (sig=6) at ../nptl/sysdeps/unix/sysv/linux/raise.c:64<BR>
#2 &nbsp;0x0024a64a in abort () at abort.c:92<BR>
#3 &nbsp;0x0047ec9e in amqp_encode_field_value (encoded=..., entry=0x8864294, offsetptr=0xbfca3a6c) at amqp_table.c:413<BR>
#4 &nbsp;0x0047f0c4 in amqp_encode_table (encoded=..., input=0xbfca3dcc, offsetptr=0xbfca3ad8) at amqp_table.c:324<BR>
#5 &nbsp;0x004838a2 in amqp_encode_method (methodNumber=3932180, decoded=0xbfca3da8, encoded=...) at amqp_framing.c:1357<BR>
#6 &nbsp;0x0047f98d in inner_send_frame (state=0x8897658, frame=0xbfca3bb4, encoded=0xbfca3b80, payload_len=0xbfca3b88) at amqp_connection.c:367<BR>
#7 &nbsp;0x0047fabd in amqp_send_frame (state=0x8897658, frame=0xbfca3bb4) at amqp_connection.c:427<BR>
#8 &nbsp;0x004806bb in amqp_send_method (state=0x8897658, channel=1, id=3932180, decoded=0xbfca3da8) at amqp_socket.c:268<BR>
#9 &nbsp;0x00480729 in amqp_simple_rpc (state=0x8897658, channel=1, request_id=3932180, expected_reply_ids=0xbfca3e00, decoded_request_method=0xbfca3da8) at amqp_socket.c:291<BR>
#10 0x0014560d in zim_amqp_queue_class_consume (ht=1, return_value=0x8865c44, return_value_ptr=0x0, this_ptr=0x886428c, return_value_used=1) at /home/pdezwart/src/pecl/amqp/trunk/amqp.c:936<BR>
#11 0x0825fd39 in zend_do_fcall_common_helper_SPEC (execute_data=&lt;value optimized out&gt;) at /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:316<BR>
#12 0x0823676e in execute (op_array=0x8864738) at /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:107<BR>
#13 0x0820ef36 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/debug/php-5.3.3/Zend/zend.c:1194<BR>
#14 0x081b5ac6 in php_execute_script (primary_file=0xbfca63c4) at /usr/src/debug/php-5.3.3/main/main.c:2260<BR>
#15 0x0829f358 in main (argc=3, argv=0xbfca6504) at /usr/src/debug/php-5.3.3/sapi/cli/php_cli.c:1192<BR>
</FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><BR>
Thoughts on what I am doing wrong? Is there a spec somewhere I can use? =)<BR>
<BR>
Thanks,<BR>
me<BR>
<BR>
<BR>
On 9/21/10 3:10 PM, &quot;David Wragg&quot; &lt;<a href="david@rabbitmq.com">david@rabbitmq.com</a>&gt; wrote:<BR>
<BR>
</FONT></SPAN><BLOCKQUOTE><SPAN STYLE='font-size:11pt'><FONT FACE="Calibri, Verdana, Helvetica, Arial">Hi Pieter,<BR>
<BR>
Sorry for the delay in responding.<BR>
<BR>
Pieter de Zwart &lt;<a href="pdezwart@rubiconproject.com">pdezwart@rubiconproject.com</a>&gt; writes:<BR>
&gt; I need some help with rabbitmq-c. I inherited the PHP extension code base,<BR>
&gt; so I am a little lost. I pulled in RabbitMQ 2.1, along with the tip of<BR>
&gt; rabbitmq-c and rabbitmq-codegen. Everything compiles just fine, but when I<BR>
&gt; try to instantiate a new connection in the PHP extension, I get:<BR>
&gt;<BR>
&gt; localhost:~/src/pecl/amqp/trunk$ php -f tests/test.php<BR>
&gt; Expected 0x000A000A method frame on channel 0, got frame on channel 19793<BR>
&gt;<BR>
&gt; This is the stacktrace:<BR>
&gt; #0 &nbsp;0x009f4416 in __kernel_vsyscall ()<BR>
&gt; #1 &nbsp;0x00248d71 in raise (sig=6) at<BR>
&gt; ../nptl/sysdeps/unix/sysv/linux/raise.c:64<BR>
&gt; #2 &nbsp;0x0024a64a in abort () at abort.c:92<BR>
&gt; #3 &nbsp;0x00137640 in amqp_simple_wait_method (state=0xa1604c0,<BR>
&gt; expected_channel=0, expected_method=655370, output=0xbfe31b20) at<BR>
&gt; amqp_socket.c:243<BR>
&gt; #4 &nbsp;0x001379fc in amqp_login_inner (state=0xa1604c0, vhost=0xa12d70c &quot;/&quot;,<BR>
&gt; channel_max=0, frame_max=131072, heartbeat=0,<BR>
&gt; sasl_method=AMQP_SASL_METHOD_PLAIN) at amqp_socket.c:373<BR>
<BR>
What's happening is that the C client is proposing a version of AMQP,<BR>
and the server is rejecting it. &nbsp;I can't tell more that that, because<BR>
the C client doesn't handle this version mismatch situation well.<BR>
<BR>
But the versions of rabbitmq-c, rabbitmq-codegen and rabbitmq-server you<BR>
describe all implement AMQP 0-9-1, so how that can be happening is a bit<BR>
of a mystery.<BR>
<BR>
My guess is that you are actually pointing the current C client at an<BR>
old (pre-2.0) version of rabbitmq-server somehow. &nbsp;Is that possible?<BR>
Please double check and let me know.<BR>
<BR>
David<BR>
<BR>
--<BR>
David Wragg<BR>
Staff Engineer, RabbitMQ<BR>
SpringSource, a division of VMware<BR>
<BR>
</FONT></SPAN></BLOCKQUOTE><SPAN STYLE='font-size:11pt'><FONT FACE="Calibri, Verdana, Helvetica, Arial"><BR>
-- <BR>
</FONT></SPAN><FONT COLOR="#323232"><FONT SIZE="4"><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:14pt'>the rubicon project<BR>
</SPAN></FONT></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><FONT COLOR="#B80020"><FONT SIZE="1"><SPAN STYLE='font-size:9pt'><BR>
</SPAN><SPAN STYLE='font-size:7pt'>PIETER DE ZWART </SPAN></FONT></FONT><FONT SIZE="1"><SPAN STYLE='font-size:7pt'><FONT COLOR="#3E3E3E">| LEAD, </FONT><FONT COLOR="#3F3F3F">INTERFACES TEAM<BR>
</FONT><FONT COLOR="#B9001C">&#8226;&#8226;&#8226; P 310 207 0272 | x224<BR>
</FONT><FONT COLOR="#B8001B">&#8226;&#8226;&#8226; C 408 666 4443<BR>
</FONT><FONT COLOR="#B9001C">&#8226;&#8226;&#8226; F 323 466 7119<BR>
</FONT><BR>
<FONT COLOR="#3A3A3A"><BR>
1925 S. BUNDY &nbsp;DRIVE<BR>
LOS ANGELES, CALIFORNIA 90025<BR>
</FONT><FONT COLOR="#B40D1B"><BR>
</FONT><FONT COLOR="#0000FD">WWW.RUBICONPROJECT.COM</FONT><FONT COLOR="#B40D1B"> &lt;</FONT><FONT COLOR="#0000FF"><U><a href="http://">http://</a>www.rubiconproject.com/</U></FONT><FONT COLOR="#B40D1B">&gt; <BR>
</FONT></SPAN></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
</SPAN></FONT><FONT COLOR="#2D2D2D"><FONT SIZE="4"><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:13pt'><IMG src="cid:3368003622_5837442" ><BR>
</SPAN></FONT></FONT></FONT><FONT FACE="Verdana, Helvetica, Arial"><FONT COLOR="#767676"><FONT SIZE="1"><SPAN STYLE='font-size:7pt'>&#8220;COMPANY OF THE YEAR&#8221; ALWAYSON ONMEDIA 2009<BR>
#24 ON FAST COMPANY FAST 50 READER FAVORITES<BR>
2008 &nbsp;ALWAYSON 250 GLOBAL WINNER<BR>
2008 ALWAYSON ONMEDIA 100 WINNER<BR>
TWIISTUP3 &nbsp;BEST IN SHOW<BR>
</SPAN></FONT></FONT><FONT SIZE="1"><SPAN STYLE='font-size:7pt'><FONT COLOR="#757575">PRICEWATERHOUSECOOPERS &#8211; ENTRETECH &nbsp;BEST STARTUP<BR>
</FONT><FONT COLOR="#767676">AMERICAN BUSINESS AWARDS - STEVIES &nbsp;&#8216;08 FINALIST BEST NEW COMPANY<BR>
</FONT><FONT COLOR="#757575">AMERICAN BUSINESS &nbsp;AWARDS - STEVIES &#8216;08 FINALIST MOST INNOVATIVE COMPANY<BR>
AMERICAN BUSINESS &nbsp;AWARDS - STEVIES &#8216;08 FINALIST NEW PRODUCT OR SERVICE - &nbsp;SERVICES<BR>
<BR>
</FONT></SPAN></FONT></FONT><FONT COLOR="#177E00"><FONT SIZE="6"><FONT FACE="Webdings"><SPAN STYLE='font-size:24pt'>P</SPAN></FONT></FONT><FONT SIZE="1"><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:7pt'> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</SPAN></FONT><FONT FACE="Verdana, Helvetica, Arial"><SPAN STYLE='font-size:8pt'>Please consider the environment before printing this e-mail<BR>
</SPAN></FONT></FONT></FONT><FONT FACE="Calibri, Verdana, Helvetica, Arial"><SPAN STYLE='font-size:11pt'><BR>
<BR>
</SPAN></FONT>
</BODY>
</HTML>