• [tao-users] Singleton CORBA object

    From Siddharth Kulkarni@21:1/5 to All on Tue Sep 29 15:22:20 2015
    --001a11426c2019d92d0520dfc5de
    Content-Type: text/plain; charset=UTF-8

    Hi All,
    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.

    Thanks & Regards
    Siddharth

    --001a11426c2019d92d0520dfc5de
    Content-Type: text/html; charset=UTF-8
    Content-Transfer-Encoding: quoted-printable

    <div dir="ltr">Hi All,<div>I am using ACE/TAO and having a general question regarding CORBA.</div><div>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.</div><div>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.</div><div>Can anybody suggest whether the given strategy is
    wrong? Then what is the correct strategy in this scenario.</div><div><br></div><div>Thanks &amp; Regards</div><div>Siddharth</div></div>

    --001a11426c2019d92d0520dfc5de--

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Fromme@21:1/5 to Siddharth Kulkarni on Tue Sep 29 12:28:52 2015
    Copy: tao-users@list.isis.vanderbilt.edu

    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

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Christian Fromme@21:1/5 to Siddharth Kulkarni on Wed Sep 30 09:34:57 2015
    Copy: tao-users@list.isis.vanderbilt.edu

    On 29.09. 16:31, Siddharth Kulkarni wrote:
    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();

    Hmm.. Maybe the _remove_ref() call causes the problem?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Douglas C. Schmidt@21:1/5 to Siddharth Kulkarni on Tue Sep 29 06:36:35 2015
    To: tao-users@list.isis.vanderbilt.edu

    Hi Siddharth,

    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.

    To ensure that we have proper version/platform/compiler information,
    please make sure you fill out the appropriate problem report form (PRF),
    which is in

    $ACE_ROOT/PROBLEM-REPORT-FORM
    $TAO_ROOT/PROBLEM-REPORT-FORM

    or in

    $ACE_ROOT/BUG-REPORT-FORM
    $TAO_ROOT/BUG-REPORT-FORM

    in older versions of ACE, TAO, CIAO, and DAnCE. Make sure to include
    this information when asking any questions since otherwise we have to
    "guess" what version/platform/compiler/options you've using, which is
    very error-prone and slows down our responsiveness. If you don't use
    the PRF, therefore, it is less likely that someone from the core
    developer team will be able to answer your question. Naturally, we
    encourage and appreciate other members of the ACE, TAO, CIAO, and
    DAnCE user community who can respond to questions that they have the
    answers to.

    Please note, moreover, that the DOC group at Vanderbilt University
    only provides "best effort" support for non-sponsors who are using the
    latest release, as described in

    http://www.dre.vanderbilt.edu/~schmidt/DOC_ROOT/ACE/docs/ACE-bug-process.html

    Therefore, please make sure you are using ACE+TAO+CIAO+DAnCE x.3.3
    (i.e., ACE 6.3.3, TAO 2.3.3, CIAO 1.3.3, and DAnCE 1.3.3), which you
    can download from

    http://download.dre.vanderbilt.edu

    If you need more "predictable" help or need help for earlier versions
    of ACE+TAO+CIAO+DAnCE please see

    http://www.dre.vanderbilt.edu/support.html

    for a list of companies that will provide you with ACE+TAO+CIAO+DAnCE commercial support.

    Thanks,

    Doug

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Siddharth Kulkarni@21:1/5 to Christian Fromme on Tue Sep 29 16:31:21 2015
    Copy: tao-users@list.isis.vanderbilt.edu

    --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 <christian@ast.dfs.de>
    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&lt;Servant&gt;   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-&gt;activate_object(m_pServant.in());
    // ref count=2</div><div><span style="white-space:pre">  </span>CORBA::Object_ptr retobj = m_poa-&gt;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-&gt;_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&lt;typename S_ptr,</div><div>         typename S_var,</div><div>         class Insert_Policy&gt;</
    <div>CORBA::Boolean</div><div>TAO::Ret_Object_SArgument_T&lt;S_ptr,S_var,Insert_Policy&gt;::marshal (TAO_OutputCDR &amp;cdr)</div><div>{</div><div>  return cdr &lt;&lt; this-&gt;x_.in ();</div><div>}</div></div><div><br></div><div>Thanks &amp;
    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">&lt;<a href="mailto:christian@ast.dfs.de" target="_blank">christian@ast.dfs.de</a>&gt;</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>
    &gt; I am using ACE/TAO and having a general question regarding CORBA.<br>
    &gt; I am facing the scenario where the CORBA server need to return same CORBA<br>
    &gt; object again and again. I am facing server crash while returning the object<br>
    &gt; after two to three times.<br>
    &gt; I am creating and activating the object once and keep in memory. Then upon<br>
    &gt; client request returning the same object. Hence it is kind of singleton<br>
    &gt; object.<br>
    &gt; Can anybody suggest whether the given strategy is wrong? Then what is the<br>
    &gt; 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)
  • From Siddharth Kulkarni@21:1/5 to Christian Fromme on Wed Sep 30 09:02:37 2015
    Copy: tao-users@list.isis.vanderbilt.edu

    --001a11434a3ab32e260520f33168
    Content-Type: text/plain; charset=UTF-8

    No. Tried with commenting remove_ref but it didn't help. Finally sending duplicated reference works.
    Thanks & Regards
    Siddharth

    On Wed, Sep 30, 2015, 13:04 Christian Fromme <christian@ast.dfs.de> wrote:

    On 29.09. 16:31, Siddharth Kulkarni wrote:
    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();

    Hmm.. Maybe the _remove_ref() call causes the problem?


    --001a11434a3ab32e260520f33168
    Content-Type: text/html; charset=UTF-8
    Content-Transfer-Encoding: quoted-printable

    <p dir="ltr">No. Tried with commenting remove_ref but it didn&#39;t help. Finally sending duplicated reference works.<br>
    Thanks &amp; Regards <br>
    Siddharth</p>
    <br><div class="gmail_quote"><div dir="ltr">On Wed, Sep 30, 2015, 13:04 Christian Fromme &lt;<a href="mailto:christian@ast.dfs.de">christian@ast.dfs.de</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc
    solid;padding-left:1ex">On 29.09. 16:31, Siddharth Kulkarni wrote:<br>
    &gt;   if(m_pServant== nullptr)<br>
    &gt;   {<br>
    &gt;       m_pServant= create_servant();<br>
    &gt;       PortableServer::ObjectId *oid =<br>
    &gt; m_poa-&gt;activate_object(m_pServant.in()); // ref count=2<br>
    &gt;   CORBA::Object_ptr retobj = m_poa-&gt;id_to_reference(*oid);<br>
    &gt; m_XSvc= ::XService::_narrow(retobj);<br>
    &gt;   m_pServant-&gt;_remove_ref();<br>

    Hmm.. Maybe the _remove_ref() call causes the problem?<br>
    </blockquote></div>

    --001a11434a3ab32e260520f33168--

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)