maria-developers team mailing list archive
-
maria-developers team
-
Mailing list archive
-
Message #09873
Freeing options & wrappers.
Hi!
(sorry I forgot mailing list so resending the e-mail)
So it is about
https://jira.mariadb.org/browse/MDEV-10559
Original problem was that database drivers in Python & Perl (probably
other) do not call mysql_close for MYSQL object if there was no
connection happing (memory leak).
MySQL has solution for this - freeing option on failed connection if
user did not asked something else (we even has the same flag, but it did
not work). So I took MySQL solution.
But it appeared not so compatible with our async wrappers. Frankly
speaking the code is difficult to read and debug because everything made
over macros nor I have found decent description/overview of how it is
done (thank you if somebody point to it) so I can not say that
understand what it is doing, and all my suggestion based on how I
understood it.
So what we have: we allocate memory for some options set between
mysql_init and mysql_real_connect, instead of "reall connect" called
some wrapper which store some pointers to the options then call
mysql_real_connect and if "real_connect" free them it fail on exit.
I think that best solution is that wrapper
1) store current state of CLIENT_REMEMBER_OPTIONS
2) set the flag
3) call mysql_real_connect
4) if connect fail and there was not "remember options" then wrapper
free options by itself
Again, I am not 100% sure that it is possible nor really know the place
were this should be added (if idea above ok, I probably find ho to make it).
Follow ups