Dear Maintainer,
bug #1013470 about a nbdkit rebuild failure was reported and it turned
out that this happens because of a crash that happens even in trivial
cases:
,----
| $ server/nbdkit plugins/torrent/.libs/nbdkit-torrent-plugin.so --help
| nbdkit [-4|--ipv4-only] [-6|--ipv6-only]
| [-D|--debug PLUGIN|FILTER|nbdkit.FLAG=N]
| [-e|--exportname EXPORTNAME] [--exit-with-parent]
| [--filter FILTER ...] [-f|--foreground]
| [-g|--group GROUP] [-i|--ipaddr IPADDR]
| [--log stderr|syslog|null]
| [-n|--newstyle] [--mask-handshake MASK] [--no-sr] [-o|--oldstyle]
| [-P|--pidfile PIDFILE]
| [-p|--port PORT] [-r|--readonly]
| [--run CMD] [-s|--single] [--selinux-label LABEL] [--swap]
| [-t|--threads THREADS]
| [--tls off|on|require]
| [--tls-certificates /path/to/certificates]
| [--tls-psk /path/to/pskfile] [--tls-verify-peer]
| [-U|--unix SOCKET] [-u|--user USER]
| [-v|--verbose] [-V|--version] [--vsock]
| PLUGIN [[KEY=]VALUE [KEY=VALUE [...]]]
|
| nbdkit --dump-config
|
| nbdkit PLUGIN --dump-plugin
|
| nbdkit --help
|
| Please read the nbdkit(1) manual page for full usage.
|
| plugin: torrent (nbdkit bittorrent plugin)
| (plugins/torrent/.libs/nbdkit-torrent-plugin.so)
| torrent=<TORRENT> (required) Torrent or magnet link.
| file=DISK.iso File to serve within torrent.
| cache=DIR Set directory to store partial downloads.
| Segmentation fault
`----
From the output, it looks as if the crash occurred on a cleanup code
path.
Downgrading to 2.0.6-3 (before the OpenSSL 3 rebuild) makes the
segmentation fault go away.
The stacktrace below suggests that this is related to cleanup code
registered using atexit(3): pthread_rwlock_wrlock() is called with a
NULL pointer.
,----
| $ gdb --args server/nbdkit plugins/torrent/.libs/nbdkit-torrent-plugin.so --help
| GNU gdb (Debian 12.1-2) 12.1
| Copyright (C) 2022 Free Software Foundation, Inc.
| [...]
| (gdb) run
| Starting program: /home/bengen/p/deb/nbdkit/server/nbdkit plugins/torrent/.libs/nbdkit-torrent-plugin.so --help
| [Thread debugging using libthread_db enabled]
| Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
| nbdkit [-4|--ipv4-only] [-6|--ipv6-only]
| [-D|--debug PLUGIN|FILTER|nbdkit.FLAG=N]
| [...]
| torrent=<TORRENT> (required) Torrent or magnet link.
| file=DISK.iso File to serve within torrent.
| cache=DIR Set directory to store partial downloads.
|
| Program received signal SIGSEGV, Segmentation fault.
| __GI___pthread_rwlock_wrlock (rwlock=0x0) at pthread_rwlock_wrlock.c:27
| 27 pthread_rwlock_wrlock.c: No such file or directory.
| (gdb) bt
| #0 __GI___pthread_rwlock_wrlock (rwlock=0x0) at pthread_rwlock_wrlock.c:27
| #1 0x00007ffff6c8a8e9 in CRYPTO_THREAD_write_lock (lock=<optimized out>) at ../crypto/threads_pthread.c:112
| #2 0x00007ffff6ba7a03 in conf_modules_finish_int () at ../crypto/conf/conf_mod.c:524
| #3 0x00007ffff6ba8132 in CONF_modules_unload (all=1) at ../crypto/conf/conf_mod.c:482
| #4 0x00007ffff726af24 in boost::asio::ssl::detail::openssl_init_base::do_init::~do_init (this=0x55556157dc50, __in_chrg=<optimized out>)
| at /usr/include/boost/asio/ssl/detail/impl/openssl_init.ipp:90
| #5 std::_Sp_counted_ptr<boost::asio::ssl::detail::openssl_init_base::do_init*, (__gnu_cxx::_Lock_policy)2>::_M_dispose (
| this=<optimized out>) at /usr/include/c++/11/bits/shared_ptr_base.h:348
| #6 0x00007ffff726b09a in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release (this=0x55556157db90)
| at /usr/include/c++/11/bits/shared_ptr_base.h:168
| #7 std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count (this=<optimized out>, __in_chrg=<optimized out>)
| at /usr/include/c++/11/bits/shared_ptr_base.h:705
| #8 std::__shared_ptr<boost::asio::ssl::detail::openssl_init_base::do_init, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr (
| this=<optimized out>, __in_chrg=<optimized out>) at /usr/include/c++/11/bits/shared_ptr_base.h:1154
| #9 std::shared_ptr<boost::asio::ssl::detail::openssl_init_base::do_init>::~shared_ptr (this=<optimized out>, __in_chrg=<optimized out>)
| at /usr/include/c++/11/bits/shared_ptr.h:122
| #10 0x00007ffff7bb9f77 in __run_exit_handlers (status=status@entry=0, listp=0x7ffff7d4d738 <__exit_funcs>,
| run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:108
| #11 0x00007ffff7bba11a in __GI_exit (status=status@entry=0) at exit.c:139
| #12 0x000055555555a944 in main (argc=<optimized out>, argv=<optimized out>) at ./server/main.c:678
`----
Cheers,
-Hilko