-
Notifications
You must be signed in to change notification settings - Fork 504
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
Deadlock when using fsnotify on Windows #54
Comments
What is the full code (the .go file)? Example program can be found here: https://github.com/ActiveState/tail/blob/master/cmd/gotail/gotail.go |
Here the full code, I think it has something to do with fsnotify for windows. With poll = true the problem does not occur. As you see it is much simpeler than your example, I think I implemented it correctly. Below the code also the stacktrace for the go routines. package main
import (
"github.com/ActiveState/tail"
"log"
"regexp"
)
func main() {
t, err := tail.TailFile("path/to/log/file", tail.Config{
Follow: true,
ReOpen: true,
Poll: true, // With poll = true appended the problem does NOT occur, so suspect it has something to do with fsnotify
})
if err != nil {
log.Fatal(err)
}
r, err := regexp.Compile(`regex`)
if err != nil {
log.Println("There is problem with the regexp.")
return
}
for line := range t.Lines {
if r.MatchString(line.Text) == true {
// action
}
}
} Stacktrace:
|
Hi @rubenhazelaar, I have upgraded the version of fsnotify from |
I'm not seeing a deadlock error but I can confirm that with a log file that is not frequently updated (maybe once per second) I am seeing tail stop sending lines after a certain period of time when using Note that this is on Windows. On OS X everything appears to work fine with poll false. |
Hi @mitchellh, thanks for pointing it out. Can you confirm if you have tried this on the latest master, with It is a known issue that I'm currently looking into it. I was hoping updating |
This seems not to be resolved yet. I have just hit the same issue and currently watching the poll options to see if it is happy. |
Hi, I'm new to Go and have written a very simple program to watch some logs (which rotate). However although the program runs fine for some time, eventually it deadlocks with the following message:
The code I'm using looks like this:
I can provide a stacktrace if necessary
BTW: I'm on Windows.
The text was updated successfully, but these errors were encountered: