Invalid free() at program exit if custom memory manager is used #2189
Labels
bug
This issue is a bug.
needs-reproduction
This issue needs reproduction.
p2
This is a standard priority issue
response-requested
Waiting on additional info and feedback. Will move to "closing-soon" in 10 days.
Describe the bug
We have code for starting up and shutting down the aws-cpp-sdk library with
Aws::InitAPI()
andAws::ShutdownAPI()
, with a custom memory manager (redirecting all memory allocations to tbbmalloc). Alas, it appears there is a relatively recent regression in aws-cpp-sdk which causes runtime abort at the very end of the program, in atexit handlers. Commenting out the installation of custom memory manager gets rid of the problem.Expected Behavior
Program exits normally.
Current Behavior
Program is aborted by SIGABRT.
Reproduction Steps
Possible Solution
No response
Additional Information/Context
free(): invalid size
Thread 1 "acapella" received signal SIGABRT, Aborted.
__GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
#0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
#1 0x00007ffff528c535 in __GI_abort () at abort.c:79
#2 0x00007ffff52e3518 in __libc_message (action=action@entry=do_abort, fmt=fmt@entry=0x7ffff53ed28d "%s\n") at ../sysdeps/posix/libc_fatal.c:181
#3 0x00007ffff52e9c3a in malloc_printerr (str=str@entry=0x7ffff53eb453 "free(): invalid size") at malloc.c:5359
#4 0x00007ffff52eb47c in _int_free (av=, p=0x7fffb6cf6b70, have_lock=) at malloc.c:4184
#5 0x00007fffb5aff883 in Aws::Delete<std::vector<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface >, Aws::Crt::StlAllocator<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface > > > > (pointerToT=)
at /usr/include/c++/8/ext/new_allocator.h:86
#6 Aws::Deleter<std::vector<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface >, Aws::Crt::StlAllocator<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface > > > >::operator() (this=,
pointerToT=0x7fffb6cf6b80)
at /srv/paavo/DataAnalysis/Acapella/trunk/Production/Intermediates/ThirdParty/src/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/AWSMemory.h:246
#7 Aws::Deleter<std::vector<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface >, Aws::Crt::StlAllocator<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface > > > >::operator() (
this=0x7fffb62c1ad8 Aws::Monitoring::s_monitors, pointerToT=0x7fffb6cf6b80)
at /srv/paavo/DataAnalysis/Acapella/trunk/Production/Intermediates/ThirdParty/src/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/AWSMemory.h:243
#8 std::unique_ptr<std::vector<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface >, Aws::Crt::StlAllocator<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface > > >, Aws::Deleter<std::vector<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface >, Aws::Crt::StlAllocator<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface > > > > >::reset (__p=0x7fffb6cf6b80, this=0x7fffb62c1ad8 Aws::Monitoring::s_monitors)
at /usr/include/c++/8/bits/unique_ptr.h:382
#9 Aws::UniquePtrSafeDeleted<std::vector<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface >, Aws::Crt::StlAllocator<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface > > >, Aws::Deleter<std::vector<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface >, Aws::Crt::StlAllocator<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface > > > > >::forceReset (this=0x7fffb62c1ad8 Aws::Monitoring::s_monitors)
at /srv/paavo/DataAnalysis/Acapella/trunk/Production/Intermediates/ThirdParty/src/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/AWSMemory.h:282
#10 Aws::UniquePtrSafeDeleted<std::vector<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface >, Aws::Crt::StlAllocator<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface > > >, Aws::Deleter<std::vector<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface >, Aws::Crt::StlAllocator<std::unique_ptr<Aws::Monitoring::MonitoringInterface, Aws::DeleterAws::Monitoring::MonitoringInterface > > > > >::~UniquePtrSafeDeleted (this=0x7fffb62c1ad8 Aws::Monitoring::s_monitors, __in_chrg=)
at /srv/paavo/DataAnalysis/Acapella/trunk/Production/Intermediates/ThirdParty/src/aws-sdk-cpp/aws-cpp-sdk-core/include/aws/core/utils/memory/AWSMemory.h:291
#11 0x00007ffff52a3d8c in __run_exit_handlers (status=0, listp=0x7ffff5424718 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true,
run_dtors=run_dtors@entry=true) at exit.c:108
#12 0x00007ffff52a3eba in __GI_exit (status=) at exit.c:139
#13 0x00007ffff528e0a2 in __libc_start_main (main=0x5555555c098d <main(int, char**)>, argc=2, argv=0x7fffffffe968, init=, fini=,
rtld_fini=, stack_end=0x7fffffffe958) at ../csu/libc-start.c:342
#14 0x000055555559f3ca in _start ()
AWS CPP SDK version used
current trunk 58b715c
Compiler and Version used
gcc 8.3
Operating System and version
Debian GNU/Linux 10 (buster)
The text was updated successfully, but these errors were encountered: