[rabbitmq-discuss] Rabbitmq-c Help

Pieter de Zwart pdezwart at rubiconproject.com
Wed Sep 22 20:33:42 BST 2010


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.
The segfault occurs when I try to consume, with the following code:

    amqp_basic_consume_t s;
    s.ticket                = 0;
    s.queue.len                 = ctx->name_len;
    s.queue.bytes            = ctx->name;
    s.consumer_tag.len        = 0;
    s.consumer_tag.bytes    = NULL;
    s.no_local                = (AMQP_NOLOCAL & parms) ? 1 : 0;
    s.no_ack                = (AMQP_NOACK & parms) ? 1 : 0;
    s.exclusive                = (AMQP_EXCLUSIVE & parms) ? 1 : 0;
    s.nowait                = 0;

    amqp_method_number_t method_ok = AMQP_BASIC_CONSUME_OK_METHOD;
    res = (amqp_rpc_reply_t)amqp_simple_rpc(
        cnn->conn,
        AMQP_CHANNEL,
        AMQP_BASIC_CONSUME_METHOD,
        &method_ok,
        &s
    ); 

The backtrace is:

#0  0x00bbd416 in __kernel_vsyscall ()
#1  0x00248d71 in raise (sig=6) at
../nptl/sysdeps/unix/sysv/linux/raise.c:64
#2  0x0024a64a in abort () at abort.c:92
#3  0x0047ec9e in amqp_encode_field_value (encoded=..., entry=0x8864294,
offsetptr=0xbfca3a6c) at amqp_table.c:413
#4  0x0047f0c4 in amqp_encode_table (encoded=..., input=0xbfca3dcc,
offsetptr=0xbfca3ad8) at amqp_table.c:324
#5  0x004838a2 in amqp_encode_method (methodNumber=3932180,
decoded=0xbfca3da8, encoded=...) at amqp_framing.c:1357
#6  0x0047f98d in inner_send_frame (state=0x8897658, frame=0xbfca3bb4,
encoded=0xbfca3b80, payload_len=0xbfca3b88) at amqp_connection.c:367
#7  0x0047fabd in amqp_send_frame (state=0x8897658, frame=0xbfca3bb4) at
amqp_connection.c:427
#8  0x004806bb in amqp_send_method (state=0x8897658, channel=1, id=3932180,
decoded=0xbfca3da8) at amqp_socket.c:268
#9  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
#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
#11 0x0825fd39 in zend_do_fcall_common_helper_SPEC (execute_data=<value
optimized out>) at /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:316
#12 0x0823676e in execute (op_array=0x8864738) at
/usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:107
#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
#14 0x081b5ac6 in php_execute_script (primary_file=0xbfca63c4) at
/usr/src/debug/php-5.3.3/main/main.c:2260
#15 0x0829f358 in main (argc=3, argv=0xbfca6504) at
/usr/src/debug/php-5.3.3/sapi/cli/php_cli.c:1192

Thoughts on what I am doing wrong? Is there a spec somewhere I can use? =)

Thanks,
me


On 9/21/10 3:10 PM, "David Wragg" <david at rabbitmq.com> wrote:

> Hi Pieter,
> 
> Sorry for the delay in responding.
> 
> Pieter de Zwart <pdezwart at rubiconproject.com> writes:
>> > I need some help with rabbitmq-c. I inherited the PHP extension code base,
>> > so I am a little lost. I pulled in RabbitMQ 2.1, along with the tip of
>> > rabbitmq-c and rabbitmq-codegen. Everything compiles just fine, but when I
>> > try to instantiate a new connection in the PHP extension, I get:
>> >
>> > localhost:~/src/pecl/amqp/trunk$ php -f tests/test.php
>> > Expected 0x000A000A method frame on channel 0, got frame on channel 19793
>> >
>> > This is the stacktrace:
>> > #0  0x009f4416 in __kernel_vsyscall ()
>> > #1  0x00248d71 in raise (sig=6) at
>> > ../nptl/sysdeps/unix/sysv/linux/raise.c:64
>> > #2  0x0024a64a in abort () at abort.c:92
>> > #3  0x00137640 in amqp_simple_wait_method (state=0xa1604c0,
>> > expected_channel=0, expected_method=655370, output=0xbfe31b20) at
>> > amqp_socket.c:243
>> > #4  0x001379fc in amqp_login_inner (state=0xa1604c0, vhost=0xa12d70c "/",
>> > channel_max=0, frame_max=131072, heartbeat=0,
>> > sasl_method=AMQP_SASL_METHOD_PLAIN) at amqp_socket.c:373
> 
> What's happening is that the C client is proposing a version of AMQP,
> and the server is rejecting it.  I can't tell more that that, because
> the C client doesn't handle this version mismatch situation well.
> 
> But the versions of rabbitmq-c, rabbitmq-codegen and rabbitmq-server you
> describe all implement AMQP 0-9-1, so how that can be happening is a bit
> of a mystery.
> 
> My guess is that you are actually pointing the current C client at an
> old (pre-2.0) version of rabbitmq-server somehow.  Is that possible?
> Please double check and let me know.
> 
> David
> 
> --
> David Wragg
> Staff Engineer, RabbitMQ
> SpringSource, a division of VMware
> 

-- 
the rubicon project

PIETER DE ZWART | LEAD, INTERFACES TEAM
€€€ P 310 207 0272 | x224
€€€ C 408 666 4443
€€€ F 323 466 7119


1925 S. BUNDY  DRIVE
LOS ANGELES, CALIFORNIA 90025

WWW.RUBICONPROJECT.COM <http://www.rubiconproject.com/>


³COMPANY OF THE YEAR² ALWAYSON ONMEDIA 2009
#24 ON FAST COMPANY FAST 50 READER FAVORITES
2008  ALWAYSON 250 GLOBAL WINNER
2008 ALWAYSON ONMEDIA 100 WINNER
TWIISTUP3  BEST IN SHOW
PRICEWATERHOUSECOOPERS ­ ENTRETECH  BEST STARTUP
AMERICAN BUSINESS AWARDS - STEVIES  Œ08 FINALIST BEST NEW COMPANY
AMERICAN BUSINESS  AWARDS - STEVIES Œ08 FINALIST MOST INNOVATIVE COMPANY
AMERICAN BUSINESS  AWARDS - STEVIES Œ08 FINALIST NEW PRODUCT OR SERVICE -
SERVICES

P          Please consider the environment before printing this e-mail



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100922/1ff154bb/attachment-0001.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 28320 bytes
Desc: not available
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100922/1ff154bb/attachment-0001.png>


More information about the rabbitmq-discuss mailing list