Lucas Guilherme Hübner created QPID-8246:
--------------------------------------------

             Summary: File leak in heartbeat algorithm
                 Key: QPID-8246
                 URL: https://issues.apache.org/jira/browse/QPID-8246
             Project: Qpid
          Issue Type: Bug
          Components: C++ Client
    Affects Versions: qpid-cpp-1.38.0
         Environment: SO: Debian GNU/Linux 9 (stretch)

 
            Reporter: Lucas Guilherme Hübner
         Attachments: client.c, valgrind-output.log

The heartbeat option is causing file leak when the interface is down or the 
address is unreachable.

I've programmed a little test client to reproduce the error, this client source 
is on the attachments, to check the opened files of the process i've used the 
following bash script:
{code:java}
while :; do lsof -u root | grep $(pgrep -f ./client) | wc -l; sleep 1; 
done{code}
The client if compiled with the following syntax:
{code:java}
g++ client.c -o client -lqpidmessaging -lqpidtypes -lpthread{code}
Valgrind command was called with the following parameters:

 
{code:java}
valgrind --tool=memcheck --track-fds=yes --leak-check=full --read-var-info=yes 
--show-reachable=yes --track-origins=yes ./client > valgrind-output.log 2>&1
{code}
The valgrind is initialized with the interface up and working, after some time, 
the interface is disabled and the leak  begin.

If the application runs for long time, this file leak turns into a crash on the 
program, due to the linux max open files, even if the connection still comes 
back the files continue opened.

Resumed valgrind output for this issue:

*==26937== FILE DESCRIPTORS: 17 open at exit.*
==26937== Open AF_INET socket 16: <unbound> <-> unbound
==26937== at 0x4C19001: socket (socket.c:32)
==26937== by 0x4EEA04F: 
qpid::sys::BSDSocket::createSocket(qpid::sys::SocketAddress const&) const (in 
/usr/local/lib/libqpidcommon.so.2.0.0)
==26937== by 0x4EEA521: qpid::sys::BSDSocket::connect(qpid::sys::SocketAddress 
const&) const (in /usr/local/lib/libqpidcommon.so.2.0.0)
==26937== by 0x4ECC233: 
qpid::sys::posix::AsynchConnector::AsynchConnector(qpid::sys::Socket const&, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > 
const&, std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> > const&, boost::function1<void, qpid::sys::Socket 
const&>, boost::function3<void, qpid::sys::Socket const&, int, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > 
const&>) (in /usr/local/lib/libqpidcommon.so.2.0.0)
==26937== by 0x4ECC8D7: qpid::sys::AsynchConnector::create(qpid::sys::Socket 
const&, std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> > const&, std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&, boost::function1<void, 
qpid::sys::Socket const&>, boost::function3<void, qpid::sys::Socket const&, 
int, std::__cxx11::basic_string<char, std::char_traits<char>, 
std::allocator<char> > const&>) (in /usr/local/lib/libqpidcommon.so.2.0.0)
==26937== by 0x4D7FF74: 
qpid::client::TCPConnector::connect(std::__cxx11::basic_string<char, 
std::char_traits<char>, std::allocator<char> > const&, 
std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > 
const&) (in /usr/local/lib/libqpidclient.so.2.0.0)
==26937== by 0x4D37C06: qpid::client::ConnectionImpl::open() (in 
/usr/local/lib/libqpidclient.so.2.0.0)
==26937== by 0x4D272CF: 
qpid::client::Connection::open(qpid::client::ConnectionSettings const&) (in 
/usr/local/lib/libqpidclient.so.2.0.0)
==26937== by 0x4D27DF0: qpid::client::Connection::open(qpid::Url const&, 
qpid::client::ConnectionSettings const&) (in 
/usr/local/lib/libqpidclient.so.2.0.0)
==26937== by 0x48898F6: qpid::client::amqp0_10::ConnectionImpl::tryConnect() 
(in /usr/local/lib/libqpidmessaging.so.2.0.0)
==26937== by 0x488B468: 
qpid::client::amqp0_10::ConnectionImpl::connect(qpid::sys::AbsTime const&) (in 
/usr/local/lib/libqpidmessaging.so.2.0.0)
==26937== by 0x488D137: qpid::client::amqp0_10::ConnectionImpl::open() (in 
/usr/local/lib/libqpidmessaging.so.2.0.0)
==26937==



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to