[MDEV-25925] Warning: Memory not freed: 32 on INSERT DELAYED Created: 2021-06-15  Updated: 2022-08-27  Resolved: 2021-10-11

Status: Closed
Project: MariaDB Server
Component/s: Character Sets, Storage Engine - MyISAM
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6
Fix Version/s: 10.2.41, 10.3.32, 10.4.22, 10.5.13, 10.6.5, 10.7.1

Type: Bug Priority: Major
Reporter: Roel Van de Paar Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: memory_not_freed

Issue Links:
Relates
relates to MDEV-24436 INSERT DELAYED leaks memory in 10.5.8 Closed
relates to MDEV-24467 Memory not freed after failed INSERT ... Closed

 Description   

SET sql_mode='TRADITIONAL';
CREATE TABLE t (c BLOB) ENGINE=MyISAM;
INSERT DELAYED INTO t VALUES (''||'');
SHUTDOWN;

Leads to:

10.6.2 6c39eaeb126328e7813b146ecf652d51e4508981 (Debug)

2021-06-15 20:06:25 0 [Note] /test/MD120621-mariadb-10.6.2-linux-x86_64-dbg/bin/mysqld: Shutdown complete
 
Warning: Memory not freed: 32
Warning:   32 bytes lost at 0x154d240085a0, allocated by T@0 at sql/sql_string.cc:45, sql/field.cc:8603, sql/field.cc:7303, sql/item.cc:6707, sql/sql_type.cc:4345, sql/item.cc:6713, sql/sql_base.cc:8829, sql/sql_base.cc:8882
Memory lost: 32 bytes in 1 chunks
Warning:   32 bytes lost at 0x154d240085a0, allocated by T@0 at sql/sql_string.cc:45, sql/field.cc:8603, sql/field.cc:7303, sql/item.cc:6707, sql/sql_type.cc:4345, sql/item.cc:6713, sql/sql_base.cc:8829, sql/sql_base.cc:8882
Memory lost: 32 bytes in 1 chunks

Affects both debug and optimized builds, from 10.2 to 10.6.
Other versions have different amounts of memory not freed (all less than 32)



 Comments   
Comment by Alexander Barkov [ 2021-10-09 ]

If I put a new MTR test file delayed_blob.test with this content:

SET sql_mode='TRADITIONAL';
CREATE TABLE t1 (c BLOB) ENGINE=MyISAM;
--error ER_TRUNCATED_WRONG_VALUE
INSERT DELAYED INTO t1 VALUES (''||'');
DROP TABLE t1;

MTR produces the following output:

TEST                                      RESULT   TIME (ms) or COMMENT
--------------------------------------------------------------------------
 
worker[1] Using MTR_BUILD_THREAD 300, with reserved ports 16000..16019
SET sql_mode='TRADITIONAL';
CREATE TABLE t1 (c BLOB) ENGINE=MyISAM;
INSERT DELAYED INTO t1 VALUES (''||'');
ERROR 22007: Truncated incorrect DOUBLE value: ''
DROP TABLE t1;
main.delayed_blob                        [ pass ]     12
***Warnings generated in error logs during shutdown after running tests: main.delayed_blob
 
Warning: Memory not freed: 24
Warning:   24 bytes lost at 0x7fd3f808cf40, allocated by T@0 at 0x7b0c1a, 0x627ceb, 0x7b0e88, 0x94a0f1, 0x9879e8, 0x6983dd, 0x698557, 0x6d5eab
Warning:   24 bytes lost at 0x7fd3f808cf40, allocated by T@0 at 0x7b0c1a, 0x627ceb, 0x7b0e88, 0x94a0f1, 0x9879e8, 0x6983dd, 0x698557, 0x6d5eab
 
--------------------------------------------------------------------------

Comment by Elena Stepanova [ 2021-10-09 ]

bar, if you fix this one, you'll likely also fix MDEV-24467 and MDEV-24436. Please close them then.

Comment by Alexander Barkov [ 2021-10-09 ]

elenst, thanks for telling me.
MDEV-24467 is for sure the same problem with MDEV-25925.

As for MDEV-24436, it is probably the same problem too, but we can't be sure. What do you suggest?

Comment by Alexander Barkov [ 2021-10-09 ]

sanja, can you please review a patch:
https://github.com/MariaDB/server/commit/43e2009a7a20f1d473a29fa389fb3121d73cd2f7

Thanks.

Comment by Elena Stepanova [ 2021-10-09 ]

As for MDEV-24436, it is probably the same problem too, but we can't be sure. What do you suggest?

If we are reasonably sure, we would usually close it with a comment that it was most likely fixed in the scope of the other bug (with the link), and with a suggestion to the reporter to comment if after upgrade to the patched version the fix doesn't help. If it happens, we re-open the bug report, which is fine in this case because there would be no commit for that JIRA issue in the git history, thus no confusion.

If we are not certain at all and just think the patch may help, we would comment in the report saying there is a potential fix in version 10.x.y, so we recommend to upgrade and see if the problem goes away. And set need_feedback label. Then after a while, if we get no information, we'll close it either as fixed or as incomplete.

Please feel free to choose whichever you like better, both are fairly common.

Comment by Oleksandr Byelkin [ 2021-10-11 ]

OK to push after adding a few words in commit message about the bug (you can even copy your comment)

Generated at Thu Feb 08 09:41:26 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.