You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Olivier Langlois <Ol...@streamtheworld.com> on 2009/12/10 22:25:29 UTC

OpenWireConnector in 3.0?

Hi,

I just found brittle code in version 2.2.6 and I do not know if this version is still maintained or if this code is still present in 3.0. Here is the problem and tell me if it is still relevant:

In OpenWireConnector::createSession()

If an exception is thrown from syncRequest(),

The destructor of OpenWireSessionInfo will be called while the stack is unrolled. In that destructor,

BaseConnectorResource::close() throw ( cms::CMSException ) is called.

which will call

void OpenWireConnector::disposeOf(
    commands::DataStructure* objectId ) throw ( ConnectorException )

which will call oneway().

The thing is that it is very unlikely that oneway() will succeed if syncRequest() fail and this will abort the program since this is what happens when an exception slips out of a destructor while the stack is unrolling because of an exception.

I would propose to not let exception slip out of the destructor:

        virtual ~OpenWireSessionInfo() {
            try
            {
                this->close();
            }
            catch(...) { /*absorb*/ }
            delete sessionInfo;
        }

But I cannot find this code in 3.0. Has it been removed?

Thanks,
Olivier Langlois
C++ Technical Lead

STREAMTHEWORLD

t. 1 866 448 4037 ext. 675
t. 1 514 448 4037 ext. 675
f. 1 514 807 1861

olivier.langlois@streamtheworld.com
streamtheworld.com
 
StreamTheWorld launches its new BlackBerry application. Learn more


Re: OpenWireConnector in 3.0?

Posted by Timothy Bish <ta...@gmail.com>.
On Thu, 2009-12-10 at 16:25 -0500, Olivier Langlois wrote:
> Hi,
> 
> I just found brittle code in version 2.2.6 and I do not know if this version is still maintained or if this code is still present in 3.0. Here is the problem and tell me if it is still relevant:
> 
> In OpenWireConnector::createSession()
> 
> If an exception is thrown from syncRequest(),
> 
> The destructor of OpenWireSessionInfo will be called while the stack is unrolled. In that destructor,
> 
> BaseConnectorResource::close() throw ( cms::CMSException ) is called.
> 
> which will call
> 
> void OpenWireConnector::disposeOf(
>     commands::DataStructure* objectId ) throw ( ConnectorException )
> 
> which will call oneway().
> 
> The thing is that it is very unlikely that oneway() will succeed if syncRequest() fail and this will abort the program since this is what happens when an exception slips out of a destructor while the stack is unrolling because of an exception.
> 
> I would propose to not let exception slip out of the destructor:
> 
>         virtual ~OpenWireSessionInfo() {
>             try
>             {
>                 this->close();
>             }
>             catch(...) { /*absorb*/ }
>             delete sessionInfo;
>         }
> 
> But I cannot find this code in 3.0. Has it been removed?

A majority of the code was rewritten for 3.0, that particular code is
long gone.  The 2.2.x line isn't maintained anymore and no future
releases of 2.2.x are planned.

Regards
Tim.

> 
> Thanks,
> Olivier Langlois
> C++ Technical Lead
> 
> STREAMTHEWORLD
> 
> t. 1 866 448 4037 ext. 675
> t. 1 514 448 4037 ext. 675
> f. 1 514 807 1861
> 
> olivier.langlois@streamtheworld.com
> streamtheworld.com
>  
> StreamTheWorld launches its new BlackBerry application. Learn more
> 
-- 
Tim Bish
http://fusesource.com
http://timbish.blogspot.com/