Uploaded image for project: 'AMQ Clients'
  1. AMQ Clients
  2. ENTMQCL-693

[cpp] Cannot receive message properties with null values

XMLWordPrintable

    • September 2018

      When receiving a particular message, I get an exception from qpid-proton/cpp/src/decoder.cpp:186

      decoder& decoder::operator>>(scalar& x) {
          internal::state_guard sg(*this);
          type_id got = pre_get();
          if (!type_id_is_scalar(got))
              throw conversion_error("expected scalar, found "+type_name(got));  // <-- here
          x.set(pn_data_get_atom(pn_object()));
          sg.cancel();                // No error, no rewind
          return *this;
      }
      

      This exception is triggered if my code attempts to pass the message by value, or (if I make that a call by reference) if my code does

      typedef std::map<std::string, proton::scalar> property_map;
      property_map props;
      proton::get(m.properties(), props);  // <--this
      

      Output

      $ target/bin/aac3_receiver -b 127.0.0.1:5672/unknowntestmABOk0t -c 0 --log-msgs interop
      [0x17caea0]:  -> SASL
      [0x17caea0]:  <- SASL
      [0x17caea0]:0 <- @sasl-mechanisms(64) [sasl-server-mechanisms=@PN_SYMBOL[:PLAIN, :ANONYMOUS]]
      [0x17caea0]:0 -> @sasl-init(65) [mechanism=:ANONYMOUS, initial-response=b"anonymous@nixos"]
      [0x17caea0]:0 <- @sasl-outcome(68) [code=0]
      [0x17caea0]:  -> AMQP
      [0x17caea0]:0 -> @open(16) [container-id="f0848355-388f-4f11-937b-e916cfb3a817", hostname="127.0.0.1", channel-max=32767]
      [0x17caea0]:0 -> @begin(17) [next-outgoing-id=0, incoming-window=2147483647, outgoing-window=2147483647]
      [0x17caea0]:0 -> @attach(18) [name="b9ee0b36-bad5-4e35-8289-b91dd838a52a", handle=0, role=true, snd-settle-mode=2, rcv-settle-mode=0, source=@source(40) [address="unknowntestmABOk0t", durable=0, timeout=0, dynamic=false, capabilities=@PN_SYMBOL[]], target=@target(41) [durable=0, timeout=0, dynamic=false], initial-delivery-count=0, max-message-size=0]
      [0x17caea0]:0 -> @flow(19) [incoming-window=2147483647, next-outgoing-id=0, outgoing-window=2147483647, handle=0, delivery-count=0, link-credit=10, drain=false]
      [0x17caea0]:  <- AMQP
      [0x17caea0]:0 <- @open(16) [container-id="0.0.0.0", max-frame-size=4294967295, channel-max=65535, idle-time-out=30000, offered-capabilities=@PN_SYMBOL[:"sole-connection-for-container", :"DELAYED_DELIVERY", :"SHARED-SUBS", :"ANONYMOUS-RELAY"], properties={:product="apache-activemq-artemis", :version="2.6.0-SNAPSHOT"}]
      [0x17caea0]:0 <- @begin(17) [remote-channel=0, next-outgoing-id=1, incoming-window=2147483647, outgoing-window=2147483647, handle-max=65535]
      [0x17caea0]:0 <- @attach(18) [name="b9ee0b36-bad5-4e35-8289-b91dd838a52a", handle=0, role=false, snd-settle-mode=2, rcv-settle-mode=0, source=@source(40) [address="unknowntestmABOk0t", durable=0, expiry-policy=:"session-end", timeout=0, dynamic=false, capabilities=@PN_SYMBOL[]], target=@target(41) [], incomplete-unsettled=false, initial-delivery-count=0]
      [0x17caea0]:0 <- @transfer(20) [handle=0, delivery-id=0, delivery-tag=b"\x00", message-format=0] (452) "\x00Sp\xc0\x08\x05AP\x08@@R\x01\x00Sr\xc1)\x04\xa3\x0ex-opt-jms-destQ\x00\xa3\x12x-opt-jms-msg-typeQ\x00\x00Ss\xd0\x00\x00\x00)\x00\x00\x00\x0a@@\xa1\x12unknowntestmABOk0t@@@@@@\x83\x00\x00\x01b\xb5\xd5\x80\x83\x00St\xd1\x00\x00\x012\x00\x00\x00\x10\xa1\x10__HDR_COMMAND_IDT\x05\xa1\x0d__HDR_ARRIVALU\x00\xa1\x11JMSXDeliveryCount@\xa1\x10__HDR_MESSAGE_ID\xa0K\x00\x00\x00Gn\x00\x01{\x01\x00 ID:nixos-42953-1523469090740-1:1\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\xa1\x14__HDR_GROUP_SEQUENCET\x00\xa1\x11__HDR_PRODUCER_ID\xa08\x00\x00\x004{\x01\x00 ID:nixos-42953-1523469090740-1:1\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\xa1\x0f__HDR_DROPPABLEB\xa1\x14__HDR_BROKER_IN_TIME\x81\x00\x00\x01b\xb5\xd5\x80\x84\x00Sw\xa1\x19Conversion to AMQP error!"
      [0x17caea0]:0 <- @transfer(20) [handle=0, delivery-id=1, delivery-tag=b"\x01", message-format=0] (448) "\x00Sp\xc0\x04\x02AP\x08\x00Sr\xc1)\x04\xa3\x0ex-opt-jms-destQ\x00\xa3\x12x-opt-jms-msg-typeQ\x00\x00Ss\xd0\x00\x00\x00)\x00\x00\x00\x0a@@\xa1\x12unknowntestmABOk0t@@@@@@\x83\x00\x00\x01b\xb5\xd9\xef\x0f\x00St\xd1\x00\x00\x012\x00\x00\x00\x10\xa1\x10__HDR_COMMAND_IDT\x05\xa1\x0d__HDR_ARRIVALU\x00\xa1\x11JMSXDeliveryCount@\xa1\x10__HDR_MESSAGE_ID\xa0K\x00\x00\x00Gn\x00\x01{\x01\x00 ID:nixos-36341-1523469381242-1:1\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\xa1\x14__HDR_GROUP_SEQUENCET\x00\xa1\x11__HDR_PRODUCER_ID\xa08\x00\x00\x004{\x01\x00 ID:nixos-36341-1523469381242-1:1\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x01\xa1\x0f__HDR_DROPPABLEB\xa1\x14__HDR_BROKER_IN_TIME\x81\x00\x00\x01b\xb5\xd9\xef\x10\x00Sw\xa1\x19Conversion to AMQP error!"
      

      Stacktrace

      bt
      * thread #1, name = 'aac3_receiver', stop reason = breakpoint 17.1
        * frame #0: 0x00007ff73861abb0 libqpid-proton-cpp.so.12`proton::codec::decoder::operator>>(this=0x00007ffc72f4e310, x=0x00007ffc72f4e360) at decoder.cpp:186
          frame #1: 0x00007ff73860e04d libqpid-proton-cpp.so.12`void proton::get<proton::map_type_impl<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, proton::scalar> >(proton::value const&, proton::map_type_impl<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, proton::scalar>&) at decoder.hpp:161
          frame #2: 0x00007ff73860df69 libqpid-proton-cpp.so.12`void proton::get<proton::map_type_impl<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, proton::scalar> >(proton::value const&, proton::map_type_impl<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, proton::scalar>&) [inlined] proton::codec::decoder& proton::codec::operator>><std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, proton::scalar, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const, proton::scalar> > >(m=size=2, d=0x00007ffc72f4e310) at map.hpp:42
          frame #3: 0x00007ff73860df69 libqpid-proton-cpp.so.12`void proton::get<proton::map_type_impl<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, proton::scalar> >(v=<unavailable>, x=0x00000000017ee510) at value.hpp:133
          frame #4: 0x00007ff73860e3a0 libqpid-proton-cpp.so.12`proton::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, proton::scalar>::cache(this=0x00000000017e24b8) const at map.cpp:97
          frame #5: 0x00007ff73860e3f8 libqpid-proton-cpp.so.12`proton::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, proton::scalar>::empty() const [inlined] proton::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, proton::scalar>::empty(this=0x00000000017e24b8) const at map.cpp:182
          frame #6: 0x00007ff73860e3f0 libqpid-proton-cpp.so.12`proton::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, proton::scalar>::empty(this=0x00000000017e24b8) const
          frame #7: 0x00007ff73861f3b4 libqpid-proton-cpp.so.12`proton::message::encode(std::vector<char, std::allocator<char> >&) const [inlined] proton::message::impl::flush(this=0x00000000017e24b0) at message.cpp:65
          frame #8: 0x00007ff73861f3ac libqpid-proton-cpp.so.12`proton::message::encode(this=0x00000000017caa28, s=size=0) const at message.cpp:273
          frame #9: 0x00007ff73861f566 libqpid-proton-cpp.so.12`proton::message::operator=(this=0x00007ffc72f4e4b8, m=<unavailable>) at message.cpp:112
          frame #10: 0x0000000000452088 aac3_receiver`dtests::common::DictFormatter::printMessageInterop(this=0x00007ffc72f4e870, m=0x00000000017caa28) at DictFormatter.cpp:267
          frame #11: 0x000000000042d48a aac3_receiver`dtests::proton::reactor::ReceiverHandler::on_message(this=0x00007ffc72f50390, d=0x00007ffc72f4eaa8, m=0x00000000017caa28) at ReceiverHandler.cpp:334
          frame #12: 0x00007ff7386202ef libqpid-proton-cpp.so.12`proton::messaging_adapter::dispatch(proton::messaging_handler&, pn_event_t*) at messaging_adapter.cpp:130
          frame #13: 0x00007ff7386200a8 libqpid-proton-cpp.so.12`proton::messaging_adapter::dispatch(handler=0x00007ffc72f50390, event=<unavailable>) at messaging_adapter.cpp:314
          frame #14: 0x00007ff73861705b libqpid-proton-cpp.so.12`proton::container::impl::handle(this=<unavailable>, event=<unavailable>) at proactor_container_impl.cpp:662
          frame #15: 0x00007ff7386177fb libqpid-proton-cpp.so.12`proton::container::impl::thread(this=0x00000000017c87a0) at proactor_container_impl.cpp:679
          frame #16: 0x00007ff738617dd5 libqpid-proton-cpp.so.12`proton::container::impl::run(this=0x00000000017c87a0, threads=1) at proactor_container_impl.cpp:725
          frame #17: 0x000000000042740e aac3_receiver`dtests::proton::reactor::ReceivingClient::run(this=<unavailable>, argc=<unavailable>, argv=<unavailable>) const at ReceivingClient.cpp:330
          frame #18: 0x0000000000422355 aac3_receiver`main(argc=7, argv=0x00007ffc72f50768) at aac3_receiver.cpp:16
          frame #19: 0x00007ff736dcc020 libc.so.6`__libc_start_main + 240
          frame #20: 0x000000000042287a aac3_receiver`_start at start.S:120
      
      (lldb) frame variable
      (proton::codec::decoder *const) this = 0x00007ffc72f4e310
      (proton::scalar &) x = 0x00007ffc72f4e360: {
        proton::scalar_base = {
          atom_ = {
            type = PN_NULL
            u = {
              as_bool = false
              as_ubyte = '\0' 0 '\0'
              as_byte = '\0' 0 '\0'
              as_ushort = 0
              as_short = 0
              as_uint = 0
              as_int = 0
              as_char = 0
              as_ulong = 0
              as_long = 0
              as_timestamp = 0
              as_float = 0
              as_double = 0
              as_decimal32 = 0
              as_decimal64 = 0
              as_decimal128 = (bytes = "")
              as_uuid = (bytes = "")
              as_bytes = (size = 0, start = 0x0000000000000000)
            }
          }
          bytes_ = {
            std::vector<unsigned char, std::allocator<unsigned char> > = size=0 {}
          }
        }
      }
      (proton::internal::state_guard) sg = {
        data_ = 0x00007ffc72f4e310
        point_ = 0x0000000000000006
        cancel_ = false
      }
      (proton::type_id) got = NULL_TYPE
      

      This can be reliably reproduced by sending a message to Artemis broker using OpenWire protocol and receiving it with qpid-proton-cpp.

      $ java -jar cli-activemq/target/cli-activemq-1.2.2-SNAPSHOT-LATEST.jar sender --msg-priority 8 --log-msgs interop --count 1 --msg-durable True --address unknowntestmABOk0t
      $ target/bin/aac3_receiver -b 127.0.0.1:5672/unknowntestmABOk0t -c 0 --log-msgs interop

              rhn-engineering-aconway Alan Conway
              jdanek@redhat.com Jiri Daněk
              Radim Kubis Radim Kubis
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Estimated:
                  Original Estimate - 3 hours
                  3h
                  Remaining:
                  Remaining Estimate - 3 hours
                  3h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified