vagrant-landrush / landrush

A Vagrant plugin that provides a simple DNS server for Vagrant guests
MIT License
668 stars 80 forks source link

landrush.pid not cleared #313

Closed timbeks closed 5 years ago

timbeks commented 7 years ago

Landrush crashed on me once, but can't figure out how or why. But since the crash the vagrant landrush status doesn't work anymore. Even after doing a stop and start. The status will return with:

Daemon status: unknown
/Users/tim/.vagrant.d/data/landrush/run/landrush.pid exists, but process is not running
Check log file: /Users/tim/.vagrant.d/data/landrush/log/landrush.log

However it is running and does work.

LT-49:~ tim$ scutil --dns
resolver #12
  domain   : vagrant.test
  nameserver[0] : 127.0.0.1
  port     : 10053
  flags    : Request A records, Request AAAA records
  reach    : Reachable, Local Address, Directly Reachable Address

LT-49:~ tim$ dig -p 10053 @localhost myhost.vagrant.test

; <<>> DiG 9.8.3-P1 <<>> -p 10053 @localhost myhost.vagrant.test
; (2 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 2810
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;myhost.vagrant.test.       IN  A

;; AUTHORITY SECTION:
.           86384   IN  SOA a.root-servers.net. nstld.verisign-grs.com. 2017041900 1800 900 604800 86400

;; Query time: 14 msec
;; SERVER: 127.0.0.1#10053(127.0.0.1)
;; WHEN: Wed Apr 19 09:16:05 2017
;; MSG SIZE  rcvd: 112

Even after stopping landrush, deleting the landrush.pid file and starting it up again, it still gives the error message. I finally resolved it to change the PID id within the landrush.pid file. Maybe check on start if the PID id is used, if not, write a new one into the pid-file?

To reproduce: change the PID id within the /Users/user/.vagrant.d/data/landrush/run/landrush.pid to something else.

Versions OS: macOS 10.12.4 Landrush: 1.2.0 Vagrant: 1.9.3

hferentschik commented 5 years ago

You have a runaway Landrush process. For some reason, you have a running process occupying the port Landrush port (10053). Since the registered pid is not correct, there is no way to kill the process. Also starting a new one will not work since the port is occupied. The running instance will continue to server requests though. I think this the behaviour you are seeing here.

You would need to locate the process running on port 10053 and kill it manually. On macOS something like the following would give you the needed process pid:

lsof -n -i4TCP:10053 | grep LISTEN