Quantcast
Channel:
Viewing all articles
Browse latest Browse all 44030

Wiki Page: Encountered core dump on bank_agent example's Server when catching an exception

$
0
0
Problem: Product : VisiBroker 7.0 Platform : Unix and Linux Unable to catch thrown exception from POA- activate_object_with_id() and encountered a segmentation fault.  void CorbaManager::restart()  {      int nms_funcnumber=fncRESTART;      try {          NMSLog_traceLine( [DBG],nms_funcnumber);          myPOA- activate_object_with_id(managerId, pCmdReceiver );          NMSLog_traceLine( [DBG],nms_funcnumber);      } catch (const CORBA::Exception& e) {          NMSLog_traceLine( [DBG],nms_funcnumber); - Segmentation Fault here      } ... The exception was thrown when managerId already existed in active map when calling activate_object_with_id(). The customer also confirmed that the same problem occur on modified bank_agent's Server: Server.C:  try{ ...     // Activate the servant with the ID on myPOA     myPOA- activate_object_with_id(managerId, &managerServant);     // Duplicate above to throw PortableServer_POA::ServantAlreadyActive exception     myPOA- activate_object_with_id(managerId, &managerServant); ...   catch(const CORBA::Exception& e) {     cerr e endl; - Segmentation Fault here     return 1;   } Resolution: The segmentation fault is caused by a VisiBroker function _deactivate_object(), which tried to retrieve object reference which is out of scope in catch{} clause. To workaround: 1. Use try - catch block as below: ...     try {     // Activate the servant with the ID on myPOA     myPOA- activate_object_with_id(managerId, &managerServant);     // Duplicate above to throw PortableServer_POA::ServantAlreadyActive exception     myPOA- activate_object_with_id(managerId, &managerServant);     }     catch(PortableServer_POA::ServantAlreadyActive& e) {      cerr "Servant Already Active..." endl;     } ... 2. Change managerServant's scope to accessible from catch clause. In the customer's code, the root cause is pCmdReceiver has been out of scope in the catch clause.

Viewing all articles
Browse latest Browse all 44030

Trending Articles