Package: apt Version: 1.4~beta4ubuntu1 (I also checked the code of 1.4~beta4, hence reporting here.)
I just had an ‘apt install’ process freeze when I resized its terminal window. Attaching gdb revealed the backtrace below, showing that free() was interrupted by the SIGWINCH handler, which calls Configuration::FindB, which builds the first argument of checkFindConfigOptionType with the std::string(const char *) constructor, which tries to call malloc(), leading to a deadlock. malloc() is unsafe to call within a signal hander (https://www.securecoding.cert.org/confluence/display/c/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers). Probably the most straightforward solution is to have the signal handler do nothing other than set a volatile sig_atomic_t flag, and defer the real work to some safe point outside the handler. Anders #0 __lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95 #1 0x00007fb4d0b6de82 in __GI___libc_malloc (bytes=140414575876864) at malloc.c:2923 #2 0x00007fb4d1155af8 in operator new(unsigned long) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x00007fb4d14ee54d in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char*> (this=0x7fffda2fe130, __beg=0x7fb4d15be6c1 "Debug::InstallProgress::Fancy", __end=<optimized out>) at /usr/include/c++/6/bits/basic_string.tcc:219 #4 0x00007fb4d14f19b5 in std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct_aux<char const*> ( __end=<optimized out>, __beg=0x7fb4d15be6c1 "Debug::InstallProgress::Fancy", this=0x7fffda2fe130) at /usr/include/c++/6/bits/basic_string.h:196 #5 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::_M_construct<char const*> (__end=<optimized out>, __beg=0x7fb4d15be6c1 "Debug::InstallProgress::Fancy", this=0x7fffda2fe130) at /usr/include/c++/6/bits/basic_string.h:215 #6 std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string (__a=..., __s=0x7fb4d15be6c1 "Debug::InstallProgress::Fancy", this=0x7fffda2fe130) at /usr/include/c++/6/bits/basic_string.h:456 #7 Configuration::FindB (this=0x561e68c59c20, Name=Name@entry=0x7fb4d15be6c1 "Debug::InstallProgress::Fancy", Default=Default@entry=@0x7fffda2fe19f: false) at ./apt-pkg/contrib/configuration.cc:446 #8 0x00007fb4d1579700 in APT::Progress::PackageManagerFancy::GetTerminalSize ( this=this@entry=0x561e69344bf0) at ./apt-pkg/install-progress.cc:253 #9 0x00007fb4d157a379 in APT::Progress::PackageManagerFancy::HandleSIGWINCH ( this=0x561e69344bf0) at ./apt-pkg/install-progress.cc:299 #10 0x00007fb4d157a3bf in APT::Progress::PackageManagerFancy::staticSIGWINCH ( signum=28) at ./apt-pkg/install-progress.cc:240 #11 <signal handler called> #12 0x00007fb4d0b6a358 in _int_free (av=0x7fb4d0ea9b00 <main_arena>, p=0x561e69a6a890, have_lock=0) at malloc.c:4040 #13 0x00007fb4d0b6e18c in __GI___libc_free (mem=<optimized out>) at malloc.c:2982 #14 0x00007fb4d157c918 in metaIndex::~metaIndex (this=0x561e699f0100, __in_chrg=<optimized out>) at ./apt-pkg/metaindex.cc:45 #15 0x00007fb4d1524ee9 in debReleaseIndex::~debReleaseIndex ( this=0x561e699f0100, __in_chrg=<optimized out>) at ./apt-pkg/deb/debmetaindex.cc:111 #16 0x00007fb4d1534dd6 in debSLTypeDebian::CreateItemInternal ( this=0x7fb4d17f6800 <_apt_DebSrcType>, List=..., URI=..., Dist=..., Section="universe", IsSrc=IsSrc@entry=@0x7fffda2fee67: true, Options=std::map with 1 elements = {...}) at ./apt-pkg/deb/debmetaindex.cc:1156 #17 0x00007fb4d1535005 in debSLTypeDebSrc::CreateItem (this=<optimized out>, List=..., URI=..., Dist=..., Section=..., Options=...) at ./apt-pkg/deb/debmetaindex.cc:1199 #18 0x00007fb4d15a0cfd in pkgSourceList::Type::ParseLine ( this=0x7fb4d17f6800 <_apt_DebSrcType>, List=std::vector of length 9, capacity 16 = {...}, Buffer=<optimized out>, CurLine=18, File="/etc/apt/sources.list") at ./apt-pkg/sourcelist.cc:271 #19 0x00007fb4d159e892 in pkgSourceList::ParseFileOldStyle ( this=this@entry=0x561e6974cf10, File="/etc/apt/sources.list") at ./apt-pkg/sourcelist.cc:415 #20 0x00007fb4d15a4388 in pkgSourceList::ReadAppend ( this=this@entry=0x561e6974cf10, File="/etc/apt/sources.list") at ./apt-pkg/sourcelist.cc:364 #21 0x00007fb4d15a4715 in pkgSourceList::ReadMainList ( this=this@entry=0x561e6974cf10) at ./apt-pkg/sourcelist.cc:319 #22 0x00007fb4d14d68c6 in pkgCacheFile::BuildSourceList ( this=this@entry=0x7fffda2ff880) at ./apt-pkg/cachefile.cc:145 #23 0x00007fb4d14d768b in pkgCacheFile::BuildCaches ( this=this@entry=0x7fffda2ff880, Progress=Progress@entry=0x0, WithLock=WithLock@entry=true) at ./apt-pkg/cachefile.cc:107 #24 0x00007fb4d154c28e in pkgDPkgPM::Go (this=0x561e697fbac0, progress=<optimized out>) at ./apt-pkg/deb/dpkgpm.cc:2154 #25 0x00007fb4d1587c4b in pkgPackageManager::DoInstallPostFork ( this=0x561e697fbac0, progress=0x561e69344bf0) at ./apt-pkg/packagemanager.cc:1154 #26 0x00007fb4d181cb0d in InstallPackages(CacheFile&, bool, bool, bool) () from /usr/lib/x86_64-linux-gnu/libapt-private.so.0.0 #27 0x00007fb4d1822499 in DoInstall(CommandLine&) () from /usr/lib/x86_64-linux-gnu/libapt-private.so.0.0 #28 0x00007fb4d14edc96 in CommandLine::DispatchArg (this=0x7fffda300790, Map=<optimized out>, NoMatch=<optimized out>) at ./apt-pkg/contrib/cmndline.cc:369 #29 0x00007fb4d181240e in DispatchCommandLine(CommandLine&, std::vector<CommandLine::Dispatch, std::allocator<CommandLine::Dispatch> > const&) () from /usr/lib/x86_64-linux-gnu/libapt-private.so.0.0 #30 0x0000561e67d4a766 in ?? () #31 0x00007fb4d0b083f1 in __libc_start_main (main=0x561e67d4a6a0, argc=3, argv=0x7fffda3008e8, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffda3008d8) at ../csu/libc-start.c:291 #32 0x0000561e67d4a86a in ?? ()