irssi-import / bugs.irssi.org

bugs.irssi.org archive
https://github.com/irssi/irssi/issues
0 stars 0 forks source link

irssi v0.8.10 memory leak! #350

Closed irssibot closed 16 years ago

irssibot commented 18 years ago

From one of the last release candidate 0.8.10 I see in top [F, n] that my irssi grabs more and more memory. Sometimes even I saw irssi crashed with this message: "Out of memory", because, I suppose, there is no memory left, :).

I have an example. I started irssi yesterday and now this is the situation:

  PID S USER     %CPU %MEM TTY      COMMAND                                                                                                                     
14972 S jesus     0.0 39.1 pts/4    irssi

What could more I say?

Something more! Ask it! I wanna help! :)

irssibot commented 18 years ago

log.irssi.valgrind.7966

valgrind scan! irssi compiled with "-O0 -g"

==7966== Memcheck, a memory error detector.
==7966== Copyright (C) 2002-2005, and GNU GPL'd, by Julian Seward et al.
==7966== Using LibVEX rev 1471, a library for dynamic binary translation.
==7966== Copyright (C) 2004-2005, and GNU GPL'd, by OpenWorks LLP.
==7966== Using valgrind-3.1.0, a dynamic binary instrumentation framework.
==7966== Copyright (C) 2000-2005, and GNU GPL'd, by Julian Seward et al.
==7966== For more details, rerun with: -v
==7966== 
==7966== My PID = 7966, parent PID = 4798.  Prog and args are:
==7966==    irssi
==7966== 
==7983== 
==7983== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 49 from 2)
==7983== malloc/free: in use at exit: 399,289 bytes in 10,298 blocks.
==7983== malloc/free: 51,635 allocs, 41,337 frees, 1,217,618 bytes allocated.
==7983== For counts of detected errors, rerun with: -v
==7983== searching for pointers to 10,298 not-freed blocks.
==7983== checked 866,648 bytes.
==7983== 
==7983== 156 (36 direct, 120 indirect) bytes in 1 blocks are definitely lost in loss record 7 of 22
==7983==    at 0x401B58F: malloc (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==7983==    by 0x44AE09A: (within /lib/libc-2.3.5.so)
==7983==    by 0x44AE692: __nss_database_lookup (in /lib/libc-2.3.5.so)
==7983==    by 0x46020CB: ???
==7983==    by 0x46029B3: ???
==7983==    by 0x446E7BC: getpwuid_r (in /lib/libc-2.3.5.so)
==7983==    by 0x42280A1: (within /usr/lib/libglib-2.0.so.0.800.4)
==7983== 
==7983== LEAK SUMMARY:
==7983==    definitely lost: 36 bytes in 1 blocks.
==7983==    indirectly lost: 120 bytes in 10 blocks.
==7983==      possibly lost: 0 bytes in 0 blocks.
==7983==    still reachable: 399,133 bytes in 10,287 blocks.
==7983==         suppressed: 0 bytes in 0 blocks.
==7983== Reachable blocks (those to which a pointer was found) are not shown.
==7983== To see them, rerun with: --show-reachable=yes
==7984== 
==7984== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 45 from 2)
==7984== malloc/free: in use at exit: 959,490 bytes in 10,322 blocks.
==7984== malloc/free: 52,021 allocs, 41,699 frees, 1,783,853 bytes allocated.
==7984== For counts of detected errors, rerun with: -v
==7984== searching for pointers to 10,322 not-freed blocks.
==7984== checked 870,000 bytes.
==7984== 
==7984== 156 (36 direct, 120 indirect) bytes in 1 blocks are definitely lost in loss record 7 of 22
==7984==    at 0x401B58F: malloc (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==7984==    by 0x44AE09A: (within /lib/libc-2.3.5.so)
==7984==    by 0x44AE692: __nss_database_lookup (in /lib/libc-2.3.5.so)
==7984==    by 0x46020CB: ???
==7984==    by 0x46029B3: ???
==7984==    by 0x446E7BC: getpwuid_r (in /lib/libc-2.3.5.so)
==7984==    by 0x42280A1: (within /usr/lib/libglib-2.0.so.0.800.4)
==7984== 
==7984== LEAK SUMMARY:
==7984==    definitely lost: 36 bytes in 1 blocks.
==7984==    indirectly lost: 120 bytes in 10 blocks.
==7984==      possibly lost: 0 bytes in 0 blocks.
==7984==    still reachable: 959,334 bytes in 10,311 blocks.
==7984==         suppressed: 0 bytes in 0 blocks.
==7984== Reachable blocks (those to which a pointer was found) are not shown.
==7984== To see them, rerun with: --show-reachable=yes
==7966== Invalid read of size 1
==7966==    at 0x401DF18: strlen (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==7966==    by 0x4030B6F: (within /usr/lib/perl5/vendor_perl/5.8.7/i686-linux/auto/Irssi/Irc/Irc.so)
==7966==  Address 0x4C9A4C8 is 0 bytes inside a block of size 43 free'd
==7966==    at 0x401C66F: free (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==7966==    by 0x420202F: g_free (in /usr/lib/libglib-2.0.so.0.800.4)
==7966==    by 0x80E6C97: (within /usr/bin/irssi)
==7966==    by 0x80E6E2B: signal_emit (in /usr/bin/irssi)
==7966==    by 0x80C1136: dcc_destroy (in /usr/bin/irssi)
==7966==    by 0x80C1C17: dcc_close (in /usr/bin/irssi)
==7966==    by 0x80C4E0A: (within /usr/bin/irssi)
==7966==    by 0x80D7333: (within /usr/bin/irssi)
==7966==    by 0x4229F2F: (within /usr/lib/libglib-2.0.so.0.800.4)
==7966== 
==7966== Invalid read of size 1
==7966==    at 0x401DF21: strlen (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==7966==    by 0x4030B6F: (within /usr/lib/perl5/vendor_perl/5.8.7/i686-linux/auto/Irssi/Irc/Irc.so)
==7966==  Address 0x4C9A4C9 is 1 bytes inside a block of size 43 free'd
==7966==    at 0x401C66F: free (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==7966==    by 0x420202F: g_free (in /usr/lib/libglib-2.0.so.0.800.4)
==7966==    by 0x80E6C97: (within /usr/bin/irssi)
==7966==    by 0x80E6E2B: signal_emit (in /usr/bin/irssi)
==7966==    by 0x80C1136: dcc_destroy (in /usr/bin/irssi)
==7966==    by 0x80C1C17: dcc_close (in /usr/bin/irssi)
==7966==    by 0x80C4E0A: (within /usr/bin/irssi)
==7966==    by 0x80D7333: (within /usr/bin/irssi)
==7966==    by 0x4229F2F: (within /usr/lib/libglib-2.0.so.0.800.4)
==7966== 
==7966== Invalid read of size 1
==7966==    at 0x401E74E: memmove (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==7966==    by 0x40C5E34: Perl_sv_setpvn (in /usr/lib/libperl.so.1.5.8)
==7966==  Address 0x4C9A4F1 is 41 bytes inside a block of size 43 free'd
==7966==    at 0x401C66F: free (in /usr/lib/valgrind/x86-linux/vgpreload_memcheck.so)
==7966==    by 0x420202F: g_free (in /usr/lib/libglib-2.0.so.0.800.4)
==7966==    by 0x80E6C97: (within /usr/bin/irssi)
==7966==    by 0x80E6E2B: signal_emit (in /usr/bin/irssi)
==7966==    by 0x80C1136: dcc_destroy (in /usr/bin/irssi)
==7966==    by 0x80C1C17: dcc_close (in /usr/bin/irssi)
==7966==    by 0x80C4E0A: (within /usr/bin/irssi)
==7966==    by 0x80D7333: (within /usr/bin/irssi)
==7966==    by 0x4229F2F: (within /usr/lib/libglib-2.0.so.0.800.4)
irssibot commented 18 years ago

same here, also older versions are affected:

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
25922 tom        0   0  397m 335m 3736 S  0.3 26.5   1:39.35 irssi

this is a 1,25GB highmem system. i also start irssi in screen, no hard CFLAGS (-O2 -fomit-frame-pointer-pipe)

some scripts loaded, but it's no difference if i disable all. ram gets massively filled after a day. /upgrade gives a glibc double free crash since 0.8.10

more infos needed?

irssibot commented 18 years ago

After /quit, here what valgrind has to say. gcc-4.0.3, glibc-2.3.90-30, glib2-2.10.1-1.

==7864== ==7864== ERROR SUMMARY: 4 errors from 4 contexts (suppressed: 29 from 1) ==7864== ==7864== 1 errors in context 1 of 4: ==7864== Invalid free() / delete / delete[] ==7864== at 0x4004D48: free (vg_replace_malloc.c:235) ==7864== by 0x465F4D0: g_free (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x80C3055: dcc_unregister_type (dcc.c:62) ==7864== by 0x80CBED3: dcc_server_deinit (dcc-server.c:410) ==7864== by 0x80C4529: irc_dcc_deinit (dcc.c:575) ==7864== by 0x80A9C84: irc_deinit (irc.c:6) ==7864== by 0x8071E72: textui_deinit (irssi.c:245) ==7864== by 0x8072195: main (irssi.c:401) ==7864== Address 0x4092FB0 is 48 bytes inside a block of size 120 alloc'd ==7864== at 0x4004453: memalign (vg_replace_malloc.c:332) ==7864== by 0x400449F: posix_memalign (vg_replace_malloc.c:384) ==7864== by 0x466E3A8: (within /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466F65B: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466F784: g_slice_alloc0 (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466FD7A: g_slist_append (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x80D10BD: command_bind_full (commands.c:159) ==7864== by 0x80B01B6: irc_commands_init (irc-commands.c:1048) ==7864== by 0x80AAC89: irc_core_init (irc-core.c:115) ==7864== by 0x80A9C5E: irc_init (irc.c:5) ==7864== by 0x8071C5D: textui_init (irssi.c:151) ==7864== by 0x8072070: main (irssi.c:368) ==7864== ==7864== 1 errors in context 2 of 4: ==7864== Invalid free() / delete / delete[] ==7864== at 0x4004D48: free (vg_replace_malloc.c:235) ==7864== by 0x465F4D0: g_free (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x80C3055: dcc_unregister_type (dcc.c:62) ==7864== by 0x80C95C8: dcc_send_deinit (dcc-send.c:484) ==7864== by 0x80C451A: irc_dcc_deinit (dcc.c:572) ==7864== by 0x80A9C84: irc_deinit (irc.c:6) ==7864== by 0x8071E72: textui_deinit (irssi.c:245) ==7864== by 0x8072195: main (irssi.c:401) ==7864== Address 0x4095E08 is 8 bytes inside a block of size 120 alloc'd ==7864== at 0x4004453: memalign (vg_replace_malloc.c:332) ==7864== by 0x400449F: posix_memalign (vg_replace_malloc.c:384) ==7864== by 0x466E3A8: (within /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466F65B: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466F784: g_slice_alloc0 (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466FD7A: g_slist_append (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x80D198A: command_calc_options (commands.c:397) ==7864== by 0x80D1C6D: command_set_options_module (commands.c:468) ==7864== by 0x80B061C: irc_commands_init (irc-commands.c:1073) ==7864== by 0x80AAC89: irc_core_init (irc-core.c:115) ==7864== by 0x80A9C5E: irc_init (irc.c:5) ==7864== by 0x8071C5D: textui_init (irssi.c:151) ==7864== ==7864== 1 errors in context 3 of 4: ==7864== Invalid free() / delete / delete[] ==7864== at 0x4004D48: free (vg_replace_malloc.c:235) ==7864== by 0x465F4D0: g_free (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x80C3055: dcc_unregister_type (dcc.c:62) ==7864== by 0x80C8358: dcc_get_deinit (dcc-get.c:587) ==7864== by 0x80C4515: irc_dcc_deinit (dcc.c:571) ==7864== by 0x80A9C84: irc_deinit (irc.c:6) ==7864== by 0x8071E72: textui_deinit (irssi.c:245) ==7864== by 0x8072195: main (irssi.c:401) ==7864== Address 0x4095E30 is 48 bytes inside a block of size 120 alloc'd ==7864== at 0x4004453: memalign (vg_replace_malloc.c:332) ==7864== by 0x400449F: posix_memalign (vg_replace_malloc.c:384) ==7864== by 0x466E3A8: (within /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466F65B: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466F784: g_slice_alloc0 (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466FD7A: g_slist_append (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x80D198A: command_calc_options (commands.c:397) ==7864== by 0x80D1C6D: command_set_options_module (commands.c:468) ==7864== by 0x80B061C: irc_commands_init (irc-commands.c:1073) ==7864== by 0x80AAC89: irc_core_init (irc-core.c:115) ==7864== by 0x80A9C5E: irc_init (irc.c:5) ==7864== by 0x8071C5D: textui_init (irssi.c:151) ==7864== ==7864== 1 errors in context 4 of 4: ==7864== Invalid free() / delete / delete[] ==7864== at 0x4004D48: free (vg_replace_malloc.c:235) ==7864== by 0x465F4D0: g_free (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x80C3055: dcc_unregister_type (dcc.c:62) ==7864== by 0x80C6B79: dcc_chat_deinit (dcc-chat.c:842) ==7864== by 0x80C4510: irc_dcc_deinit (dcc.c:570) ==7864== by 0x80A9C84: irc_deinit (irc.c:6) ==7864== by 0x8071E72: textui_deinit (irssi.c:245) ==7864== by 0x8072195: main (irssi.c:401) ==7864== Address 0x4095A48 is 72 bytes inside a block of size 120 alloc'd ==7864== at 0x4004453: memalign (vg_replace_malloc.c:332) ==7864== by 0x400449F: posix_memalign (vg_replace_malloc.c:384) ==7864== by 0x466E3A8: (within /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466F65B: g_slice_alloc (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466F784: g_slice_alloc0 (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x466FD7A: g_slist_append (in /usr/lib/libglib-2.0.so.0.1000.1) ==7864== by 0x80D198A: command_calc_options (commands.c:397) ==7864== by 0x80D1C6D: command_set_options_module (commands.c:468) ==7864== by 0x80B061C: irc_commands_init (irc-commands.c:1073) ==7864== by 0x80AAC89: irc_core_init (irc-core.c:115) ==7864== by 0x80A9C5E: irc_init (irc.c:5) ==7864== by 0x8071C5D: textui_init (irssi.c:151) --7864-- --7864-- supp: 29 Fedora-Core-5-hack2 ==7864== ==7864== IN SUMMARY: 4 errors from 4 contexts (suppressed: 29 from 1) ==7864== ==7864== malloc/free: in use at exit: 95,242 bytes in 592 blocks. ==7864== malloc/free: 57,943 allocs, 57,355 frees, 1,570,505 bytes allocated. ==7864== ==7864== searching for pointers to 592 not-freed blocks. ==7864== checked 604,356 bytes. ==7864== ==7864== LEAK SUMMARY: ==7864== definitely lost: 834 bytes in 49 blocks. ==7864== possibly lost: 5,224 bytes in 35 blocks. ==7864== still reachable: 89,184 bytes in 508 blocks. ==7864== suppressed: 0 bytes in 0 blocks. ==7864== Use --leak-check=full to see details of leaked memory. --7864-- memcheck: sanity checks: 268 cheap, 11 expensive --7864-- memcheck: auxmaps: 0 auxmap entries (0k, 0M) in use --7864-- memcheck: auxmaps: 0 searches, 0 comparisons --7864-- memcheck: secondaries: 107 issued (6848k, 6M) --7864-- memcheck: secondaries: 82 accessible and distinguished (5248k, 5M) --7864-- tt/tc: 76,055 tt lookups requiring 100,450 probes --7864-- tt/tc: 76,055 fast-cache updates, 4 flushes --7864-- translate: new 25,518 (645,350 -> 9,050,644; ratio 140:10) [0 scs] --7864-- translate: dumped 0 (0 -> ??) --7864-- translate: discarded 116 (2,055 -> ??) --7864-- scheduler: 13,410,687 jumps (bb entries). --7864-- scheduler: 268/150,939 major/minor sched events. --7864-- sanity: 269 cheap, 11 expensive checks. --7864-- exectx: 30,011 lists, 13,305 contexts (avg 0 per list) --7864-- exectx: 115,225 searches, 106,761 full compares (926 per 1000) --7864-- exectx: 0 cmp2, 77 cmp4, 0 cmpAll

irssibot commented 17 years ago

I also notice this, although for me it takes a couple of days to reach 16% of my 768MB.

irssibot commented 17 years ago

ditto here; after a week or so, irssi consumes about 400 MB of RSS ram. After startup, it are only 5-10 MB.

On another system with a similar setup, I do not see this problem. One difference between them might be, that the system with the leak does a daily reconnect (due to ISP disconnect), while the other one stays online the whole time.

irssibot commented 16 years ago

beep_beep.pl seems to cause this memleak; it executes

| Irssi::timeout_add($beep_flood, 'beep_overflow_timeout', undef);

for every beep which allocates a new timeout handler again and again. Replace line above with

| Irssi::timeout_add_once($beep_flood, 'beep_overflow_timeout', undef);

irssibot commented 16 years ago

ensc, it worked for me! you fixed it! I lived together with this problem for more than two years! :)

irssibot commented 16 years ago

I would close this bug!

irssibot commented 16 years ago

Heck, indeed! That was the problem! And the fix!

Many thanks, Enrico.

irssibot commented 16 years ago

Ok, i'll close as 'not a bug' then.

irssibot commented 16 years ago