Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Behaviour of watch_file on FreeBSD is different #66

Closed
iblislin opened this issue Dec 13, 2017 · 10 comments · Fixed by #75
Closed

Behaviour of watch_file on FreeBSD is different #66

iblislin opened this issue Dec 13, 2017 · 10 comments · Fixed by #75

Comments

@iblislin
Copy link
Contributor

Revise.jl/src/Revise.jl

Lines 188 to 200 in 5754f39

function watch_files_via_dir(dirname)
watch_file(dirname) # this will block until there is a modification
latestfiles = String[]
wf = watched_files[dirname]
for file in wf.trackedfiles
path = joinpath(dirname, file)
if mtime(path) + 1 >= floor(wf.timestamp) # OSX rounds mtime up, see #22
push!(latestfiles, path)
end
end
updatetime!(wf)
latestfiles
end

On FreeBSD modifying a existed file which located at dir will not being caught by watch_dir(dir).

@timholy
Copy link
Owner

timholy commented Dec 13, 2017

I don't have access to a FreeBSD system, so I might need some help with this one. I did a little reading. Can you check kern.maxfiles? If it's set to a low value then supporting FreeBSD is probably hopeless for anyone who doesn't have root access to their machine to change that setting.

@iblislin
Copy link
Contributor Author

Here is mine

└─[iblis@gungnir]% uname -a
FreeBSD gungnir.nba.nctu.edu.tw 11.1-RELEASE FreeBSD 11.1-RELEASE #0 r321309: Fri Jul 21 02:08:28 UTC 2017     [email protected]:/usr/obj/usr/src/sys/GENERIC  amd64
┌─[~]
| [-- INSERT --]
└─[iblis@gungnir]% sysctl kern.maxfiles
kern.maxfiles: 261113
┌─[~]
| [-- INSERT --]
└─[iblis@gungnir]% sysctl kern.maxfilesperproc
kern.maxfilesperproc: 234999

Different FreeBSD version

└─[iblis@abeing]% uname -a
FreeBSD abeing 12.0-CURRENT FreeBSD 12.0-CURRENT #0 r323335: Sun Sep 17 00:56:35 CST 2017     root@abeing:/usr/obj/usr/src/sys/GENERIC  amd64     
┌─[~/git/TimeSeries]
| [Venv(py36)] [ master] [-- INSERT --]
└─[iblis@abeing]% sysctl kern.maxfiles                                                                                                            
kern.maxfiles: 522683                                                                                                                             
┌─[~/git/TimeSeries]
| [Venv(py36)] [ master] [-- INSERT --]
└─[iblis@abeing]% sysctl kern.maxfilesperproc                                                                                                     
kern.maxfilesperproc: 470412

@timholy
Copy link
Owner

timholy commented Dec 13, 2017

It will be close, but perhaps possible:

~/.julia/v0.6$ find . -type f | wc -l
197127

@iblislin
Copy link
Contributor Author

But the number 197127 is the worst case, right?

@iblislin
Copy link
Contributor Author

└─[iblis@abeing]% find . -type f | wc -l                                 
   67527                            
┌─[~/.julia/v0.6]                   
| [Venv(py36)] [-- INSERT --]       
└─[iblis@abeing]% find . -type f -name '*.jl' | wc -l                                                                                             
    2951

@iblislin
Copy link
Contributor Author

iblislin commented Dec 13, 2017

Here are VM images if you need: https://download.freebsd.org/ftp/releases/VM-IMAGES/

@timholy
Copy link
Owner

timholy commented Dec 13, 2017

But the number 197127 is the worst case, right?

Correct, but I think it applies to all processes on your system. See #26 (comment).

@iblislin
Copy link
Contributor Author

Any clue about implementation?
I can try to implement if you draw the picture of pseudo code.

@iblislin
Copy link
Contributor Author

The days without workspace and reload make me anxious.

@timholy
Copy link
Owner

timholy commented Jan 1, 2018

Sorry, I'm very busy on Julia Base with the push for 0.7-alpha, and didn't notice these pings. Having to first install a VM will also mean this won't be an easy fix for me to make.

This may not be too hard to fix because we used to watch individual files: see #22. You should be able to modify the watching code so that it checks for FreeBSD and if so uses a strategy that's more similar to the original one. I wouldn't try to do some kind of git revert though, because all kinds of stuff changed in between. Just check out the changes in #22 and then see if you can modify the current code accordingly.

I think the code is pretty well commented, but let me know if you have questions.

iblislin added a commit to iblislin/Revise.jl that referenced this issue Jan 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants