Hey guys,

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_methode5370, output=0xbfe31b20) at
amqp_socket.c:243
#4 0x001379fc in amqp_login_inner (state=0xa1604c0, vhost=0xa12d70c "/",
channel_max=0, frame_max1072, heartbeat=0,
sasl_method=AMQP_SASL_METHOD_PLAIN) at amqp_socket.c:373
#5 amqp_login (state=0xa1604c0, vhost=0xa12d70c "/", channel_max=0,
frame_max1072, heartbeat=0, sasl_method=AMQP_SASL_METHOD_PLAIN) at
amqp_socket.c:463
#6 0x00629b9f in zim_amqp_class___construct (ht=0, return_value=0xa12d0f0,
return_value_ptr=0x0, this_ptr=0xa12d10c, return_value_used=0) at
/home/pdezwart/src/pecl/amqp/trunk/amqp.c:413
#7 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
#8 0x0823676e in execute (op_array=0xa12d580) at
/usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:107
#9 0x0820ef36 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at
/usr/src/debug/php-5.3.3/Zend/zend.c:1194
#10 0x081b5ac6 in php_execute_script (primary_file=0xbfe34274) at
/usr/src/debug/php-5.3.3/main/main.c:2260
#11 0x0829f358 in main (argc=3, argv=0xbfe343b4) at
/usr/src/debug/php-5.3.3/sapi/cli/php_cli.c:1192

These mean nothing to me... Help? =)

Pieter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100917/897b75cc/attachment-0001.htm>

Search Discussions

  • Pieter de Zwart at Sep 21, 2010 at 7:46 pm
    Hey guys,

    Any help with this? Is there documentation somewhere I can use?

    Thanks,
    Pieter

    On 9/17/10 1:27 PM, "Pieter de Zwart" wrote:

    Hey guys,

    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_methode5370, output=0xbfe31b20) at
    amqp_socket.c:243
    #4 0x001379fc in amqp_login_inner (state=0xa1604c0, vhost=0xa12d70c "/",
    channel_max=0, frame_max1072, heartbeat=0,
    sasl_method=AMQP_SASL_METHOD_PLAIN) at amqp_socket.c:373
    #5 amqp_login (state=0xa1604c0, vhost=0xa12d70c "/", channel_max=0,
    frame_max1072, heartbeat=0, sasl_method=AMQP_SASL_METHOD_PLAIN) at
    amqp_socket.c:463
    #6 0x00629b9f in zim_amqp_class___construct (ht=0, return_value=0xa12d0f0,
    return_value_ptr=0x0, this_ptr=0xa12d10c, return_value_used=0) at
    /home/pdezwart/src/pecl/amqp/trunk/amqp.c:413
    #7 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
    #8 0x0823676e in execute (op_array=0xa12d580) at
    /usr/src/debug/php-5.3.3/Zend/zend_vm_execute.h:107
    #9 0x0820ef36 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at
    /usr/src/debug/php-5.3.3/Zend/zend.c:1194
    #10 0x081b5ac6 in php_execute_script (primary_file=0xbfe34274) at
    /usr/src/debug/php-5.3.3/main/main.c:2260
    #11 0x0829f358 in main (argc=3, argv=0xbfe343b4) at
    /usr/src/debug/php-5.3.3/sapi/cli/php_cli.c:1192

    These mean nothing to me... Help? =)

    Pieter

    _______________________________________________
    rabbitmq-discuss mailing list
    rabbitmq-discuss at lists.rabbitmq.com
    https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
    --
    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/20100921/7f28e59a/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/20100921/7f28e59a/attachment-0001.png>
  • David Wragg at Sep 21, 2010 at 10:10 pm
    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_methode5370, output=0xbfe31b20) at
    amqp_socket.c:243
    #4 0x001379fc in amqp_login_inner (state=0xa1604c0, vhost=0xa12d70c "/",
    channel_max=0, frame_max1072, 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
  • Pieter de Zwart at Sep 22, 2010 at 7:33 pm
    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 (methodNumber932180,
    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, id932180,
    decoded=0xbfca3da8) at amqp_socket.c:268
    #9 0x00480729 in amqp_simple_rpc (state=0x8897658, channel=1,
    request_id932180, 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" 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_methode5370, output=0xbfe31b20) at
    amqp_socket.c:243
    #4 0x001379fc in amqp_login_inner (state=0xa1604c0, vhost=0xa12d70c "/",
    channel_max=0, frame_max1072, 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>
  • David Wragg at Sep 22, 2010 at 9:23 pm
    Hi Pieter,

    Pieter de Zwart <pdezwart at rubiconproject.com> writes:
    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
    );
    There are a couple of issues here.

    The first, and the one that's leading to your segfault and backtrace
    gave, is that you are not setting the "arguments" field of the
    amqp_basic_consume_t struct. Setting it to NULL would be fine.

    With that fixed, I think you will run into a problem with
    method_ok. That argument is supposed to be a zero-terminated array of
    acceptable reply method ids. So it should be something like:

    amqp_method_number_t methods_ok[] = { AMQP_BASIC_CONSUME_OK_METHOD, 0 };

    But really, I think you should be calling amqp_basic_consume, which will
    take case of both those things. Is there a reason you're not using it?
    [...]

    Thoughts on what I am doing wrong? Is there a spec somewhere I can
    use? =)
    I'm afraid not. The C client could do with some documentation work.

    David

    --
    David Wragg
    Staff Engineer, RabbitMQ
    SpringSource, a division of VMware
  • Pieter de Zwart at Sep 23, 2010 at 4:40 pm
    The sad and honest truth is that I inherited this code, so I am still
    familiarizing myself with it.
    Thank you very much for all of your help. I will go pound on it some more
    and humbly request your assistance again next time I run into a roadblock =)
    Pieter

    On 9/22/10 2:23 PM, "David Wragg" wrote:

    take case of both those things. Is there a reason you're not using it?

    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20100923/80da9ac4/attachment.htm>

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprabbitmq-discuss @
categoriesrabbitmq
postedSep 17, '10 at 8:27p
activeSep 23, '10 at 4:40p
posts6
users2
websiterabbitmq.com
irc#rabbitmq

2 users in discussion

Pieter de Zwart: 4 posts David Wragg: 2 posts

People

Translate

site design / logo © 2022 Grokbase