[MDEV-25582] mysqlslap looses memory when started with non-existing socket Created: 2021-05-03  Updated: 2023-04-27

Status: Confirmed
Project: MariaDB Server
Component/s: Scripts & Clients
Affects Version/s: 10.2, 10.3, 10.4, 10.5, 10.6, 10.7, 10.8
Fix Version/s: 10.4, 10.5, 10.6

Type: Bug Priority: Trivial
Reporter: Roel Van de Paar Assignee: Oleksandr Byelkin
Resolution: Unresolved Votes: 0
Labels: Memory_leak, mysqlslap


 Description   

10.5.10 b0ef1e45d453b210e6480758aea348ebc13606b9 (Optimized)

$ ./bin/mysqlslap -S/test/non_existing/socket.sock -u root --create-schema='test' --query='SELECT 1' --concurrency=2 --iterations=10
./bin/mysqlslap: Error when connecting to server: Can't connect to local MySQL server through socket '/test/non_existing/socket.sock' (2)
Warning:   40 bytes lost at 0x56366b385150, allocated by T@0 at 0x56366a172cfd, 0x56366a14223a, 0x56366a143f57, csu/libc-start.c:342, 0x56366a140a0e
Warning:   72 bytes lost at 0x56366b385080, allocated by T@0 at 0x56366a14218e, 0x56366a143f57, csu/libc-start.c:342, 0x56366a140a0e
Warning:   32 bytes lost at 0x56366b384fe0, allocated by T@0 at 0x56366a1422b0, 0x56366a1430ae, csu/libc-start.c:342, 0x56366a140a0e
Memory lost: 144 bytes in 3 chunks



 Comments   
Comment by Marko Mäkelä [ 2022-01-14 ]

I find it very hard to believe that thiru’s change to add some instrumentation would cause any additional memory leaks.

Comment by Marko Mäkelä [ 2022-01-14 ]

Roel, can you provide more information for this memory leak? For which program is it being reported? Can you show the full AddressSanitizer output?

Comment by Marko Mäkelä [ 2022-01-14 ]

The output actually looks like it is from safe_malloc and not AddressSanitizer. In any case, the indicated change does not add any heap memory allocation and should thus be unrelated to the memory leak.

Comment by Roel Van de Paar [ 2022-01-14 ]

The issue with mysqlslap now appears in current trees also (only on debug builds, not on optimized). No need to start any server, just execute the mysqlslap binary with a non-existing socket. Older versions up to 10.4 give different memory amounts lost. ASAN not needed for debug, though likely reproducible on optimized ASAN builds too. Issue seemed to appear originally only in that tree.

10.2.42 d7f4fd30f2ec9f2851e434d1922e2e382e6b8c92 (Debug)

/test/MD150122-mariadb-10.2.42-linux-x86_64-dbg$ ./bin/mysqlslap -S/test/non_existing/socket.sock -u root --create-schema='test' --query='SELECT 1' --concurrency=2 --iterations=10
./bin/mysqlslap: Error when connecting to server: Can't connect to local MySQL server through socket '/test/non_existing/socket.sock' (2)
Warning:   16 bytes lost at 0x55989993b090, allocated by T@0 at 0x559897a3c005, mysys/my_malloc.c:252, client/mysqlslap.c:2150, csu/libc-start.c:342, 0x559897a0ba2e
Warning:   48 bytes lost at 0x55989993afe0, allocated by T@0 at client/mysqlslap.c:2133, client/mysqlslap.c:1466, csu/libc-start.c:342, 0x559897a0ba2e
Warning:    8 bytes lost at 0x55989993af50, allocated by T@0 at client/mysqlslap.c:2172, client/mysqlslap.c:1250, csu/libc-start.c:342, 0x559897a0ba2e
Memory lost: 72 bytes in 3 chunks

10.3.33 c81677bebba102c306c813e26683db9c37a8a63f (Debug)

/test/MD150122-mariadb-10.3.33-linux-x86_64-dbg$ ./bin/mysqlslap -S/test/non_existing/socket.sock -u root --create-schema='test' --query='SELECT 1' --concurrency=2 --iterations=10
./bin/mysqlslap: Error when connecting to server: Can't connect to local MySQL server through socket '/test/non_existing/socket.sock' (2)
Warning:   16 bytes lost at 0x558dd4e21090, allocated by T@0 at 0x558dd2d8649f, mysys/my_malloc.c:257, client/mysqlslap.c:2144, csu/libc-start.c:342, 0x558dd2d55a2e
Warning:   48 bytes lost at 0x558dd4e20fe0, allocated by T@0 at client/mysqlslap.c:2127, client/mysqlslap.c:1460, csu/libc-start.c:342, 0x558dd2d55a2e
Warning:    8 bytes lost at 0x558dd4e20f50, allocated by T@0 at client/mysqlslap.c:2166, client/mysqlslap.c:1244, csu/libc-start.c:342, 0x558dd2d55a2e
Memory lost: 72 bytes in 3 chunks

10.4.23 5e04c08d0af6b0da2e98d1327577264fbcbe4a06 (Debug)

/test/MD150122-mariadb-10.4.23-linux-x86_64-dbg$ ./bin/mysqlslap -S/test/non_existing/socket.sock -u root --create-schema='test' --query='SELECT 1' --concurrency=2 --iterations=10
./bin/mysqlslap: Error when connecting to server: Can't connect to local MySQL server through socket '/test/non_existing/socket.sock' (2)
Warning:   16 bytes lost at 0x556dfc83d090, allocated by T@0 at 0x556dfb08a4e0, mysys/my_malloc.c:256, client/mysqlslap.c:2128, csu/libc-start.c:342, 0x556dfb059a2e
Warning:   48 bytes lost at 0x556dfc83cfe0, allocated by T@0 at client/mysqlslap.c:2111, client/mysqlslap.c:1444, csu/libc-start.c:342, 0x556dfb059a2e
Warning:    8 bytes lost at 0x556dfc83cf50, allocated by T@0 at client/mysqlslap.c:2150, client/mysqlslap.c:1228, csu/libc-start.c:342, 0x556dfb059a2e
Memory lost: 72 bytes in 3 chunks

10.5.14 8535c260dd399ef07846878536833d9da30b9146 (Debug)

/test/MD150122-mariadb-10.5.14-linux-x86_64-dbg$ ./bin/mysqlslap -S/test/non_existing/socket.sock -u root --create-schema='test' --query='SELECT 1' --concurrency=2 --iterations=10
./bin/mysqlslap: Error when connecting to server: Can't connect to local MySQL server through socket '/test/non_existing/socket.sock' (2)
Warning:   40 bytes lost at 0x5573b3fb7150, allocated by T@0 at 0x5573b30dc825, 0x5573b30ac21b, 0x5573b30adf1b, csu/libc-start.c:342, 0x5573b30aaa0e
Warning:   72 bytes lost at 0x5573b3fb7080, allocated by T@0 at 0x5573b30ac170, 0x5573b30adf1b, csu/libc-start.c:342, 0x5573b30aaa0e
Warning:   32 bytes lost at 0x5573b3fb6fe0, allocated by T@0 at 0x5573b30ac28f, 0x5573b30ad07a, csu/libc-start.c:342, 0x5573b30aaa0e
Memory lost: 144 bytes in 3 chunks

10.6.6 16b87f9890145ff344bfd8cd751e6356a5a8139b (Debug)

/test/MD150122-mariadb-10.6.6-linux-x86_64-dbg$ ./bin/mysqlslap -S/test/non_existing/socket.sock -u root --create-schema='test' --query='SELECT 1' --concurrency=2 --iterations=10
./bin/mysqlslap: Error when connecting to server: Can't connect to local server through socket '/test/non_existing/socket.sock' (2)
Warning:   40 bytes lost at 0x55cca2983150, allocated by T@0 at 0x55cca065fe9c, 0x55cca062f353, 0x55cca0631073, csu/libc-start.c:342, 0x55cca062daae
Warning:   72 bytes lost at 0x55cca2983080, allocated by T@0 at 0x55cca062f2a8, 0x55cca0631073, csu/libc-start.c:342, 0x55cca062daae
Warning:   32 bytes lost at 0x55cca2982fe0, allocated by T@0 at 0x55cca062f3c7, 0x55cca06301bc, csu/libc-start.c:342, 0x55cca062daae
Memory lost: 144 bytes in 3 chunks

10.7.2 c669e764d86a5b575df41d287947816878e21697 (Debug)

/test/MD150122-mariadb-10.7.2-linux-x86_64-dbg$ ./bin/mysqlslap -S/test/non_existing/socket.sock -u root --create-schema='test' --query='SELECT 1' --concurrency=2 --iterations=10
./bin/mysqlslap: Error when connecting to server: Can't connect to local server through socket '/test/non_existing/socket.sock' (2)
Warning:   40 bytes lost at 0x560060573190, allocated by T@0 at 0x56005e31f220, 0x56005e2ee3d3, 0x56005e2f00f3, csu/libc-start.c:342, 0x56005e2ecb2e
Warning:   72 bytes lost at 0x5600605730c0, allocated by T@0 at 0x56005e2ee328, 0x56005e2f00f3, csu/libc-start.c:342, 0x56005e2ecb2e
Warning:   32 bytes lost at 0x560060573020, allocated by T@0 at 0x56005e2ee447, 0x56005e2ef23c, csu/libc-start.c:342, 0x56005e2ecb2e
Memory lost: 144 bytes in 3 chunks

10.8.0 347f6d01e3b570dce49aa1ab42cb83021905a14d (Debug)

/test/MD150122-mariadb-10.8.0-linux-x86_64-dbg$ ./bin/mysqlslap -S/test/non_existing/socket.sock -u root --create-schema='test' --query='SELECT 1' --concurrency=2 --iterations=10
./bin/mysqlslap: Error when connecting to server: Can't connect to local server through socket '/test/non_existing/socket.sock' (2)
Warning:   40 bytes lost at 0x55aa542d4190, allocated by T@0 at 0x55aa52042987, 0x55aa520113f3, 0x55aa52013113, csu/libc-start.c:342, 0x55aa5200fb4e
Warning:   72 bytes lost at 0x55aa542d40c0, allocated by T@0 at 0x55aa52011348, 0x55aa52013113, csu/libc-start.c:342, 0x55aa5200fb4e
Warning:   32 bytes lost at 0x55aa542d4020, allocated by T@0 at 0x55aa52011467, 0x55aa5201225c, csu/libc-start.c:342, 0x55aa5200fb4e
Memory lost: 144 bytes in 3 chunks

Comment by Roel Van de Paar [ 2022-01-16 ]

Confirming Marko's thoughts; as Thiru's patch @b0ef1e45d453b210e6480758aea348ebc13606b9 (ref grep 'fts.queue_count' storage/innobase//*.cc) never made it to the current trees, where the issue is now present, it is indeed unrelated to that patch. It could be that at that point in time that tree had another patch which now made it to trunk.

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