I've had this issue on several machines. Is there some way to free this blocked port? Here is an example:

Let me explain. I've killed some JAVA-Process on SUSE Linux Enterprise Server 11 SP4, which had some ports open. I used the command "kill -9 " with root user. Now it is not possible to start the process again, because the port is still blocked. The application dies when the port is still open. But the process is definitively gone!

When I have a look with command netstat -anop | grep -E "Sta|37941" (also with root user), I'll get the following results:

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    Timer
tcp        0      0      ESTABLISHED -                   keepalive (2861.75/0/0)

It shows no PID! Before killing the process, it showed the PID of the process. Is there any way to free such a "dead" port? We are always need to restart the operating system to get the application started again. But this is really, really critical in our high-availability systems... so what to do if we need to kill the process in the future? This issue also happened on other unix operating systems in the past.

Any help in solving this issue for the future would be highly appreciated. Thank you all very much in advance!

  • 2
    Are you setting SO_REUSEADDR? Also don't use kill -9, it does not let things clean up.
    – thrig
    Nov 10, 2017 at 0:30
  • This is what @thrig mentioned in his comment above: docs.oracle.com/javase/7/docs/api/java/net/… Nov 10, 2017 at 1:09
  • Is it complaining about port 37941? The line you quote doesn’t indicate that it’s open locally... Nov 10, 2017 at 5:45
  • @StephenKitt The problem is that the OS thinks there's still a process listening on this port. When the JVM is started again it fails, because the port is already "occupied", what means it cannot start listening on that port.The adress is the adress of the host, where the JVM was running and the adress of the host where I tried to start the JVM again.
    – mstrd308
    Nov 13, 2017 at 13:32
  • @thrig I don't know, it is configured as the JVM remote debug port, I don't know how the JVM handles this connections. Btw same thing happened with the JMX port of the JVM. And unfortunately there are some situations, where it is not possible to "clean" stop the process, where it needs to be "hard stopped".
    – mstrd308
    Nov 13, 2017 at 13:32

1 Answer 1


Try it to view which process (include PID) are using the port:

netstat -tupln |grep ":<Your_Port_Here>"

Then kill the PID (nearby process name) normally. Do not use kill command with any parameter.

kill <pid>

Note: Do not vote down if have never tried!

  • 1
    Netstat didn't show any port...
    – mstrd308
    Nov 13, 2017 at 13:33
  • If the command has not show any port then your problem is not port conflict. After start your service or java app, let getback the root process id. When you want kill process (with child processes), use command: kill -9 -s <root_pid>
    – Tech. Pro
    Nov 13, 2017 at 17:27
  • 1
    Yes, having the same issue, netstat is not showing a process id.
    – Soerendip
    May 6, 2021 at 21:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .