Skip to main content

VBC 5.2.1 - Server hangs on Solaris 9 when calling shutdown(1) through signal handler

  • February 16, 2013
  • 0 replies
  • 0 views

Problem:

  • Product Name: VisiBroker for C
  • Product Version: 5.2.1
  • Product Componet: Core ORB
  • Platform/OS Version: Solaris 9

VBC 5.2.1 - Server hangs on Solaris 9 when calling shutdown(1) through signal handler.

Same application running on Solaris 8 doesn't have this problem. 

Current function is signalHandler line 21 CORBA::ORB::shutdown( 1 ); Hanging stack looks like this:

(/opt/SUNWspro/bin/../WS6U2/bin/sparcv9/dbx) where 
current thread: t@1 
[1] __lwp_park(0x4, 0x0, 0x0, 0x1, 0xff108000, 0x0), at 0xff0f5e8c 
[2] cond_wait_queue(0x130790, 0xff108b48, 0x0, 0x0, 0xfe7f0000, 0xff108000), at 0xff0f3138 
[3] _cond_wait_cancel(0x130790, 0x130758, 0x1f, 0x0, 0x1152a0, 0x1152ac), at 0xff0f38f4 
[4] VISCondition::wait(0x130770, 0x130750, 0x1, 0x0, 0x130460, 0x13046c), at 0xff358464 
[5] VISProtocolManager::shutdown(0x12feb8, 0xfefee1d8, 0x1, 0x1, 0xff3b085c, 0xffbff18c), at 0xfeb528a8 
[ 6] VISORB::_shutdown_orb_functionality(0x800, 0x950, 0x6c00, 0x6cf8, 0x8400, 0x8474), at 0xfeac8ed4 
[7] VISIIOPORBFactory::shutdown_orbs(0xfeff1aec, 0xffbff224, 0x1f, 0xdc2a8, 0xdd768, 0xdd774), at 0xfeacf78c 
[ 8] VISORBFactory::shutdown_all_orbs(0xd9f78, 0xff000658, 0x1, 0xd52bc, 0xd4698, 0xd5fc0), at 0xfeb7a0d4 
[9] VISManager::cleanup(0x1155f0, 0x1, 0x0, 0x443f4, 0x0, 0x1), at 0xfeb79034
=>[10] signalHandler(signo = 2), line 21 in "hello_server.cc" 
[11] __sighndlr(0x2, 0x0, 0xffbff4c0, 0x25a68, 0x0, 0x0), at 0xff0f60a0 
[12] call_user_handler(0x2, 0x0, 0xffbff4c0, 0x0, 0x0, 0x0), at 0xff0efdd8 
[13] sigacthandler(0x2, 0x0, 0xffbff4c0, 0x1, 0xff108000, 0x0), at 0xff0eff88
 ---- called from signal handler with signal 2 (SIGINT) ------ 
[14] __lwp_park(0x4, 0x0, 0x0, 0x1, 0xff108000, 0x0), at 0xff0f5e8c 
[15] cond_wait_queue(0x130790, 0xff108b48, 0x0, 0x0, 0xfe7f0000, 0xff108000), at 0xff0f3138 
[16] _cond_wait_cancel(0x130790, 0x130758, 0xfe82421c, 0x2, 0x3c3c0, 0xd5c00), at 0xff0f38f4 
[17] VISCondition::wait(0x130770, 0x130750, 0x1, 0x8, 0x8, 0xd4638), at 0xff358464 
[18] VISProtocolManager::wait_for_shutdown(0x12feb8, 0x80b30, 0x8, 0xd52bc, 0xd4638, 0xd5f58), at 0xfeb52958 
[19] VISORB::run(0x113408, 0x2c9e8, 0xd3414, 0x443f4, 0x0, 0x1), at 0xfeacbf88 
[20] main(argc = 1, argv = 0xffbffb5c), line 92 in "hello_server.cc"

Resolution:

Please refer to the technical white paper provided by Oracle for Solaris, Multithreading in the Solaris(TM) Operating Environment, 2002. Specifically, the information provided under section "Threads and Signals Don't Mix" in chapter 2 talked about the issues of using "Async-Signal-Unsafe" functions in a multithreaded (MT) application. In sum, application bugs arise out of writing code that is either MT-Unsafe, Async-Signal-Unsafe, or both.

Therefore, calling VisiBroker ORB shutdown() in a user signal handler function is not appropriate as the routine may use systems library functions that are not "Async-Signal" safe. The wiki articles [[wiki: Signal handling in VisiBroker for C application (Part One)]] and [[wiki: Signal handling in VisiBroker for C application (Part Two)]] talked in details about the specific issues and how to go about implementing it correctly.


#Security
#VisiBroker