You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Stefan Doerfler (JIRA)" <qp...@incubator.apache.org> on 2010/02/15 10:33:27 UTC

[jira] Issue Comment Edited: (QPID-2395) fd leak in Connection

    [ https://issues.apache.org/jira/browse/QPID-2395?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12833701#action_12833701 ] 

Stefan Doerfler edited comment on QPID-2395 at 2/15/10 9:33 AM:
----------------------------------------------------------------

@Steve:

agreed, strictly speaking this is not RAII here ;)

But if copying of Connection objects is allowed (which I didnt consider it was) then you're absolutly right: closing the connection in dtor doesnt make any sense.

Another aspects I'd like to add to this discussion:

You're using a boost::shared_ptr<ConnectionImpl> to store the ConnectionImpl-Pointer. Why not associating the shared_ptr with the close() method on delete? This way you could copy the Connection object around and still be sure close() gets called on destruction of the last copy.

Another reason for using this is Exception Safety. You can be sure your Connection get closed even without usage of try-catch.


      was (Author: sdo):
    @Steve:

agreed, strictly speaking this is not RAII here ;)

But if copying of Connection objects is allowed (which I didnt consider it was) then you're absolutly right: closing the connection in dtor doesnt make any sense.

  
> fd leak in Connection
> ---------------------
>
>                 Key: QPID-2395
>                 URL: https://issues.apache.org/jira/browse/QPID-2395
>             Project: Qpid
>          Issue Type: Bug
>          Components: C++ Client
>    Affects Versions: 0.6
>         Environment: Linux dev-gmx001 2.6.31.8-GMX-CORE2_64 #1 SMP Tue Dec 15 10:21:34 CET 2009 x86_64 Intel(R) Xeon(R) CPU E5405 @ 2.00GHz GenuineIntel GNU/Linux
> Debian GNU/Linux 3.1
> gcc version 4.3.3 (Debian 4.3.3-13.1) 
>            Reporter: Daniel Etzold
>            Assignee: Steve Huston
>             Fix For: 0.7
>
>
> Hi,
> with the following code we are able to reproduce a fd leak:
> #include <qpid/client/Connection.h>
> int main(int argc, char** argv)
> {
>     while (1) {
>         qpid::client::Connection connection;
>         connection.open("localhost", 5672);
> //        connection.close();
>     }
> }
> When closing the connection explicitely as shown in the comment the fd leak no longer occurs. It seems that the destructor of Connection lacks closing the connection.
> Regards,
> Daniel

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
Apache Qpid - AMQP Messaging Implementation
Project:      http://qpid.apache.org
Use/Interact: mailto:dev-subscribe@qpid.apache.org