Skip to content
This repository has been archived by the owner on Nov 17, 2020. It is now read-only.

attach: crash if initial-delivery-count is not 0 #9

Closed
mbroadst opened this issue Mar 26, 2015 · 8 comments
Closed

attach: crash if initial-delivery-count is not 0 #9

mbroadst opened this issue Mar 26, 2015 · 8 comments

Comments

@mbroadst
Copy link
Contributor

Hey, running into another parsing error it seems. I was wondering if you could help me figure out what's going on with it from the rabbitmq side (if I can better understand why these errors are happening, I can hopefully start submitting more relevant issues 😄). The error is:

=INFO REPORT==== 26-Mar-2015::13:43:47 ===
accepting AMQP connection <0.2116.0> (192.168.1.100:52559 -> 192.168.1.104:5672)

=ERROR REPORT==== 26-Mar-2015::13:43:47 ===
** Generic server <0.2123.0> terminating
** Last message in was {'$gen_cast',
                           {frame,
                               {'v1_0.attach',
                                   {utf8,<<"/topic/inventory.cell.info_TX">>},
                                   {uint,0},
                                   false,
                                   {ubyte,2},
                                   {ubyte,0},
                                   {'v1_0.source',
                                       {utf8,<<"localhost">>},
                                       {uint,0},
                                       {symbol,<<"session-end">>},
                                       {uint,0},
                                       false,
                                       {map,[]},
                                       undefined,
                                       {map,[]},
                                       undefined,undefined,undefined},
                                   {'v1_0.target',
                                       {utf8,<<"/topic/inventory.cell.info">>},
                                       {uint,0},
                                       {symbol,<<"session-end">>},
                                       {uint,0},
                                       false,
                                       {map,[]},
                                       undefined},
                                   {map,[]},
                                   false,
                                   {uint,1},
                                   {ulong,0},
                                   undefined,undefined,
                                   {map,[]}},
                               <0.2116.0>}}
** When Server state == {state,<0.2126.0>,<0.2132.0>,4294967287,<0.2116.0>,
                            <0.2122.0>,
                            {[],[]},
                            {session,1,100,100,1,65535,65535,0,65535,65535,0,
                                0,
                                {0,nil},
                                {0,nil}}}
** Reason for termination == 
** {{case_clause,
        {ok,{'v1_0.target',
                {utf8,<<"/topic/inventory.cell.info">>},
                {uint,0},
                {symbol,<<"session-end">>},
                {uint,0},
                false,
                {map,[]},
                undefined},
            {incoming_link,
                {utf8,<<"/topic/inventory.cell.info_TX">>},
                <<"amq.topic">>,<<"inventory.cell.info">>,undefined,0,
                undefined,undefined,32768,[],
                {set,0,16,16,8,80,48,
                    {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
                    {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}}}},
    [{rabbit_amqp1_0_incoming_link,attach,3,
         [{file,"rabbitmq-amqp1.0/src/rabbit_amqp1_0_incoming_link.erl"},
          {line,47}]},
     {rabbit_amqp1_0_session_process,with_disposable_channel,2,
         [{file,"rabbitmq-amqp1.0/src/rabbit_amqp1_0_session_process.erl"},
          {line,377}]},
     {rabbit_amqp1_0_session_process,handle_control,2,
         [{file,"rabbitmq-amqp1.0/src/rabbit_amqp1_0_session_process.erl"},
          {line,183}]},
     {rabbit_amqp1_0_session_process,handle_cast,2,
         [{file,"rabbitmq-amqp1.0/src/rabbit_amqp1_0_session_process.erl"},
          {line,134}]},
     {gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1034}]},
     {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]}

=ERROR REPORT==== 26-Mar-2015::13:43:50 ===
closing AMQP connection <0.2116.0> (192.168.1.100:52559 -> 192.168.1.104:5672):
{handshake_error,running,<0.2123.0>,
    {{symbol,<<"amqp:internal-error">>},
     "Session error: ~p~n~p~n",
     [{case_clause,
          {ok,{'v1_0.target',
                  {utf8,<<"/topic/inventory.cell.info">>},
                  {uint,0},
                  {symbol,<<"session-end">>},
                  {uint,0},
                  false,
                  {map,[]},
                  undefined},
              {incoming_link,
                  {utf8,<<"/topic/inventory.cell.info_TX">>},
                  <<"amq.topic">>,<<"inventory.cell.info">>,undefined,0,
                  undefined,undefined,32768,[],
                  {set,0,16,16,8,80,48,
                      {[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},
                      {{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}}}},
      [{rabbit_amqp1_0_incoming_link,attach,3,
           [{file,"rabbitmq-amqp1.0/src/rabbit_amqp1_0_incoming_link.erl"},
            {line,47}]},
       {rabbit_amqp1_0_session_process,with_disposable_channel,2,
           [{file,"rabbitmq-amqp1.0/src/rabbit_amqp1_0_session_process.erl"},
            {line,377}]},
       {rabbit_amqp1_0_session_process,handle_control,2,
           [{file,"rabbitmq-amqp1.0/src/rabbit_amqp1_0_session_process.erl"},
            {line,183}]},
       {rabbit_amqp1_0_session_process,handle_cast,2,
           [{file,"rabbitmq-amqp1.0/src/rabbit_amqp1_0_session_process.erl"},
            {line,134}]},
       {gen_server2,handle_msg,2,[{file,"src/gen_server2.erl"},{line,1034}]},
       {proc_lib,init_p_do_apply,3,[{file,"proc_lib.erl"},{line,239}]}]]}}

I think this might be a problem with an invalid match on initial_delivery_count? But to be frank I'm a bit lost, and trying to play catchup

@simonmacmullen simonmacmullen changed the title failure on attach frame attach: crash if initial-delivery-count is not 0 Mar 26, 2015
@simonmacmullen
Copy link

Yeah, we seem to be assuming it will be 0. That should be fixed, but in the mean time it might help you get further to set it to 0...

@mbroadst
Copy link
Contributor Author

Okay I've been trying to parse through this a little bit more, now it seems to me that your attach frame matcher is perhaps incorrect? If I look at the spec, the performative definition is as follows:

<type name="attach" class="composite" source="list" provides="frame">
    <descriptor name="amqp:attach:list" code="0x00000000:0x00000012"/>
    <field name="name" type="string" mandatory="true"/>
    <field name="handle" type="handle" mandatory="true"/>
    <field name="role" type="role" mandatory="true"/>
    <field name="snd-settle-mode" type="sender-settle-mode" default="mixed"/>
    <field name="rcv-settle-mode" type="receiver-settle-mode" default="first"/>
    <field name="source" type="*" requires="source"/>
    <field name="target" type="*" requires="target"/>
    <field name="unsettled" type="map"/>
    <field name="incomplete-unsettled" type="boolean" default="false"/>
    <field name="initial-delivery-count" type="sequence-no"/>
    <field name="max-message-size" type="ulong"/>
    <field name="offered-capabilities" type="symbol" multiple="true"/>
    <field name="desired-capabilities" type="symbol" multiple="true"/>
    <field name="properties" type="fields"/>
</type>

and yet your definition for attach is as follows:

attach(#'v1_0.attach'{name = Name,
                      handle = Handle,
                      source = Source,
                      snd_settle_mode = SndSettleMode,
                      rcv_settle_mode = RcvSettleMode,
                      target = Target,
                      initial_delivery_count = {uint, InitTransfer}},

am I missing something?

@mbroadst
Copy link
Contributor Author

we're actually sending initial delivery count as {uint,1} above

@mbroadst
Copy link
Contributor Author

for extra help here, the js representation of the performative we are sending is:

{
    "descriptor": {
        "buffer": {
            "type": "Buffer",
            "data": [0, 0, 0, 0, 0, 0, 0, 18]
        },
        "offset": 0
    },
    "value": {
        "name": "/topic/inventory.cell.info_TX",
        "handle": {
            "typeName": "uint",
            "value": 0
        },
        "role": false,
        "senderSettleMode": {
            "typeName": "ubyte",
            "value": 2
        },
        "receiverSettleMode": {
            "typeName": "ubyte",
            "value": 0
        },
        "source": {
            "descriptor": {
                "buffer": {
                    "type": "Buffer",
                    "data": [0, 0, 0, 0, 0, 0, 0, 40]
                },
                "offset": 0
            },
            "address": "localhost",
            "durable": 0,
            "expiryPolicy": "session-end",
            "timeout": 0,
            "dynamic": false
        },
        "target": {
            "descriptor": {
                "buffer": {
                    "type": "Buffer",
                    "data": [0, 0, 0, 0, 0, 0, 0, 41]
                },
                "offset": 0
            },
            "address": "/topic/inventory.cell.info",
            "durable": 0,
            "expiryPolicy": {
                "contents": "session-end"
            },
            "timeout": 0,
            "dynamic": false
        },
        "unsettled": {},
        "incompleteUnsettled": false,
        "initialDeliveryCount": {
            "typeName": "uint",
            "value": 1
        },
        "maxMessageSize": {
            "typeName": "ulong",
            "value": 0
        },
        "offeredCapabilities": null,
        "desiredCapabilities": null,
        "properties": {},
        "encodeOrdering": ["name", "handle", "role", "senderSettleMode", "receiverSettleMode", "source", "target", "unsettled", "incompleteUnsettled", "initialDeliveryCount", "maxMessageSize", "offeredCapabilities", "desiredCapabilities", "properties"]
    }
}

and the raw hex is:

000000a002000001005312c0930ea11d2f746f7069632f696e76656e746f72792e63656c6c2e696e666f5f5458434250025000005328c0260ba1096c6f63616c686f737443a30b73657373696f6e2d656e644342c1010040c10100404040005329c03107a11a2f746f7069632f696e76656e746f72792e63656c6c2e696e666f43a30b73657373696f6e2d656e644342c1010040c10100425201444040c10100

@mbroadst
Copy link
Contributor Author

@simonmacmullen the error seems to be in lines 52-82 of rabbit_amqp1_0_incoming_link, but that's about as far as I've gotten.. I find erlang's "backtraces" somewhat difficult to parse at this point , and would be very interested to learn how you did it when you do 😄

@mbroadst
Copy link
Contributor Author

@simonmacmullen are those arguments meant to line up directly with the performative description?

@mbroadst
Copy link
Contributor Author

@simonmacmullen lol, okay well after like an hour and a half of sifting through those 30 lines it turns out yes indeed, we are sending 1 as the initial message count and the bug is in fact that you guys assume 0.. I suppose we can chalk this up to a nice erlang learning experience!

@simonmacmullen
Copy link

Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants