libc timer_create with option SIGEV_THREAD system call having memory leaks after timer_delete system call
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gcc-9 (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
glibc (Ubuntu) |
Triaged
|
Low
|
Unassigned |
Bug Description
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(
below is the valgrind memory leak snippet
==682959== 272 bytes in 1 blocks are possibly lost in loss record 1 of 1
==682959== at 0x483DD99: calloc (in /usr/lib/
==682959== by 0x40149DA: allocate_dtv (dl-tls.c:286)
==682959== by 0x40149DA: _dl_allocate_tls (dl-tls.c:532)
==682959== by 0x4A65322: allocate_stack (allocatestack.
==682959== by 0x4A65322: pthread_
==682959== by 0x4865BCC: __start_
==682959== by 0x4A6D4DE: __pthread_once_slow (pthread_
==682959== by 0x48649A2: timer_create@
==682959== by 0x1092F1: SupTimerInit (in /home/vikas/a.out)
==682959== by 0x109490: main (in /home/vikas/a.out)
=======
complete valgrind dump
==682959== Memcheck, a memory error detector
==682959== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==682959== Using Valgrind-
==682959== Command: ./a.out
==682959== Parent PID: 681415
==682959==
--682959--
--682959-- Valgrind options:
--682959-- --leak-check=full
--682959-- --show-
--682959-- --track-origins=yes
--682959-- --verbose
--682959-- --log-file=
--682959-- Contents of /proc/version:
--682959-- Linux version 5.15.0-48-generic (buildd@
--682959--
--682959-- Arch and hwcaps: AMD64, LittleEndian, amd64-cx16-
--682959-- Page sizes: currently 4096, max supported 4096
--682959-- Valgrind library directory: /usr/lib/
--682959-- Reading syms from /home/vikas/a.out
--682959-- Reading syms from /usr/lib/
--682959-- Considering /usr/lib/
--682959-- .. build-id is valid
--682959-- Reading syms from /usr/lib/
--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/
==682959== embedded gdbserver: reading from /tmp/vgdb-
==682959== embedded gdbserver: writing to /tmp/vgdb-
==682959== embedded gdbserver: shared mem /tmp/vgdb-
==682959==
==682959== TO CONTROL THIS PROCESS USING vgdb (which you probably
==682959== don't want to do, unless you know exactly what you're doing,
==682959== or are doing some strange experiment):
==682959== /usr/lib/
==682959==
==682959== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==682959== /path/to/gdb ./a.out
==682959== and then give GDB the following command
==682959== target remote | /usr/lib/
==682959== --pid is optional if only one valgrind process is running
==682959==
--682959-- REDIR: 0x4022e20 (ld-linux-
--682959-- REDIR: 0x4022bf0 (ld-linux-
--682959-- Reading syms from /usr/lib/
--682959-- object doesn't have a symbol table
--682959-- Reading syms from /usr/lib/
--682959-- object doesn't have a symbol table
==682959== WARNING: new redirection conflicts with existing -- ignoring it
--682959-- old: 0x04022e20 (strlen ) R-> (0000.0) 0x580c9ce2 ???
--682959-- new: 0x04022e20 (strlen ) R-> (2007.0) 0x0483f060 strlen
--682959-- REDIR: 0x401f600 (ld-linux-
--682959-- REDIR: 0x4023380 (ld-linux-
--682959-- Reading syms from /usr/lib/
--682959-- Considering /usr/lib/
--682959-- .. build-id is valid
--682959-- Reading syms from /usr/lib/
--682959-- Considering /usr/lib/
--682959-- .. build-id is valid
--682959-- Reading syms from /usr/lib/
--682959-- Considering /usr/lib/
--682959-- .. build-id is valid
--682959-- REDIR: 0x490a480 (libc.so.6:memmove) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4909780 (libc.so.6:strncpy) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x490a7b0 (libc.so.
--682959-- REDIR: 0x49090a0 (libc.so.6:strcat) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x49097e0 (libc.so.6:rindex) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x490bc50 (libc.so.
--682959-- REDIR: 0x4926ce0 (libc.so.6:wmemchr) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4926820 (libc.so.6:wcscmp) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x490a5e0 (libc.so.6:mempcpy) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x490a410 (libc.so.6:bcmp) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4909710 (libc.so.6:strncmp) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4909150 (libc.so.6:strcmp) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x490a540 (libc.so.6:memset) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x49267e0 (libc.so.6:wcschr) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4909670 (libc.so.6:strnlen) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4909230 (libc.so.6:strcspn) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x490a800 (libc.so.
--682959-- REDIR: 0x49091d0 (libc.so.6:strcpy) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x490a950 (libc.so.
--682959-- REDIR: 0x4927f50 (libc.so.6:wcsnlen) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4926860 (libc.so.6:wcscpy) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4909820 (libc.so.6:strpbrk) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4909100 (libc.so.6:index) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4909630 (libc.so.6:strlen) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4912bb0 (libc.so.6:memrchr) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x490a850 (libc.so.
--682959-- REDIR: 0x490a3d0 (libc.so.6:memchr) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4926930 (libc.so.6:wcslen) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x4909ae0 (libc.so.6:strspn) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x490a750 (libc.so.6:stpncpy) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x490a6f0 (libc.so.6:stpcpy) redirected to 0x48331d0 (_vgnU_
--682959-- REDIR: 0x490bc90 (libc.so.
--682959-- REDIR: 0x490a8a0 (libc.so.
--682959-- REDIR: 0x49f2500 (libc.so.
--682959-- REDIR: 0x4905b10 (libc.so.6:calloc) redirected to 0x483dce0 (calloc)
--682959-- REDIR: 0x49046d0 (libc.so.6:free) redirected to 0x483c9d0 (free)
--682959-- REDIR: 0x49040e0 (libc.so.6:malloc) redirected to 0x483b780 (malloc)
--682959-- REDIR: 0x49f2310 (libc.so.
--682959-- REDIR: 0x49f56c0 (libc.so.
--682959-- REDIR: 0x49f5b60 (libc.so.
==682959==
==682959== HEAP SUMMARY:
==682959== in use at exit: 272 bytes in 1 blocks
==682959== total heap usage: 6 allocs, 5 frees, 1,688 bytes allocated
==682959==
==682959== Searching for pointers to 1 not-freed blocks
==682959== Checked 116,416 bytes
==682959==
==682959== 272 bytes in 1 blocks are possibly lost in loss record 1 of 1
==682959== at 0x483DD99: calloc (in /usr/lib/
==682959== by 0x40149DA: allocate_dtv (dl-tls.c:286)
==682959== by 0x40149DA: _dl_allocate_tls (dl-tls.c:532)
==682959== by 0x4A65322: allocate_stack (allocatestack.
==682959== by 0x4A65322: pthread_
==682959== by 0x4865BCC: __start_
==682959== by 0x4A6D4DE: __pthread_once_slow (pthread_
==682959== by 0x48649A2: timer_create@
==682959== by 0x1092F1: SupTimerInit (in /home/vikas/a.out)
==682959== by 0x109490: main (in /home/vikas/a.out)
==682959==
==682959== LEAK SUMMARY:
==682959== definitely lost: 0 bytes in 0 blocks
==682959== indirectly lost: 0 bytes in 0 blocks
==682959== possibly lost: 272 bytes in 1 blocks
==682959== still reachable: 0 bytes in 0 blocks
==682959== suppressed: 0 bytes in 0 blocks
==682959==
==682959== ERROR SUMMARY: 1 errors from 1 contexts (suppressed: 0 from 0)
Regards,
Vikas
Changed in gcc-9 (Ubuntu): | |
status: | Incomplete → New |
Changed in gcc-9 (Ubuntu): | |
status: | New → Invalid |
Changed in glibc (Ubuntu): | |
status: | New → Triaged |
importance: | Undecided → Low |
tags: | added: foundations-triage-discuss |
Thank you for taking the time to report this bug and helping to make Ubuntu better. I don't see timer_app.c. Did you forget to attach it to the bug report?