Discussion:
Deadlock - Mutex (_isa_cache)
Ricardo Cosme
2011-04-04 11:08:39 UTC
Permalink
Hi Karel,

I have a deadlock at line orb.cc:3093 when my ClientInterceptor::receive_exception()
calls a _narrow() for a second time. In this case, the first calling to _narrow() threw a
COMM_FAILURE.

Stacktrace:
(gdb) bt
#0 0x00007fff801f6322 in semaphore_wait_signal_trap ()
#1 0x00007fff801fb96d in pthread_mutex_lock ()
#2 0x000000010007913f in MICOMT::Mutex::lock (this=0x10200b500) at pthreads.h:172
#3 0x0000000100079166 in MICOMT::AutoLock::AutoLock (this=0x7fff5fbfc4a0, m=@0x10200b500) at os-thread.h:173
#4 0x000000010036311a in CORBA::ORB::is_a (this=0x10200b400, obj=0x10191f320, repo_id=0x1000a3f3e "IDL:scs/core/IComponent:1.0") at orb.cc:3093
#5 0x000000010034b3e4 in CORBA::Object::_is_a_remote (this=0x10191f320, repoid=0x1000a3f3e "IDL:scs/core/IComponent:1.0") at object.cc:462
#6 0x000000010005ff46 in scs::core::IComponent::_narrow (_obj=0x10191f320) at stubs/mico/scs.cc:1195
#7 0x000000010006d4be in openbus::Openbus::createProxyToIAccessControlService (this=0x101907610) at openbus.cpp:594
#8 0x000000010000ae17 in openbus::interceptors::ClientInterceptor::receive_exception (this=0x101919fd0, ri=0x10190f2a8) at openbus/interceptors/ClientInterceptor.cpp:158
#9 0x00000001004b5621 in PInterceptor::PI::_exec_client (ri=0x10190f2a8, m={__pfn = 0x41, __delta = 0}, ip=PInterceptor::END) at pi_impl.cc:1949
#10 0x00000001004b7b48 in PInterceptor::PI::_exec_receive_exception (ri=0x10190f2a8) at pi_impl.cc:2129
#11 0x00000001004b82a5 in PInterceptor::PI::_receive_exception_ip (cri=0x10190f030, reply_status=1, exception=0x10191e480, reply_scl=0x10190f000) at pi_impl.cc:2259
#12 0x000000010030aab2 in CORBA::Request::get_response (this=0x10190eae0, block=1 '\001') at dii.cc:931
#13 0x000000010030b61f in CORBA::Request::invoke (this=0x10190eae0) at dii.cc:778
#14 0x00000001003633c7 in CORBA::ORB::is_a (this=0x10200b400, obj=0x10190e720, repo_id=0x1000a3f3e "IDL:scs/core/IComponent:1.0") at orb.cc:3114
#15 0x000000010034b3e4 in CORBA::Object::_is_a_remote (this=0x10190e720, repoid=0x1000a3f3e "IDL:scs/core/IComponent:1.0") at object.cc:462
#16 0x000000010005ff46 in scs::core::IComponent::_narrow (_obj=0x10190e720) at stubs/mico/scs.cc:1195
#17 0x000000010006d4be in openbus::Openbus::createProxyToIAccessControlService (this=0x101907610) at openbus.cpp:594
#18 0x000000010006ea2c in openbus::Openbus::connect (this=0x101907610, entity=0x7fff5fbfe43d "HelloService", privateKeyFilename=0x7fff5fbfe470 "HelloService.key", ACSCertificateFilename=0x7fff5fbfe499 "AccessControlService.crt") at openbus.cpp:720
#19 0x0000000100003e25 in main (argc=17, argv=0x7fff5fbfe0a8) at server.cpp:91

Would it not be better to call _isa_cache.unlock() before calling req->invoke() at line orb.cc:3116 ?

I wrote a patch that solve this problem.

Thanks,
Ricardo
Karel Gardas
2011-06-02 20:34:32 UTC
Permalink
Hi Ricardo,

I've little bit changed your patch but otherwise kept its functionality
and merged it into my tree.

Thanks!
Karel
Post by Ricardo Cosme
Hi Karel,
I have a deadlock at line orb.cc:3093 when my ClientInterceptor::receive_exception()
calls a _narrow() for a second time. In this case, the first calling to _narrow() threw a
COMM_FAILURE.
(gdb) bt
#0 0x00007fff801f6322 in semaphore_wait_signal_trap ()
#1 0x00007fff801fb96d in pthread_mutex_lock ()
#2 0x000000010007913f in MICOMT::Mutex::lock (this=0x10200b500) at pthreads.h:172
#4 0x000000010036311a in CORBA::ORB::is_a (this=0x10200b400, obj=0x10191f320, repo_id=0x1000a3f3e "IDL:scs/core/IComponent:1.0") at orb.cc:3093
#5 0x000000010034b3e4 in CORBA::Object::_is_a_remote (this=0x10191f320, repoid=0x1000a3f3e "IDL:scs/core/IComponent:1.0") at object.cc:462
#6 0x000000010005ff46 in scs::core::IComponent::_narrow (_obj=0x10191f320) at stubs/mico/scs.cc:1195
#7 0x000000010006d4be in openbus::Openbus::createProxyToIAccessControlService (this=0x101907610) at openbus.cpp:594
#8 0x000000010000ae17 in openbus::interceptors::ClientInterceptor::receive_exception (this=0x101919fd0, ri=0x10190f2a8) at openbus/interceptors/ClientInterceptor.cpp:158
#9 0x00000001004b5621 in PInterceptor::PI::_exec_client (ri=0x10190f2a8, m={__pfn = 0x41, __delta = 0}, ip=PInterceptor::END) at pi_impl.cc:1949
#10 0x00000001004b7b48 in PInterceptor::PI::_exec_receive_exception (ri=0x10190f2a8) at pi_impl.cc:2129
#11 0x00000001004b82a5 in PInterceptor::PI::_receive_exception_ip (cri=0x10190f030, reply_status=1, exception=0x10191e480, reply_scl=0x10190f000) at pi_impl.cc:2259
#12 0x000000010030aab2 in CORBA::Request::get_response (this=0x10190eae0, block=1 '\001') at dii.cc:931
#13 0x000000010030b61f in CORBA::Request::invoke (this=0x10190eae0) at dii.cc:778
#14 0x00000001003633c7 in CORBA::ORB::is_a (this=0x10200b400, obj=0x10190e720, repo_id=0x1000a3f3e "IDL:scs/core/IComponent:1.0") at orb.cc:3114
#15 0x000000010034b3e4 in CORBA::Object::_is_a_remote (this=0x10190e720, repoid=0x1000a3f3e "IDL:scs/core/IComponent:1.0") at object.cc:462
#16 0x000000010005ff46 in scs::core::IComponent::_narrow (_obj=0x10190e720) at stubs/mico/scs.cc:1195
#17 0x000000010006d4be in openbus::Openbus::createProxyToIAccessControlService (this=0x101907610) at openbus.cpp:594
#18 0x000000010006ea2c in openbus::Openbus::connect (this=0x101907610, entity=0x7fff5fbfe43d "HelloService", privateKeyFilename=0x7fff5fbfe470 "HelloService.key", ACSCertificateFilename=0x7fff5fbfe499 "AccessControlService.crt") at openbus.cpp:720
#19 0x0000000100003e25 in main (argc=17, argv=0x7fff5fbfe0a8) at server.cpp:91
Would it not be better to call _isa_cache.unlock() before calling req->invoke() at line orb.cc:3116 ?
I wrote a patch that solve this problem.
Thanks,
Ricardo
--
Karel Gardas ***@objectsecurity.com
ObjectSecurity Ltd. http://www.objectsecurity.com
Loading...