-
-
Notifications
You must be signed in to change notification settings - Fork 922
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
File handle leak on OS X #59
Comments
Thanks for reporting this. |
@PieterD I'm looking this on OS X and BSD, but it also fails on Linux: using
|
This would cause a tremendous amount of problems. With my next pull, I've got w.Close waiting until the goroutine is done. That will fix this. |
Excellent. kqueue: |
If Close just removes all watches but the goroutine blocks on something, the goroutines will start heaping up as you keep adding more goroutines, all blocking, all keeping open files. They don't even have to block; if you create the next goroutine without waiting for the last one to finish, you could create a thousand before the first goroutine has a chance to clean up. |
sending done would close w.kq before Remove had a chance to remove the watches with EV_DELETE, resulting in a file handle leak. ref #59 also make Close() report last error returned by Remove.
sending done would close w.kq before Remove had a chance to remove the watches with EV_DELETE, resulting in a file handle leak. ref #59 also make Close() report the first error returned by Remove and abort.
sending done would close w.kq before Remove had a chance to remove the watches with EV_DELETE, resulting in a file handle leak. ref #59 also make Close() report the first error returned by Remove and continue.
Confirmed that https://github.com/go-fsnotify/fsnotify/pull/66 fixes this for inotify. For OS X, I suggest making sure Close waits until the goroutine is stopped before returning. |
Thanks @PieterD. I've already merged a fix for OS X, but I have yet to tag a new release. Tomorrow once the epoll stuff is in. |
any update on linux with this issue? |
The following code quickly runs into a
panic: too many open files
on OS X, even though the documentation says thatClose
removes all watches.The text was updated successfully, but these errors were encountered: