segfault on destruction
We recently observed the following stack trace in LHCb:
#0 0x00007fad2e0c1387 in raise () from /lib64/libc.so.6
#1 0x00007fad2e0c2a78 in abort () from /lib64/libc.so.6
#2 0x00007fad2e0ba1a6 in __assert_fail_base () from /lib64/libc.so.6
#3 0x00007fad2e0ba252 in __assert_fail () from /lib64/libc.so.6
#4 0x00007fad10823417 in git_mwindow_put_pack (pack=0x64e3100) at /build/jenkins/workspace/lcg_release_pipeline/build/externals/libgit2-1.1.1/src/libgit2/1.1.1/src/mwindow.c:106
#5 0x00007fad1082ff6d in pack_backend__free (_backend=0x64e2f90) at /build/jenkins/workspace/lcg_release_pipeline/build/externals/libgit2-1.1.1/src/libgit2/1.1.1/src/odb_pack.c:564
#6 0x00007fad10829e20 in odb_free (db=0x62fdd50) at /build/jenkins/workspace/lcg_release_pipeline/build/externals/libgit2-1.1.1/src/libgit2/1.1.1/src/odb.c:691
#7 0x00007fad10829ed8 in git_odb_free (db=0x62fdd50) at /build/jenkins/workspace/lcg_release_pipeline/build/externals/libgit2-1.1.1/src/libgit2/1.1.1/src/odb.c:708
#8 0x00007fad1085eb57 in set_odb (repo=0x62fcd00, odb=0x62fdd50) at /build/jenkins/workspace/lcg_release_pipeline/build/externals/libgit2-1.1.1/src/libgit2/1.1.1/src/repository.c:98
#9 0x00007fad1085ed7c in git_repository__cleanup (repo=0x62fcd00) at /build/jenkins/workspace/lcg_release_pipeline/build/externals/libgit2-1.1.1/src/libgit2/1.1.1/src/repository.c:153
#10 0x00007fad1085edb7 in git_repository_free (repo=0x62fcd00) at /build/jenkins/workspace/lcg_release_pipeline/build/externals/libgit2-1.1.1/src/libgit2/1.1.1/src/repository.c:166
#11 0x00007fad10d3af34 in GitCondDB::Helpers::git_repository_deleter::operator() (ptr=<optimized out>, this=<optimized out>)
at /home/lben/lcg/rpm-recipes/LCG_custom/build/GitCondDB-0.2.0/src/GitCondDB/0.2.0/src/git_helpers.h:28
#12 std::unique_ptr<git_repository, GitCondDB::Helpers::git_repository_deleter>::~unique_ptr (this=0x5d10368, __in_chrg=<optimized out>)
at /home/lben/lcg/rpm-recipes/LCG_custom/install/gcc/11.1.0-e80bf/x86_64-centos7/include/c++/11.1.0/bits/unique_ptr.h:361
#13 GitCondDB::Helpers::git_repository_ptr::~git_repository_ptr (this=0x5d10348, __in_chrg=<optimized out>)
at /home/lben/lcg/rpm-recipes/LCG_custom/build/GitCondDB-0.2.0/src/GitCondDB/0.2.0/src/git_helpers.h:34
#14 GitCondDB::v1::details::GitImpl::~GitImpl (this=0x5d10310, __in_chrg=<optimized out>) at /home/lben/lcg/rpm-recipes/LCG_custom/build/GitCondDB-0.2.0/src/GitCondDB/0.2.0/src/DBImpl.h:119
#15 GitCondDB::v1::details::GitImpl::~GitImpl (this=0x5d10310, __in_chrg=<optimized out>) at /home/lben/lcg/rpm-recipes/LCG_custom/build/GitCondDB-0.2.0/src/GitCondDB/0.2.0/src/DBImpl.h:119
#16 0x00007fad10d35503 in std::default_delete<GitCondDB::v1::details::DBImpl>::operator() (__ptr=<optimized out>, this=<optimized out>)
at /home/lben/lcg/rpm-recipes/LCG_custom/install/gcc/11.1.0-e80bf/x86_64-centos7/include/c++/11.1.0/bits/unique_ptr.h:79
#17 std::unique_ptr<GitCondDB::v1::details::DBImpl, std::default_delete<GitCondDB::v1::details::DBImpl> >::~unique_ptr (this=0x3c7bb08, __in_chrg=<optimized out>)
at /home/lben/lcg/rpm-recipes/LCG_custom/install/gcc/11.1.0-e80bf/x86_64-centos7/include/c++/11.1.0/bits/unique_ptr.h:361
See Detector!148 (comment 5271128)
I suspect an order of deletion mistake.