tor process cannot be stopped sometimes
Summary
The process does sometimes not accept kill -15 <pid>
Steps to reproduce:
kill $(cat /run/tor/tor.pid)
has often no effect, whereas
kill -9 $(cat /run/tor/tor.pid)
works every time.
Environment
# tor --version
Tor version 0.4.8.0-alpha-dev (git-a9c7cd6b2c08eed9).
Tor is running on Linux with Libevent 2.1.12-stable, OpenSSL 1.1.1s, Zlib 1.2.13, Liblzma 5.4.1, Libzstd 1.5.2 and Glibc 2.36 as libc.
Tor compiled with GCC version 12.2.1
mr-fox ~ #
This is a hardened stable Gentoo linux:
uname -a
Linux mr-fox 6.1.10 #13 SMP PREEMPT_DYNAMIC Mon Feb 6 19:03:09 UTC 2023 x86_64 AMD Ryzen 9 5950X 16-Core Processor AuthenticAMD GNU/Linux
FWIW I do have 3 Tor processes here running in parallel, often only 1 of them is affected. The only patch on top of git is
mr-fox ~ # cat /etc/portage/patches/net-vpn/tor/tor-tasks-per-cpu.patch
diff --git a/src/core/mainloop/cpuworker.c b/src/core/mainloop/cpuworker.c
index 9ad8939e4d..eaf1f9dee1 100644
--- a/src/core/mainloop/cpuworker.c
+++ b/src/core/mainloop/cpuworker.c
@@ -85,7 +85,7 @@ get_max_pending_tasks_per_cpu(const networkstatus_t *ns)
{
/* Total voodoo. Can we make this more sensible? Maybe, that is why we made it
* a consensus parameter so our future self can figure out this magic. */
-#define MAX_PENDING_TASKS_PER_CPU_DEFAULT 64
+#define MAX_PENDING_TASKS_PER_CPU_DEFAULT 1024
#define MAX_PENDING_TASKS_PER_CPU_MIN 1
#define MAX_PENDING_TASKS_PER_CPU_MAX INT32_MAX
config:
mr-fox ~ # cat /etc/tor/torrc3
# torrc
#
PIDFile /var/run/tor/tor3.pid
DataDirectory /var/lib/tor/data3
OfflineMasterKey 0
Nickname toralf3
Address 65.21.94.13
OutboundBindAddress 65.21.94.13
OutboundBindAddress [2a01:4f9:3b:468e::13]
ORPort 65.21.94.13:8443
ORPort [2a01:4f9:3b:468e::13]:8443
SocksPort 0
ControlPort 127.0.0.1:39051
ControlPort [::1]:39051
MetricsPort 127.0.0.1:39052
MetricsPortPolicy accept 127.0.0.1
#Log info file /tmp/info2.log
Log notice file /var/log/tor/notice3.log
Log warn file /var/log/tor/warn3.log
Log err file /var/log/tor/err3.log
%include /etc/tor/conf.d/
mr-fox ~ # cat /etc/tor/conf.d/00_common
User tor
SandBox 1
#OfflineMasterKey 1
MyFamily 63BF46A63F9C21FD315CD061B3EAA3EB05283A0A,509EAB4C5D10C9A9A24B4EA0CE402C047A2D64E6,4FC26DC244109105AE131628BDB0C84F2D710941
# https://torcontactinfogenerator.netlify.app/
ContactInfo email:toralf.foerster[]gmx.de url:https://zwiebeltoralf.de/ proof:uri-rsa abuse:abuse[]zwiebeltoralf.de gpg:1A376F994A9D026F13E24DCFC4EACDDE0076E94E ciissversion:2
CookieAuthentication 1
# https://stem.torproject.org/tutorials/mirror_mirror_on_the_wall.html
FetchDirInfoEarly 1
FetchDirInfoExtraEarly 1
FetchUselessDescriptors 1
DownloadExtraInfo 1
MetricsPortPolicy accept 127.0.0.1
AvoidDiskWrites 1
ConnDirectionStatistics 1
mr-fox ~ # cat /etc/tor/conf.d/90_reject
ExitPolicy reject *:*