From ed957ddf337f1a5794fad8510051e9ae35d8a6bb Mon Sep 17 00:00:00 2001 From: tengel Date: Wed, 20 Mar 2024 11:55:04 -0500 Subject: [PATCH] adding TCP Kill --- TCP-Kill.md | 30 ++++++++++++++++++++++++++++++ _Sidebar.md | 1 + 2 files changed, 31 insertions(+) create mode 100644 TCP-Kill.md diff --git a/TCP-Kill.md b/TCP-Kill.md new file mode 100644 index 0000000..21381a6 --- /dev/null +++ b/TCP-Kill.md @@ -0,0 +1,30 @@ +## Killing a stalled TCP connection + +Requires: kernel >= 4.9 with `CONFIG_INET_DIAG_DESTROY` + +Scenario: subprocess `rclone` has encountered trouble and started to stall out, running at a severely decreased rate of speed + +Task: pause rclone, kill the in-progress TCP connection, resume rclone which will trigger it to (re)create a new, working TCP connection (app dependent) + +### Steps + +Find the process and it's TCP stalled connection: + +``` +$ ps axo pid,comm | grep [r]clone + 6874 rclone + +$ ss -ntp | grep [r]clone | awk '{print $5, $6}' +74.120.9.121:443 users:(("rclone",pid=6874,fd=9)) +``` + +Pause the process, kill the connection (as root), resume the process: + +``` +$ kill -STOP 6874 + +$ sudo ss -K dst 74.120.8.14 dport 443 + +$ kill -CONT 6874 +``` + diff --git a/_Sidebar.md b/_Sidebar.md index bed0751..7d5d226 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -54,6 +54,7 @@ - [[Smem Datamash]] - [[Split Disk]] - [[systemd PID1]] +- [[TCP Kill]] - [[Thunderbird LDAP AD]] - [[uBlock Filters]] - [[udev Hide Partitions]]