SOCI / soci

Official repository of the SOCI - The C++ Database Access Library
http://soci.sourceforge.net/
Boost Software License 1.0
1.37k stars 472 forks source link

Memory Leak when trying to connect to Microsoft SQL Server #1148

Open szelski opened 1 month ago

szelski commented 1 month ago

There is a memory leak, when soci continuously tries to connect to Microsoft SQL Server, that maybe does not even exist. It is unclear whether it also affects other database types.

Even if cleanup methods are called properly after each connection attempt.

Can you please check it?

vadz commented 1 month ago

Do you know what exactly is getting leaked? E.g. a report from ASAN or whichever tool you use?

Also, please try to provide the minimum way to reproduce the problem.

szelski commented 1 month ago

Do you know what exactly is getting leaked? E.g. a report from ASAN or whichever tool you use?

No particular Tool used. Just watched the Memory Allocation in the Task Manager over about 4 Days in multiple trial series. Till Process crashes.

Also, please try to provide the minimum way to reproduce the problem.

To reproduce:

// Call the "open" function from soci\src\core\session.cpp in your code, // The database one wants to connect to must not to exist, so that the connection attempt fails. try void session::open(connection_parameters const & parameters) catch (soci::odbc_soci_error const& e)

// Call the "close" function from soci\src\core\session.cpp to free the resources after the failed connection attempt.

void session::close()

catch (exception& ex)

// Call the "close" function from soci\src\core\session.cpp to free the resources after the failed connection attempt.

void session::close()

let the proces Run for Days (about 4) and watch how memory is allocated but not freed by the Process, till crash.

vadz commented 1 month ago

Sorry, but I won't be able able to run a process for 4 days to debug this. Please try to use any of the memory leak detection tools to gather more information to help fix this problem.