Gordon Sim created QPID-4225:
--------------------------------

             Summary: CLONE - "qpid::TransportFailure" exception leak in 
AutoCancel destructor leads to termination of client
                 Key: QPID-4225
                 URL: https://issues.apache.org/jira/browse/QPID-4225
             Project: Qpid
          Issue Type: Bug
          Components: C++ Client
    Affects Versions: 0.6, 0.8, 0.10, 0.12, 0.13, 0.14, 0.15, 0.16
         Environment: Linux g++
            Reporter: Gordon Sim
            Assignee: Gordon Sim
            Priority: Critical
             Fix For: 0.19
         Attachments: Get_Test.cpp, SubscriptionManager.h

=== Code ====

SubscriptionManager subscriptions(session);
subscriptions.get(response, queue,
 timeout * TIME_SEC);

when the connection to qpid is lost during the wait period client application 
gets crashed with following exception

terminate called after throwing an instance of 'qpid::TransportFailure'
what(): 
aborted

==== GDB Backtrace output ====

Starting program: 
/home/vmware/Desktop/qpidc-0.6/examples/direct/direct_producer 
[Thread debugging using libthread_db enabled]
[New Thread 0x7f349456c780 (LWP 5097)]
[New Thread 0x425b3950 (LWP 5100)]
2012-08-09 16:39:09 warning Connection closed
terminate called after throwing an instance of 'qpid::TransportFailure'
  what():  Connection closed

Program received signal SIGABRT, Aborted.
[Switching to Thread 0x7f349456c780 (LWP 5097)]
0x00007f34930c75c5 in raise () from /lib64/libc.so.6
(gdb) bt full
#0  0x00007f34930c75c5 in raise () from /lib64/libc.so.6
No symbol table info available.
#1  0x00007f34930c8bb3 in abort () from /lib64/libc.so.6
No symbol table info available.
#2  0x00007f34939231d4 in __gnu_cxx::__verbose_terminate_handler () from 
/usr/lib64/libstdc++.so.6
No symbol table info available.
#3  0x00007f34939215f6 in ?? () from /usr/lib64/libstdc++.so.6
No symbol table info available.
#4  0x00007f34939207eb in ?? () from /usr/lib64/libstdc++.so.6
No symbol table info available.
#5  0x00007f34939213b8 in __gxx_personality_v0 () from /usr/lib64/libstdc++.so.6
No symbol table info available.
#6  0x00007f34933fece3 in ?? () from /lib64/libgcc_s.so.1
No symbol table info available.
#7  0x00007f34933feda8 in _Unwind_Resume () from /lib64/libgcc_s.so.1
No symbol table info available.
#8  0x0000000000405333 in qpid::client::AutoCancel::~AutoCancel ()
No locals.
#9  0x00007f3493c22369 in qpid::client::SubscriptionManagerImpl::get 
(this=0x823000, result=@0x7fff9c58d060, queue=@0x7fff9c58d070, 
    timeout=<value optimized out>) at 
qpid/client/SubscriptionManagerImpl.cpp:128
        lq = {<qpid::client::Handle<qpid::client::LocalQueueImpl>> = {impl = 
0x822ee0}, <No data fields>}
        unique = {static npos = 18446744073709551615, 
  _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = 
{<No data fields>}, <No data fields>}, 
    _M_p = 0x6104e8 "dbd23f8c-061e-41c1-bee5-a5712fbece52"}}
        sm = {<qpid::sys::Runnable> = {_vptr.Runnable = 0x7f3493ee0e50}, 
<qpid::client::Handle<qpid::client::SubscriptionManagerImpl>> = {impl = 
0x823000}, 
  static UNLIMITED = <optimized out>}
        ac = {sm = @0x7fff9c58cf70, tag = {static npos = 18446744073709551615, 
    _M_dataplus = {<std::allocator<char>> = {<__gnu_cxx::new_allocator<char>> = 
{<No data fields>}, <No data fields>}, 
      _M_p = 0x6104e8 "dbd23f8c-061e-41c1-bee5-a5712fbece52"}}}
#10 0x0000000000404c38 in main ()
No locals.

======= Bug description =======

get() method of subscriptionmanager class registers for the AutoCancel. During 
the Destruction of AutoCancel class object 
( goes out of scope due to the return of get() or other exception in get() ) if 
the connection to the qpid is lost or not available,
"qpid::TransportFailure" exception is being thrown somewhere from inside the 
SubscriptionManager::Cancel()

"  As the execption is not handled in the destructor and can not propagate 
beyond destructor ( Execption leak ), eventually leads to termination of the 
application "


" Handling of Exception in the application does not work in this case "


Just for the confirmation I tried to handle the exception in ~AutoCancel() and 
it worked , application was able to survive.

~AutoCancel() {

        try{

                sm->cancel()

        } catch ( qpid::TransportFailure& Ex) {

                std::cout<< " Inside ~AutoCancel() " <<Ex.what()<<std::endl;

        }

}

This was produced in the 0.6 version but by looking at the code of 0.16 I  
believe this problem is present the latest version also.


--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to