devd icon indicating copy to clipboard operation
devd copied to clipboard

devd doesn't listen if livewatch is specified

Open polm opened this issue 4 years ago • 5 comments

I have devd 0.9 on Arch Linux, installed via the AUR. I usually use devd like this:

devd -a -l -p 8000 ~/site/

After updating devd recently it stopped working; devd would start up but I couldn't connect. I played around with flags and it seems like if I use the -l switch it never starts listening on a port (checked with lsof). The only output is Route / -> reads files from ....

If take away the -l flag it starts listening as usual.

Am I doing something wrong?

polm avatar Apr 24 '20 09:04 polm

Fiddling around more found something strange. The above command doesn't work, but this does:

cd ~/site/
devd -a -l . -p 8000

It seems to consistently work if the path is . but not if it's a directory. When it doesn't work, it also uses 100% CPU.

polm avatar Apr 24 '20 09:04 polm

Maybe run with strace could help see what is going on strace -f devd .... Look for bind failure, going thru lots of files etc

wader avatar Apr 28 '20 00:04 wader

Ah, yeah, it's going through tons of files,

If the directory structure is like this:

/home/person/site

Suppose cwd is /home/person and command is devd -l ./site. I would expect it to only access files in site but it seems to be checking all the files in /home/person.

Is that correct behavior? It seems wrong to me...

polm avatar Apr 28 '20 03:04 polm

Did some digging. I suspect that https://github.com/cortesi/devd/pull/95 caused devd to always add a watch for the current working directory, the ** include pattern i think will make moddatch.Watch add it as base dir.

If you are able to build devd yourself you could try to remove the "***" part and see if it behaves better.

@cortesi Could this be the case? as i understand in the end devd will add recursive watches for all base dirs? will that case lots of file system traversal?

wader avatar Apr 29 '20 00:04 wader

Sorry, I'm not familiar enough with go to build devd. (I was able to install go and run go build but it produced no bianries...?)

polm avatar Apr 29 '20 07:04 polm