[MDEV-9997] CONNECT: memory leak after connect.alter connect.ini_grant Created: 2016-04-26 Updated: 2016-05-13 Resolved: 2016-05-13 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Storage Engine - Connect |
| Affects Version/s: | 10.0, 10.1, 10.2 |
| Fix Version/s: | 10.0.26, 10.1.15 |
| Type: | Bug | Priority: | Major |
| Reporter: | Sergey Vojtovich | Assignee: | Olivier Bertrand |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | foundation | ||
| Issue Links: |
|
||||||||
| Description |
|
This is failing since quite a while in buildbot: http://buildbot.askmonty.org/buildbot/builders/work-amd64-valgrind/builds/8698/steps/test/logs/stdio (look for PROFILE_Open). This memory leak is easily reproducible:
Even simpler test basing on previous two:
Valgrind warnings:
This happens likely due to fact that MRUProfile is never freed:
But memory leak is in no way good workaround for SIGSEGV. |
| Comments |
| Comment by Olivier Bertrand [ 2016-04-26 ] | |||||||||||||||||||||
|
Do you mean that restoring the call to PROFILE_END() solve the problem? | |||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2016-04-27 ] | |||||||||||||||||||||
|
I didn't try. But FWICS PROFILE_End() is the only function that frees MRUProfile. I can try if you like. | |||||||||||||||||||||
| Comment by Olivier Bertrand [ 2016-04-27 ] | |||||||||||||||||||||
|
Yes please. As a matter of fact, I don't know what MRUProfile is and how it is connected to these CONNECT tests. Besides, what make you think that it is the item that is not freed? Note that because the connect_done_func is only called when the system is shutting down, this memory leak may not be really important. This once more demonstrates the stupidity of these signal raised by some ASSERT MariaDB is full of. ASSERTs, according to all programming experts, is a bad habit that in fact hides the errors, lazily avoid to seach for the cause of them, and prevents to fix them or at least to produce an explicite error message. | |||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2016-04-27 ] | |||||||||||||||||||||
|
I confirm that uncommenting PROFILE_End() in connect_done_func() solves the problem. However I had to also comment out "CurProfile = MRUProfile[i];" and "PROFILE_ReleaseFile();" in PROFILE_End() to make it work properly. Besides, what make you think that it is the item that is not freed? Note that because the connect_done_func is only called when the system is shutting down, this memory leak may not be really important. This once more demonstrates the stupidity of these signal raised by some ASSERT MariaDB is full of. ASSERTs, according to all programming experts, is a bad habit that in fact hides the errors The point of asserts in MariaDB is not "hidding errors" or "avoiding to search for them". Asserts issue additional checks in debug builds, which for performance reason are not issued in release builds. | |||||||||||||||||||||
| Comment by Olivier Bertrand [ 2016-04-27 ] | |||||||||||||||||||||
|
Good and thank you. I shall do this and hopefully fix this bug. inihandl.c: As a matter of fact, this code is meant to emulate Windows functions not existing on Unix/Linux. It was imported ten years ago in a previous program of mine and I don't know who wrote it. I have never tried to understand in detail what it does, working almost only on Windows. Signal was the reason why I commented out this line but apparently this did not happen when you restored the previous version so the reason why it raised a signal has probably been fixed (perhaps by your commenting out these two lines) Perhaps this stuff could be just removed on Linux distributions. About assertion see for example https://www.softwariness.com/articles/assertions-in-cpp/ | |||||||||||||||||||||
| Comment by Sergey Vojtovich [ 2016-04-28 ] | |||||||||||||||||||||
|
Thanks for accepting it. Please also note that MRUProfile[0] can be NULL and other array elements can be uninitialized in PROFILE_End(). The change should look something like this:
| |||||||||||||||||||||
| Comment by Olivier Bertrand [ 2016-05-13 ] | |||||||||||||||||||||
|
Thanks to Sergey Vojtovich |