From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 4F81E385381F; Thu, 20 Oct 2022 05:10:55 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4F81E385381F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1666242655; bh=bX76iTDiwVG04HdePSJ6IuR2qRlKS/OVxsorxyaAxCU=; h=From:To:Subject:Date:From; b=KTY2Tb6qmzlK7VsOIjmpqG0Q3VmzbRHMWKvI3sM9ei6ZunJSwFxSVtDx/Q0CA6BzJ GTi+eMiUc7BEank9rZnOGzJS5fCFIomLwCoHKuCZ9dTGJRo3s4IeU5Rk/VXKrlz8qe hn+02q5nPCrjYswyxygxEPZvif1guG02pwyt/q5U= From: "vikasyadav.net91 at gmail dot com" To: glibc-bugs@sourceware.org Subject: [Bug time/29705] New: libc timer_create with option SIGEV_THREAD system call having memory leaks after timer_delete system call Date: Thu, 20 Oct 2022 05:10:49 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: glibc X-Bugzilla-Component: time X-Bugzilla-Version: 2.31 X-Bugzilla-Keywords: X-Bugzilla-Severity: critical X-Bugzilla-Who: vikasyadav.net91 at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: unassigned at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://sourceware.org/bugzilla/show_bug.cgi?id=3D29705 Bug ID: 29705 Summary: libc timer_create with option SIGEV_THREAD system call having memory leaks after timer_delete system call Product: glibc Version: 2.31 Status: UNCONFIRMED Severity: critical Priority: P2 Component: time Assignee: unassigned at sourceware dot org Reporter: vikasyadav.net91 at gmail dot com Target Milestone: --- Created attachment 14406 --> https://sourceware.org/bugzilla/attachment.cgi?id=3D14406&action=3Ded= it Timer application I have following ubuntu environment: Description: Ubuntu 20.04.1 LTS Release: 20.04 gcc 9.4.0 Linux version 5.15.0-48-generic libc-2.31.so I am using libc timer_create system call with option SIGEV_THREAD to create= a timer, My timer functionality is working fine but when I exit my code after successfully deletion of timer using timer_delete system call I am getting = 272 bytes of memory leak in valgrind report. I have attached my sample application(timer_app.c). Please review and let me know if I am doing anything wrong here. below is the valgrind memory leak snippet =3D=3D682959=3D=3D 272 bytes in 1 blocks are possibly lost in loss record 1= of 1 =3D=3D682959=3D=3D at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) =3D=3D682959=3D=3D by 0x40149DA: allocate_dtv (dl-tls.c:286) =3D=3D682959=3D=3D by 0x40149DA: _dl_allocate_tls (dl-tls.c:532) =3D=3D682959=3D=3D by 0x4A65322: allocate_stack (allocatestack.c:622) =3D=3D682959=3D=3D by 0x4A65322: pthread_create@@GLIBC_2.2.5 (pthread_cr= eate.c:660) =3D=3D682959=3D=3D by 0x4865BCC: __start_helper_thread (timer_routines.c= :176) =3D=3D682959=3D=3D by 0x4A6D4DE: __pthread_once_slow (pthread_once.c:116) =3D=3D682959=3D=3D by 0x48649A2: timer_create@@GLIBC_2.3.3 (timer_create= .c:101) =3D=3D682959=3D=3D by 0x1092F1: SupTimerInit (in /home/vikas/a.out) =3D=3D682959=3D=3D by 0x109490: main (in /home/vikas/a.out) =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D complete valgrind dump =3D=3D682959=3D=3D Memcheck, a memory error detector =3D=3D682959=3D=3D Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward= et al. =3D=3D682959=3D=3D Using Valgrind-3.15.0-608cb11914-20190413 and LibVEX; re= run with -h for copyright info =3D=3D682959=3D=3D Command: ./a.out =3D=3D682959=3D=3D Parent PID: 681415 =3D=3D682959=3D=3D=20 --682959--=20 --682959-- Valgrind options: --682959-- --leak-check=3Dfull --682959-- --show-leak-kinds=3Dall --682959-- --track-origins=3Dyes --682959-- --verbose --682959-- --log-file=3Dvalgrind-out.txt --682959-- Contents of /proc/version: --682959-- Linux version 5.15.0-48-generic (buildd@lcy02-amd64-043) (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, GNU ld (GNU Binutils for Ubuntu) 2.3= 4) #54~20.04.1-Ubuntu SMP Thu Sep 1 16:17:26 UTC 2022 --682959--=20 --682959-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-lzcnt-rdtscp-sse3-ssse3-avx-avx2-bmi-f16c-rdrand --682959-- Page sizes: currently 4096, max supported 4096 --682959-- Valgrind library directory: /usr/lib/x86_64-linux-gnu/valgrind --682959-- Reading syms from /home/vikas/a.out --682959-- Reading syms from /usr/lib/x86_64-linux-gnu/ld-2.31.so --682959-- Considering /usr/lib/debug/.build-id/45/87364908de169dec62ffa538170118c1c3a078.debug .. --682959-- .. build-id is valid --682959-- Reading syms from /usr/lib/x86_64-linux-gnu/valgrind/memcheck-amd64-linux --682959-- object doesn't have a symbol table --682959-- object doesn't have a dynamic symbol table --682959-- Scheduler: using generic scheduler lock implementation. --682959-- Reading suppressions file: /usr/lib/x86_64-linux-gnu/valgrind/default.supp =3D=3D682959=3D=3D embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-682959-by-vikas-on-??? =3D=3D682959=3D=3D embedded gdbserver: writing to=20=20 /tmp/vgdb-pipe-to-vgdb-from-682959-by-vikas-on-??? =3D=3D682959=3D=3D embedded gdbserver: shared mem=20=20 /tmp/vgdb-pipe-shared-mem-vgdb-682959-by-vikas-on-??? =3D=3D682959=3D=3D=20 =3D=3D682959=3D=3D TO CONTROL THIS PROCESS USING vgdb (which you probably =3D=3D682959=3D=3D don't want to do, unless you know exactly what you're do= ing, =3D=3D682959=3D=3D or are doing some strange experiment): =3D=3D682959=3D=3D /usr/lib/x86_64-linux-gnu/valgrind/../../bin/vgdb --pi= d=3D682959 ...command... =3D=3D682959=3D=3D=20 =3D=3D682959=3D=3D TO DEBUG THIS PROCESS USING GDB: start GDB like this =3D=3D682959=3D=3D /path/to/gdb ./a.out =3D=3D682959=3D=3D and then give GDB the following command =3D=3D682959=3D=3D target remote | /usr/lib/x86_64-linux-gnu/valgrind/../= ../bin/vgdb --pid=3D682959 =3D=3D682959=3D=3D --pid is optional if only one valgrind process is running =3D=3D682959=3D=3D=20 --682959-- REDIR: 0x4022e20 (ld-linux-x86-64.so.2:strlen) redirected to 0x580c9ce2 (???) --682959-- REDIR: 0x4022bf0 (ld-linux-x86-64.so.2:index) redirected to 0x580c9cfc (???) --682959-- Reading syms from /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_core-amd64-linux.so --682959-- object doesn't have a symbol table --682959-- Reading syms from /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so --682959-- object doesn't have a symbol table =3D=3D682959=3D=3D WARNING: new redirection conflicts with existing -- igno= ring it --682959-- old: 0x04022e20 (strlen ) R-> (0000.0) 0x580c9c= e2 ??? --682959-- new: 0x04022e20 (strlen ) R-> (2007.0) 0x0483f0= 60 strlen --682959-- REDIR: 0x401f600 (ld-linux-x86-64.so.2:strcmp) redirected to 0x483ffd0 (strcmp) --682959-- REDIR: 0x4023380 (ld-linux-x86-64.so.2:mempcpy) redirected to 0x4843a20 (mempcpy) --682959-- Reading syms from /usr/lib/x86_64-linux-gnu/librt-2.31.so --682959-- Considering /usr/lib/debug/.build-id/ce/016c975d94bc4770ed8c62d45dea6b71405a2c.debug .. --682959-- .. build-id is valid --682959-- Reading syms from /usr/lib/x86_64-linux-gnu/libc-2.31.so --682959-- Considering /usr/lib/debug/.build-id/18/78e6b475720c7c51969e69ab2d276fae6d1dee.debug .. --682959-- .. build-id is valid --682959-- Reading syms from /usr/lib/x86_64-linux-gnu/libpthread-2.31.so --682959-- Considering /usr/lib/debug/.build-id/7b/4536f41cdaa5888408e82d0836e33dcf436466.debug .. --682959-- .. build-id is valid --682959-- REDIR: 0x490a480 (libc.so.6:memmove) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4909780 (libc.so.6:strncpy) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490a7b0 (libc.so.6:strcasecmp) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x49090a0 (libc.so.6:strcat) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x49097e0 (libc.so.6:rindex) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490bc50 (libc.so.6:rawmemchr) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4926ce0 (libc.so.6:wmemchr) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4926820 (libc.so.6:wcscmp) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490a5e0 (libc.so.6:mempcpy) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490a410 (libc.so.6:bcmp) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4909710 (libc.so.6:strncmp) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4909150 (libc.so.6:strcmp) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490a540 (libc.so.6:memset) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x49267e0 (libc.so.6:wcschr) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4909670 (libc.so.6:strnlen) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4909230 (libc.so.6:strcspn) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490a800 (libc.so.6:strncasecmp) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x49091d0 (libc.so.6:strcpy) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490a950 (libc.so.6:memcpy@@GLIBC_2.14) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4927f50 (libc.so.6:wcsnlen) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4926860 (libc.so.6:wcscpy) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4909820 (libc.so.6:strpbrk) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4909100 (libc.so.6:index) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4909630 (libc.so.6:strlen) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4912bb0 (libc.so.6:memrchr) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490a850 (libc.so.6:strcasecmp_l) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490a3d0 (libc.so.6:memchr) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4926930 (libc.so.6:wcslen) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x4909ae0 (libc.so.6:strspn) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490a750 (libc.so.6:stpncpy) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490a6f0 (libc.so.6:stpcpy) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490bc90 (libc.so.6:strchrnul) redirected to 0x48331d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x490a8a0 (libc.so.6:strncasecmp_l) redirected to 0x48331= d0 (_vgnU_ifunc_wrapper) --682959-- REDIR: 0x49f2500 (libc.so.6:__strrchr_avx2) redirected to 0x483e= a10 (rindex) --682959-- REDIR: 0x4905b10 (libc.so.6:calloc) redirected to 0x483dce0 (cal= loc) --682959-- REDIR: 0x49046d0 (libc.so.6:free) redirected to 0x483c9d0 (free) --682959-- REDIR: 0x49040e0 (libc.so.6:malloc) redirected to 0x483b780 (mal= loc) --682959-- REDIR: 0x49f2310 (libc.so.6:__strchrnul_avx2) redirected to 0x4843540 (strchrnul) --682959-- REDIR: 0x49f56c0 (libc.so.6:__mempcpy_avx_unaligned_erms) redire= cted to 0x4843660 (mempcpy) --682959-- REDIR: 0x49f5b60 (libc.so.6:__memset_avx2_unaligned_erms) redire= cted to 0x48428e0 (memset) =3D=3D682959=3D=3D=20 =3D=3D682959=3D=3D HEAP SUMMARY: =3D=3D682959=3D=3D in use at exit: 272 bytes in 1 blocks =3D=3D682959=3D=3D total heap usage: 6 allocs, 5 frees, 1,688 bytes alloc= ated =3D=3D682959=3D=3D=20 =3D=3D682959=3D=3D Searching for pointers to 1 not-freed blocks =3D=3D682959=3D=3D Checked 116,416 bytes =3D=3D682959=3D=3D=20 =3D=3D682959=3D=3D 272 bytes in 1 blocks are possibly lost in loss record 1= of 1 =3D=3D682959=3D=3D at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so) =3D=3D682959=3D=3D by 0x40149DA: allocate_dtv (dl-tls.c:286) =3D=3D682959=3D=3D by 0x40149DA: _dl_allocate_tls (dl-tls.c:532) =3D=3D682959=3D=3D by 0x4A65322: allocate_stack (allocatestack.c:622) =3D=3D682959=3D=3D by 0x4A65322: pthread_create@@GLIBC_2.2.5 (pthread_cr= eate.c:660) =3D=3D682959=3D=3D by 0x4865BCC: __start_helper_thread (timer_routines.c= :176) =3D=3D682959=3D=3D by 0x4A6D4DE: __pthread_once_slow (pthread_once.c:116) =3D=3D682959=3D=3D by 0x48649A2: timer_create@@GLIBC_2.3.3 (timer_create= .c:101) =3D=3D682959=3D=3D by 0x1092F1: SupTimerInit (in /home/vikas/a.out) =3D=3D682959=3D=3D by 0x109490: main (in /home/vikas/a.out) =3D=3D682959=3D=3D=20 =3D=3D682959=3D=3D LEAK SUMMARY: =3D=3D682959=3D=3D definitely lost: 0 bytes in 0 blocks =3D=3D682959=3D=3D indirectly lost: 0 bytes in 0 blocks =3D=3D682959=3D=3D possibly lost: 272 bytes in 1 blocks =3D=3D682959=3D=3D still reachable: 0 bytes in 0 blocks =3D=3D682959=3D=3D suppressed: 0 bytes in 0 blocks =3D=3D682959=3D=3D=20 =3D=3D682959=3D=3D ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 f= rom 0) Regards, Vikas --=20 You are receiving this mail because: You are on the CC list for the bug.=