[ 
https://issues.apache.org/activemq/browse/AMQCPP-58?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Albert Strasheim updated AMQCPP-58:
-----------------------------------

    Attachment: socketleak1.diff

Patch for leak that happens when createConnection fails due to broker being 
down.

This patch includes a type of fix for an issue that might also exist elsewhere 
in the code: BufferedSocket wasn't properly initializing its pointer fields to 
zero (and its other fields to useful default values), causing its destructor to 
crash when deleting it (after connect had failed).

The program I attached previously still seems to leak when reestablishing 
connections to the broker after it has been up and gone down. I just can't 
figure out how this leaks yet.

> Possible memory leak when reestablishing connection
> ---------------------------------------------------
>
>                 Key: AMQCPP-58
>                 URL: https://issues.apache.org/activemq/browse/AMQCPP-58
>             Project: ActiveMQ C++ Client
>          Issue Type: Bug
>    Affects Versions: 2.0
>            Reporter: Albert Strasheim
>         Assigned To: Nathan Mittler
>             Fix For: 2.0
>
>         Attachments: leaker.cpp, purify-example.txt, socketleak1.diff
>
>
> Brought over from AMQCPP-46.
> There seems to be a memory leak when running the example program from 
> AMQCPP-46 which reconnects whenever the broker goes down.
> Valgrind says:
> {noformat}
> ==15493== 149,520 (89,712 direct, 59,808 indirect) bytes in 1,869 blocks are 
> definitely lost in loss record 55 of 55
> ==15493==    at 0x4A19DE3: operator new(unsigned long) 
> (vg_replace_malloc.c:168)
> ==15493==    by 0x45DEDD: 
> activemq::network::SocketFactory::createSocket(activemq::util::Properties 
> const&) (SocketFactory.cpp:96)
> ==15493==    by 0x458D0C: 
> activemq::transport::TcpTransport::TcpTransport(activemq::util::Properties 
> const&, activemq::transport::Transport*, bool) (TcpTransport.cpp:42)
> ==15493==    by 0x42B3EE: 
> activemq::transport::TcpTransportFactory::createTransport(activemq::util::Properties
>  const&) (TcpTransportFactory.cpp:55)
> ==15493==    by 0x404CC0: 
> activemq::core::ActiveMQConnectionFactory::createConnection(std::string 
> const&, std::string const&, std::string const&) 
> (ActiveMQConnectionFactory.cpp:130)
> ==15493==    by 0x4042D5: 
> activemq::core::ActiveMQConnectionFactory::createConnection() 
> (ActiveMQConnectionFactory.cpp:69)
> ==15493==    by 0x403D67: main (main.cpp:30)
> {noformat}
> Purify also seems to indicate that there is a link, along with with possibly 
> spurious leaks or leaks that might be related to the leak reported by 
> Valgrind.

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

Reply via email to