Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.

Bug 1194199

Summary: qpid::messaging c++ client segfault w/ A-MQ 6.2
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: qpid-protonAssignee: messaging-bugs <messaging-bugs>
Status: CLOSED CURRENTRELEASE QA Contact: Messaging QE <messaging-qe-bugs>
Severity: medium Docs Contact:
Priority: medium    
Version: DevelopmentCC: esammons, gsim, iboverma, jross, mcressma, pematous, zkraus
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-04-14 14:34:09 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
captured data w/ A-MQ 6.2
none
captured data w/ A-MQ 6.1 none

Description Petr Matousek 2015-02-19 10:21:59 UTC
Description of problem:

It's possible to send/receive messages via qpid:messaging C++ api (amqp1.0) towards/from A-MQ 6.1, but there is a client segmentation fault against A-MQ 6.2 Broker. 

The same clients can send messages to A-MQ 6.1, but cannot send to A-MQ 6.2. I assume it may be an A-MQ broker regression, but since the crash is in proton library raising the issue also against qpid-proton component.

Note: the issue was also raised against A-MQ Jira, see https://issues.jboss.org/browse/ENTMQ-935 for details.

This was seen on RHEL6.6 (both x86_64 and i386).

Version-Release number of selected component (if applicable):
qpid-proton-*-0.7-4
qpid-cpp-*-0.30-6
jboss-a-mq-6.2.0.redhat-064
java-1.7.0-openjdk

How reproducible:
100%

Steps to Reproduce:

1.) A-MQ installation&setup:
  a.) download and unzip the A-MQ 6.2 broker
    # wget https://repository.jboss.org/nexus/content/repositories/ea/org/jboss/amq/jboss-a-mq/6.2.0.redhat-064/jboss-a-mq-6.2.0.redhat-064.zip
    # unzip jboss-a-mq-6.2.0.redhat-064.zip
    # cd jboss-a-mq-6.2.0.redhat-064
  b.) allow anonymous access and AMQP transport connector in etc/broker.xml
    # diff etc/broker_orig.xml  etc/broker.xml 
57a58
>             <simpleAuthenticationPlugin anonymousAccessAllowed="true"/>
75c76
<             <transportConnector name="openwire" uri="tcp://${bindAddress}:${bindPort}"/>
---
>             <transportConnector name="amqp" uri="amqp://0.0.0.0:5672"/>
  c.) start the A-MQ broker
    # export JAVA_HOME=/usr/lib/jvm/jre-1.7.0-openjdk.x86_64/
    # bin/amq

2.) send a message using qpid::messaging c++ client (amqp1.0) towards the A-MQ 6.2 broker
  # qpid-send --connection-options "{protocol:'amqp1.0'}" -a "test-queue"
Segmentation fault (core dumped)

3.) client segmentation fault

Actual results:
qpid:: messaging c++ client segmentation fault on send/receive attempt to/from A-MQ 6.2 broker.

Expected results:
qpid:: messaging c++ client can send/receive messages to/from A-MQ 6.2.

Comment 2 Petr Matousek 2015-02-19 10:23:39 UTC
Client coredump:

Core was generated by `qpid-send -t --connection-options {protocol:'amqp1.0'} -a 'test-queue' --conten'.
Program terminated with signal 11, Segmentation fault.
#0  pn_encoder_writef8 (ctx=0x13d0bd0, data=0x13d05e0, node=0x13e6a50) at /usr/src/debug/qpid-proton-0.7/proton-c/src/codec/encoder.c:149
149	    encoder->position[0] = value;
(gdb) info threads
  2 Thread 0x7f4431beb840 (LWP 3450)  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:183
• 1 Thread 0x7f4431134700 (LWP 3451)  pn_encoder_writef8 (ctx=0x13d0bd0, data=0x13d05e0, node=0x13e6a50) at /usr/src/debug/qpid-proton-0.7/proton-c/src/codec/encoder.c:149
(gdb) t a a bt

Thread 2 (Thread 0x7f4431beb840 (LWP 3450)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at ../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:183
#1  0x000000302d6466e0 in qpid::sys::Condition::wait (this=<value optimized out>, mutex=<value optimized out>) at /usr/src/debug/qpid-cpp-0.30/src/qpid/sys/posix/Condition.h:59
#2  0x000000302d63c70c in wait (this=0x13d2390) at /usr/src/debug/qpid-cpp-0.30/src/qpid/sys/Monitor.h:41
#3  qpid::messaging::amqp::ConnectionContext::wait (this=0x13d2390) at /usr/src/debug/qpid-cpp-0.30/src/qpid/messaging/amqp/ConnectionContext.cpp:542
#4  0x000000302d63c9e0 in qpid::messaging::amqp::ConnectionContext::newSession (this=0x13d2390, transactional=<value optimized out>, n=<value optimized out>)
    at /usr/src/debug/qpid-cpp-0.30/src/qpid/messaging/amqp/ConnectionContext.cpp:682
#5  0x000000302d6479eb in qpid::messaging::amqp::ConnectionHandle::newSession (this=<value optimized out>, transactional=<value optimized out>, name=<value optimized out>)
    at /usr/src/debug/qpid-cpp-0.30/src/qpid/messaging/amqp/ConnectionHandle.cpp:72
#6  0x000000302d6913e2 in qpid::messaging::Connection::createSession (this=<value optimized out>, name=<value optimized out>) at /usr/src/debug/qpid-cpp-0.30/src/qpid/messaging/Connection.cpp:82
#7  0x0000000000406191 in main (argc=<value optimized out>, argv=<value optimized out>) at /usr/src/debug/qpid-cpp-0.30/src/tests/qpid-send.cpp:357

Thread 1 (Thread 0x7f4431134700 (LWP 3451)):
#0  pn_encoder_writef8 (ctx=0x13d0bd0, data=0x13d05e0, node=0x13e6a50) at /usr/src/debug/qpid-proton-0.7/proton-c/src/codec/encoder.c:149
#1  pni_encoder_enter (ctx=0x13d0bd0, data=0x13d05e0, node=0x13e6a50) at /usr/src/debug/qpid-proton-0.7/proton-c/src/codec/encoder.c:276
#2  0x000000302ce1a6d5 in pni_data_traverse (data=0x13d05e0, enter=0x302ce1f2f0 <pni_encoder_enter>, exit=0x302ce1f1b0 <pni_encoder_exit>, ctx=0x13d0bd0)
    at /usr/src/debug/qpid-proton-0.7/proton-c/src/codec/codec.c:1239
#3  0x000000302ce1ee40 in pn_encoder_encode (encoder=0x13d0bd0, src=<value optimized out>, dst=<value optimized out>, size=4294967296) at /usr/src/debug/qpid-proton-0.7/proton-c/src/codec/encoder.c:381
#4  0x000000302ce1ff41 in pn_post_frame (disp=0x13d12e0, ch=0, fmt=<value optimized out>) at /usr/src/debug/qpid-proton-0.7/proton-c/src/dispatcher/dispatcher.c:243
#5  0x000000302ce2615b in pn_process_ssn_setup (transport=0x13d2670, endpoint=0x13e8b90) at /usr/src/debug/qpid-proton-0.7/proton-c/src/transport/transport.c:1267
#6  0x000000302ce24552 in pn_phase (transport=0x13d2670, phase=0x302ce26070 <pn_process_ssn_setup>) at /usr/src/debug/qpid-proton-0.7/proton-c/src/transport/transport.c:1739
#7  0x000000302ce2575f in pn_process (transport=0x13d2670) at /usr/src/debug/qpid-proton-0.7/proton-c/src/transport/transport.c:1750
#8  0x000000302ce28bd0 in pn_output_write_amqp (io_layer=<value optimized out>, bytes=0x13d7e10 "", size=16384) at /usr/src/debug/qpid-proton-0.7/proton-c/src/transport/transport.c:1806
#9  0x000000302ce24e24 in transport_produce (transport=0x13d2670) at /usr/src/debug/qpid-proton-0.7/proton-c/src/transport/transport.c:1848
#10 pn_transport_pending (transport=0x13d2670) at /usr/src/debug/qpid-proton-0.7/proton-c/src/transport/transport.c:2122
#11 0x000000302ce25132 in pn_transport_output (transport=0x13d2670, bytes=0x7f44301a900f "", size=65535) at /usr/src/debug/qpid-proton-0.7/proton-c/src/transport/transport.c:1876
#12 0x000000302d639f72 in qpid::messaging::amqp::ConnectionContext::encodePlain (this=0x13d2390, buffer=0x7f44301a900f "", size=65535)
    at /usr/src/debug/qpid-cpp-0.30/src/qpid/messaging/amqp/ConnectionContext.cpp:753
#13 0x000000302d63a4a2 in qpid::messaging::amqp::ConnectionContext::encode (this=0x13d2390, buffer=0x7f44301a900f "", size=65535)
    at /usr/src/debug/qpid-cpp-0.30/src/qpid/messaging/amqp/ConnectionContext.cpp:879
#14 0x000000302d65d7fd in qpid::messaging::amqp::TcpTransport::write (this=0x13e3970) at /usr/src/debug/qpid-cpp-0.30/src/qpid/messaging/amqp/TcpTransport.cpp:110
#15 0x000000302af333f8 in operator() (this=0x7f442c000980, h=...) at /usr/include/boost/function/function_template.hpp:1013
#16 qpid::sys::posix::AsynchIO::writeable (this=0x7f442c000980, h=...) at /usr/src/debug/qpid-cpp-0.30/src/qpid/sys/posix/AsynchIO.cpp:582
#17 0x000000302afb8ab3 in boost::function1<void, qpid::sys::DispatchHandle&>::operator() (this=<value optimized out>, a0=<value optimized out>) at /usr/include/boost/function/function_template.hpp:1013
#18 0x000000302afb741e in qpid::sys::DispatchHandle::processEvent (this=0x7f442c000988, type=qpid::sys::Poller::WRITABLE) at /usr/src/debug/qpid-cpp-0.30/src/qpid/sys/DispatchHandle.cpp:287
#19 0x000000302af5956d in process (this=0x13c5b80) at /usr/src/debug/qpid-cpp-0.30/src/qpid/sys/Poller.h:131
#20 qpid::sys::Poller::run (this=0x13c5b80) at /usr/src/debug/qpid-cpp-0.30/src/qpid/sys/epoll/EpollPoller.cpp:522
#21 0x000000302af4db1a in qpid::sys::(anonymous namespace)::runRunnable (p=<value optimized out>) at /usr/src/debug/qpid-cpp-0.30/src/qpid/sys/posix/Thread.cpp:35
#22 0x00000030252079d1 in start_thread (arg=0x7f4431134700) at pthread_create.c:301
#23 0x0000003024ee88fd in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Comment 3 Petr Matousek 2015-02-19 10:23:51 UTC
A-MQ Log:
========
2015-02-18 10:54:33,623 | WARN  | 0.0.1:48017@5672 | Transport                        | ivemq.broker.TransportConnection  245 | 173 - org.apache.activemq.activemq-osgi - 5.11.0.redhat-620069 | Transport Connection to: tcp://127.0.0.1:48017 failed: java.io.EOFException

Comment 4 Petr Matousek 2015-02-19 10:26:09 UTC
Created attachment 993539 [details]
captured data w/ A-MQ 6.2

Comment 5 Petr Matousek 2015-02-19 10:26:43 UTC
Created attachment 993540 [details]
captured data w/ A-MQ 6.1

Comment 18 JBoss JIRA Server 2015-04-15 15:20:32 UTC
Gary Tully <gary.tully> updated the status of jira ENTMQ-935 to Resolved

Comment 19 JBoss JIRA Server 2015-06-12 12:03:09 UTC
Otavio Piske <opiske> updated the status of jira ENTMQ-935 to Closed