My application (WIN32-Delphi-SecureBridge) creates an SSH tunnel to a PostgreSQL database. Sometimes the tunnel is not closed properly and a process is left which I cannot remove programmatically. Below is a screenshot of what it looks like when I want to kill the process. How can I otherwise clear port 5002?
Asked
Active
Viewed 167 times
0
-
After `taskkill` says it can't find the process, if you run `netstat` again, do you still see the same process? The OS doesn't lie about not being able to find a process. – Remy Lebeau Feb 28 '22 at 19:20
-
Yes, netstat sees it all the time. (see, I've replaced the screenshot) – Olaf Feb 28 '22 at 19:28
-
1And, if you go into Task Manager, do you see PID 2876 on the list? Maybe `netstat` is reporting a stale connection from a dead process? – Remy Lebeau Feb 28 '22 at 20:41
-
No, in Task Manager i don't see this PID number – Olaf Feb 28 '22 at 23:09
-
1Well, then `taskkill` is telling the truth when it says the process doesn't exist, and `netstat` (or the underlying OS routing tables) has a bug causing stale data to be left behind. – Remy Lebeau Feb 28 '22 at 23:24