Bug 1059785

Summary: [amqp1.0] Client is not finished when incorrect type is given for a property value
Product: Red Hat Enterprise MRG Reporter: Petr Matousek <pematous>
Component: qpid-cppAssignee: Gordon Sim <gsim>
Status: CLOSED CURRENTRELEASE QA Contact: Ernie <eallen>
Severity: low Docs Contact:
Priority: medium    
Version: DevelopmentCC: eallen, esammons, gsim, iboverma, jross, pematous
Target Milestone: 3.0Keywords: OtherQA
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: qpid-cpp-0.22-35 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-01-21 12:56:01 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:
Bug Depends On:    
Bug Blocks: 1010399    

Description Petr Matousek 2014-01-30 16:14:21 UTC
Description of problem:

When incorrect type is given for a property value, (ie. string
instead of timestamp), sender's application never ends its execution, ie: 

# $cppapi/spout --connection-options "{  protocol : 'amqp1.0' }"
--property "x-amqp-absolute-expiry-time=test"  amq.direct
invalid conversion: Cannot convert test
(/builddir/build/BUILD/qpid-0.22/cpp/src/qpid/types/Variant.cpp:132)
<client not finished> 

Although the exception is expected, the application shall end its
execution.

Version-Release number of selected component (if applicable):
qpid-cpp-*-0.22-33

How reproducible:
100%

Steps to Reproduce:
1. ./spout --connection-options "{  protocol : 'amqp1.0' }"  --property "x-amqp-group-sequence=test"  amq.direct

OR
1.  qpid-send --connection-options "{  protocol : 'amqp1.0' }"  --property "x-amqp-absolute-expiry-time=test"  -a amq.direct

etc.

Actual results:
Client is not finished when incorrect type is given for a property value.

Expected results:
Client reports an exception and ends its execution, return value is non-zero.

Additional info:
stack trace:
Thread 2 (Thread 0x7fecb5aac700 (LWP 3819)):
#0  0x0000003a326e9163 in epoll_wait () at
../sysdeps/unix/syscall-template.S:82
#1  0x00000032dcf4c1ed in qpid::sys::Poller::wait (this=0x1bf0220,
timeout=...) at
/usr/src/debug/qpid-0.22/cpp/src/qpid/sys/epoll/EpollPoller.cpp:566
#2  0x00000032dcf4c8c1 in qpid::sys::Poller::run (this=0x1bf0220) at
/usr/src/debug/qpid-0.22/cpp/src/qpid/sys/epoll/EpollPoller.cpp:518
#3  0x00000032dcf41bca in qpid::sys::(anonymous namespace)::runRunnable
(p=<value optimized out>) at
/usr/src/debug/qpid-0.22/cpp/src/qpid/sys/posix/Thread.cpp:35
#4  0x0000003a32e079d1 in start_thread (arg=0x7fecb5aac700) at
pthread_create.c:301
#5  0x0000003a326e8b6d in clone () at
../sysdeps/unix/sysv/linux/x86_64/clone.S:115

Thread 1 (Thread 0x7fecb5ef5840 (LWP 3818)):
#0  pthread_cond_wait@@GLIBC_2.3.2 () at
../nptl/sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:183
#1  0x00000032dd83d4f9 in wait (this=0x1bf8150) at
/usr/src/debug/qpid-0.22/cpp/src/qpid/sys/posix/Condition.h:63
#2  wait (this=0x1bf8150) at
/usr/src/debug/qpid-0.22/cpp/src/qpid/sys/Monitor.h:41
#3  qpid::messaging::amqp::ConnectionContext::wait (this=0x1bf8150) at
/usr/src/debug/qpid-0.22/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp:484

#4  0x00000032dd83eed9 in qpid::messaging::amqp::ConnectionContext::wait
(this=0x1bf8150, ssn=...) at
/usr/src/debug/qpid-0.22/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp:494

#5  0x00000032dd840fd9 in
qpid::messaging::amqp::ConnectionContext::close (this=0x1bf8150) at
/usr/src/debug/qpid-0.22/cpp/src/qpid/messaging/amqp/ConnectionContext.cpp:156

#6  0x0000000000409be4 in main ()

Comment 1 Gordon Sim 2014-01-31 12:27:29 UTC
Fixed upstream: https://svn.apache.org/r1563122

Comment 4 Ernie 2014-03-07 16:48:10 UTC
Verified for RHEL 6.5 i686
qpid-jca-0.22-2.el6.noarch
python-qpid-qmf-0.22-27.el6.i686
qpid-proton-c-devel-0.6-1.el6.i686
python-qpid-0.22-11.el6.noarch
qpid-proton-c-0.6-1.el6.i686
qpid-qmf-0.22-27.el6.i686
perl-qpid-0.22-7.el6.i686
qpid-snmpd-1.0.0-15.el6.i686
qpid-cpp-client-devel-0.22-35.el6.i686
qpid-cpp-server-linearstore-0.22-35.el6.i686
qpid-cpp-client-0.22-35.el6.i686
qpid-tools-0.22-8.el6.noarch
qpid-cpp-server-ha-0.22-35.el6.i686
qpid-java-client-0.22-6.el6.noarch
ruby-qpid-qmf-0.22-27.el6.i686
qpid-java-common-0.22-6.el6.noarch
qpid-cpp-server-0.22-35.el6.i686
qpid-jca-xarecovery-0.22-2.el6.noarch

Verified for RHEL 6.5 x86_64
qpid-cpp-server-0.22-35.el6.x86_64
python-qpid-0.22-11.el6.noarch
qpid-proton-c-0.6-1.el6.x86_64
qpid-cpp-client-0.22-35.el6.x86_64
qpid-qmf-0.22-27.el6.x86_64
python-qpid-qmf-0.22-27.el6.x86_64
qpid-tools-0.22-8.el6.noarch
qpid-cpp-client-devel-0.22-35.el6.x86_64

Output is now:
>./spout --connection-options "{ protocol : 'amqp1.0' }" --property "x-amqp-absolute-expiry-time=test"  amq.direct
invalid conversion: Cannot convert test (/builddir/build/BUILD/qpid-0.22/cpp/src/qpid/types/Variant.cpp:132)
>

and the spout client ends cleanly with return value of 1
>echo $?
1