vapor: Address already in use (errno: 98) [closed]

Posted on Nov 22, 2022

Question

I deployed my vapor project to Ubuntu. And made the configuration of supervisor and Nginx.

When I invoke my server. first call is success but When I try second call I get 502 bad gateway error from browser. When I check error log, the error is

"Fatal error: Error raised at top level: bind(descriptor:ptr:bytes:) failed: Address already in use (errno: 98) : file /home/buildnode/jenkins/wo$"

If I kill the port(8080) process. And after, I try to connect again first try is success then get fail again.

What should I do to get rid of this error?

Answer

This might be caused by another process using that port.
I had the same issue and was able to solve it by listing all the processes on port :8080:

$ sudo lsof -i :8080

and then killing all of them one by one by typing:

$ kill {PID of the process}

After that, my app built again properly.


taken from here