hdevtools icon indicating copy to clipboard operation
hdevtools copied to clipboard

Don't crash when there is a leftover socket file

Open takano-akio opened this issue 12 years ago • 11 comments

When there is a socket file in the current directly and no server is running, 'hdevtools check' fails with:

hdevtools: bind: resource busy (Address already in use)

takano-akio avatar Feb 15 '13 08:02 takano-akio

I'll have to think about this...

Can you please explain under what circumstances you end up with the leftover socket file? It should usually be automatically deleted when the hdevtools server exits.

bitc avatar Feb 24 '13 19:02 bitc

It mainly happens when I have to kill a hdevtools process with SIGKILL.

takano-akio avatar Mar 07 '13 10:03 takano-akio

The proper way to stop the hdevtools process is to run hdevtools --stop-server

This should make sure that the socket file is cleaned up.

bitc avatar Mar 07 '13 21:03 bitc

Yes, I know that. However when the machine is running out of memory hdevtools --stop-server is often too slow.

Also I believe that the socket file will be left on hard reset of the computer, for example.

takano-akio avatar Mar 07 '13 23:03 takano-akio

I can't say I've been bitten by this, but I think it's best to remove stale socket files because hdevtools could require a kill -9, or it might get killed by something else beyond user control, etc.

lightquake avatar Mar 14 '13 05:03 lightquake

I found this pull request when I encountered the same problem. I do not know how I ended up with the stale socket file, but there it was, so I had to solve the problem some way.

Perhaps the program could at least exit with a more descriptive message about the stale socket file. If the message included the path to the file, it would be completely obvious what the user needs to do to fix the problem.

bmjames avatar Jan 24 '14 13:01 bmjames

I ended up with a leftover .hdevtools.sock file that caused the same error. It may have been caused by a hard-reset. It manifested as vim-hdevtools silently failing to check for errors, which took a bit to track down.

I'd love to see this merged in.

jergason avatar Mar 01 '15 18:03 jergason

I encountered this when running hdevtools inside a Docker container with host volumes mounted into the container. When the container is removed the stale socket remains on the host system.

sgillis avatar May 26 '15 07:05 sgillis

I am constantly removing this socket file to re-check after making changes to included libraries so I don't see the harm in automating it (at least in certain circumstances).

schell avatar May 27 '15 16:05 schell

I'll have to merge this into my branch, @bitc isn't active in this repo as far as I know.

schell avatar May 27 '15 16:05 schell

I've merged this request into my fork and pushed it up to hackage.

schell avatar May 31 '15 17:05 schell