Bug #29952 | memory leak error in client library | ||
---|---|---|---|
Submitted: | 22 Jul 2007 0:48 | Modified: | 3 Aug 2007 15:26 |
Reporter: | Shane Bester (Platinum Quality Contributor) | Email Updates: | |
Status: | Not a Bug | Impact on me: | |
Category: | MySQL Server: C API (client library) | Severity: | S3 (Non-critical) |
Version: | 5.0.46 | OS: | Windows |
Assigned to: | Evgeny Potemkin | CPU Architecture: | Any |
Tags: | bfsm_2007_08_02 |
[22 Jul 2007 0:48]
Shane Bester
[22 Jul 2007 0:54]
MySQL Verification Team
debug log.
Attachment: kill.log (application/octet-stream, text), 19.07 KiB.
[22 Jul 2007 0:55]
MySQL Verification Team
The above log, show this printout (in case you want to compare memory addresses): Client info: 5.0.46 thread [000] created! thread [000] mysql_real_connect failed (Lost connection to MySQL server at 'reading authorization packet', system error: 2) 2013 Detected memory leaks! Dumping objects -> {413} normal block at 0x0121FFA0, 48 bytes long. Data: <0=# =# > 30 3D 23 10 1C 3D 23 10 00 00 00 00 00 00 00 00 {412} normal block at 0x01210E60, 128 bytes long. Data: < └yaw > 00 00 00 00 00 00 00 00 C0 79 61 77 FF FF FF FF {70} normal block at 0x01213618, 556 bytes long. Data: < ╚ > 1F 05 00 00 C8 00 00 00 00 00 00 00 00 00 00 00 {51} normal block at 0x01212D28, 556 bytes long. Data: < ╚ > 00 00 00 00 C8 00 00 00 00 00 00 00 00 00 00 00 Object dump complete.
[22 Jul 2007 1:07]
MySQL Verification Team
ok, happens all the time, not just on connection failure as I thought. Probably just some static data initialized in mysql_init(), and never freed. Still, I think it's a bug, and nasty error message is there for a reason.
[22 Jul 2007 1:31]
MySQL Verification Team
The KILL in combination with auto reconnect certain does leak memory. I see gradual increase in memory usage over time.
[1 Aug 2007 15:39]
MySQL Verification Team
When re-reviewing my testcase code, I found that I'd forgotten to call mysql_stmt_close() if the call to mysql_stmt_prepare() failed. After doing this, I didn't see an ver-increasing leak.
[1 Aug 2007 15:45]
MySQL Verification Team
Feel free to mark this as not-a-bug. The only leaks I got now are these small ones, which I think is expected: ==20285== malloc/free: in use at exit: 61776 bytes in 20 blocks. ==20285== malloc/free: 55991 allocs, 55971 frees, 263225610 bytes allocated. ==20285== ==20285== searching for pointers to 20 not-freed blocks. ==20285== checked 4150956 bytes. ==20285== ==20285== ==20285== 16 bytes in 1 blocks are still reachable in loss record 1 of 6 ==20285== at 0x1B905B7C: malloc (in /usr/lib/valgrind/vgpreload_memcheck.so) ==20285== by 0x1B956D83: my_malloc (my_malloc.c:34) ==20285== by 0x1B958812: my_error_register (my_error.c:175) ==20285== by 0x1B95681B: init_client_errs (errmsg.c:229) ==20285== ==20285== ==20285== 16 bytes in 1 blocks are still reachable in loss record 2 of 6 ==20285== at 0x1B90650D: calloc (in /usr/lib/valgrind/vgpreload_memcheck.so) ==20285== by 0x1BCEA239: (within /lib/libdl.so.2) ==20285== by 0x1BCE9E7B: dlsym (in /lib/libdl.so.2) ==20285== by 0x1BB375CF: pthread_create (in /usr/lib/valgrind/libpthread.so) ==20285== ==20285== ==20285== 52 bytes in 1 blocks are still reachable in loss record 3 of 6 ==20285== at 0x1B905B7C: malloc (in /usr/lib/valgrind/vgpreload_memcheck.so) ==20285== by 0x1B980295: DbugMalloc (dbug.c:1991) ==20285== by 0x1B97E4AE: code_state (dbug.c:345) ==20285== by 0x1B97F2F4: _db_enter_ (dbug.c:942) ==20285== ==20285== ==20285== 172 bytes in 1 blocks are still reachable in loss record 4 of 6 ==20285== at 0x1B90650D: calloc (in /usr/lib/valgrind/vgpreload_memcheck.so) ==20285== by 0x1B95DE54: my_thread_init (my_thr_init.c:253) ==20285== by 0x1B95DBB4: my_thread_global_init (my_thr_init.c:152) ==20285== by 0x1B95692A: my_init (my_init.c:87) ==20285== ==20285== ==20285== 200 bytes in 1 blocks are definitely lost in loss record 5 of 6 ==20285== at 0x1B905B7C: malloc (in /usr/lib/valgrind/vgpreload_memcheck.so) ==20285== by 0x1BB35877: (within /usr/lib/valgrind/libpthread.so) ==20285== by 0x1BB38C2A: (within /usr/lib/valgrind/libpthread.so) ==20285== by 0x1BB38DBC: pthread_key_create (in /usr/lib/valgrind/libpthread.so) ==20285== ==20285== ==20285== 61320 bytes in 15 blocks are still reachable in loss record 6 of 6 ==20285== at 0x1B905B7C: malloc (in /usr/lib/valgrind/vgpreload_memcheck.so) ==20285== by 0x1B961AEC: my_once_alloc (my_once.c:61) ==20285== by 0x1B962073: init_state_maps (charset.c:62) ==20285== by 0x1B962A27: init_available_charsets (charset.c:418) ==20285== ==20285== LEAK SUMMARY: ==20285== definitely lost: 200 bytes in 1 blocks. ==20285== possibly lost: 0 bytes in 0 blocks. ==20285== still reachable: 61576 bytes in 19 blocks. ==20285== suppressed: 0 bytes in 0 blocks. --20285-- TT/TC: 0 tc sectors discarded. --20285-- 55626 tt_fast misses. --20285-- translate: new 6177 (108788 -> 1377085; ratio 126:10) --20285-- discard 149 (1829 -> 26496; ratio 144:10). --20285-- chainings: 4605 chainings, 0 unchainings. --20285-- dispatch: 13500000 jumps (bb entries); of them 117942434 (873%) unchained. --20285-- 80041/38177280 major/minor sched events. --20285-- reg-alloc: 1093 t-req-spill, 253534+8712 orig+spill uis, --20285-- 32173 total-reg-rank --20285-- sanity: 80041 cheap, 3202 expensive checks. --20285-- ccalls: 25625 C calls, 56% saves+restores avoided (84998 bytes) --20285-- 35369 args, avg 0.89 setup instrs each (7772 bytes) --20285-- 0% clear the stack (76602 bytes) --20285-- 9194 retvals, 33% of reg-reg movs avoided (6034 bytes) sbester@www:~>
[1 Aug 2007 15:47]
MySQL Verification Team
testcase, fyi, which doesn't appear to leak memory after fixing it :-/
Attachment: bug29952.c (text/plain), 10.58 KiB.
[5 Jun 2008 16:44]
Bill Spencer
I still get this error on both connect 3.5 and 5 using XP pro and want to move on but I can seem to get rid of this problem.
[6 Jun 2008 10:17]
MySQL Verification Team
Hi Bill, I had discovered this 'bug' was not a bug afterall. If you are seeing memory leaks still, please upload the code for inspection.