[MDEV-24900] "select 'a' 'b';" causes a leak. Created: 2021-02-17 Updated: 2021-02-18 Resolved: 2021-02-17 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | Server |
| Affects Version/s: | 10.4.17 |
| Fix Version/s: | N/A |
| Type: | Bug | Priority: | Major |
| Reporter: | Johan Wikman | Assignee: | Sergei Golubchik |
| Resolution: | Cannot Reproduce | Votes: | 0 |
| Labels: | None | ||
| Environment: |
Ubuntu 18.04 |
||
| Description |
|
I'm using the embedded library. Parsing the statement
causes the following report by ASAN.
|
| Comments |
| Comment by Sergei Golubchik [ 2021-02-17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
I cannot repeat it, the memory is freed at
| ||||||||||||||||||||||||||||||||||||||||||
| Comment by Johan Wikman [ 2021-02-17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
It appears that there was no call to THD:::cleanup_after_query before the thd was destroyed. When that was added, ASAN stopped complaining. Strangely, although we parse thousands of statements from the server test-suite, when comparing that the sqlite-based classifier classifies a statement the same way as the libmysqlembedded one does, this was the only case where the missing cleanup_after_query call caused a leak. | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Sergei Golubchik [ 2021-02-17 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Here it is in 10.4.17: https://github.com/MariaDB/server/blob/mariadb-10.4.17/sql/sql_parse.cc#L7962 | ||||||||||||||||||||||||||||||||||||||||||
| Comment by Johan Wikman [ 2021-02-18 ] | ||||||||||||||||||||||||||||||||||||||||||
|
Yes, I phrased myself poorly. Ours is very old code and for whatever reason that mysql_parse() function is not used as such, but instead a homegrown rough equivalent. And there was no call to cleanup_after_query in that. The fact that ASAN complained about just 1 out of thousands of statements led me astray. Sorry for the confusion. |