Copy:
[email protected]
--001a113dc4f2eed96a0520e0bb6b
Content-Type: text/plain; charset=UTF-8
Hi!
Following is the psuedo code
//MainCORBAImpl.h
class CMainCORBAImpl
{
public:
XServicePtr GetXService();
private:
XServicePtr m_XSvc;
PortableServer::servant_var<Servant> m_pServant;
};
//MainCORBAImpl.cpp
XServicePtr CMainCORBAImpl::GetXService()
{
try
{
if(m_pServant== nullptr)
{
m_pServant= create_servant();
PortableServer::ObjectId *oid =
m_poa->activate_object(m_pServant.in()); // ref count=2
CORBA::Object_ptr retobj = m_poa->id_to_reference(*oid);
m_XSvc= ::XService::_narrow(retobj);
m_pServant->_remove_ref();
if (::CORBA::is_nil(m_XSvc))
{
//throw exception
}
}
}
catch(...)
{
//throw exception
}
return m_XSvc;
}
The multiple calls to GetXService() is causing crash. The debugger points
to the following CORBA skeleton code
template<typename S_ptr,
typename S_var,
class Insert_Policy>
CORBA::Boolean
TAO::Ret_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::marshal
(TAO_OutputCDR &cdr)
{
return cdr << this->x_.in ();
}
Thanks & Regards
Siddharth
On Tue, Sep 29, 2015 at 3:58 PM, Christian Fromme <
[email protected]>
wrote:
On 29.09. 15:22, Siddharth Kulkarni wrote:
I am using ACE/TAO and having a general question regarding CORBA.
I am facing the scenario where the CORBA server need to return same CORBA object again and again. I am facing server crash while returning the
object
after two to three times.
I am creating and activating the object once and keep in memory. Then
upon
client request returning the same object. Hence it is kind of singleton object.
Can anybody suggest whether the given strategy is wrong? Then what is the correct strategy in this scenario.
How exactly are you returning the object? (IDL and implementation code)
Best,
Christian
--001a113dc4f2eed96a0520e0bb6b
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable
<div dir="ltr"><div>Hi!</div><div>Following is the psuedo code</div><div><br></div>//MainCORBAImpl.h<div>class CMainCORBAImpl</div><div>{</div><div> public:</div><div> XServicePtr GetXService();</div><div><br></div><div> private:
</div><div> XServicePtr m_XSvc;</div><div> PortableServer::servant_var<Servant> m_pServant;</div><div>};</div><div><br></div><div><br></div><div>//MainCORBAImpl.cpp</div><div><br></div><div>XServicePtr CMainCORBAImpl::
GetXService()</div><div>{</div><div> try </div><div> {</div><div> if(m_pServant== nullptr)</div><div> {</div><div> m_pServant= create_servant();</div><div> PortableServer::ObjectId *oid = m_poa->activate_object(m_pServant.in());
// ref count=2</div><div><span style="white-space:pre"> </span>CORBA::Object_ptr retobj = m_poa->id_to_reference(*oid);</div><div><span class="" style="white-space:pre"> </span>m_XSvc= ::XService::_narrow(retobj);</div><div><span style="
white-space:pre"> </span>m_pServant->_remove_ref();</div><div><br></div><div><span class="" style="white-space:pre"> </span>if (::CORBA::is_nil(m_XSvc))</div><div><span class="" style="white-space:pre"> </span>{</div><div> �
� //throw exception</div><div> }</div><div> }</div><div> } </div><div> catch(...)</div><div> {</div><div> //throw exception</div><div> }</div><div> return m_XSvc; </div><div>}</div><div><br></div><div>The
multiple calls to GetXService() is causing crash. The debugger points to the following CORBA skeleton code</div><div><br></div><div><div>template<typename S_ptr,</div><div> typename S_var,</div><div> class Insert_Policy></
<div>CORBA::Boolean</div><div>TAO::Ret_Object_SArgument_T<S_ptr,S_var,Insert_Policy>::marshal (TAO_OutputCDR &cdr)</div><div>{</div><div> return cdr << this->x_.in ();</div><div>}</div></div><div><br></div><div>Thanks &
Regards</div><div>Siddharth</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 29, 2015 at 3:58 PM, Christian Fromme <span dir="ltr"><<a href="mailto:
[email protected]" target="_blank">
[email protected]</a>></span>
wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 29.09. 15:22, Siddharth Kulkarni wrote:<br>
> I am using ACE/TAO and having a general question regarding CORBA.<br>
> I am facing the scenario where the CORBA server need to return same CORBA<br>
> object again and again. I am facing server crash while returning the object<br>
> after two to three times.<br>
> I am creating and activating the object once and keep in memory. Then upon<br>
> client request returning the same object. Hence it is kind of singleton<br>
> object.<br>
> Can anybody suggest whether the given strategy is wrong? Then what is the<br>
> correct strategy in this scenario.<br>
</span>How exactly are you returning the object? (IDL and implementation code)<br>
Best,<br>
Christian<br>
</blockquote></div><br></div>
--001a113dc4f2eed96a0520e0bb6b--
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)