hpcloud / tail

Go package for reading from continously updated files (tail -f)
MIT License
2.7k stars 502 forks source link

tail on file that is regularly written to can fail due to file being locked (on Windows) #157

Open roelandvh opened 4 years ago

roelandvh commented 4 years ago

Tailing a file that gets regularly written to, like Apache log files, can crash with message The process cannot access the file because another process has locked a portion of the file.. This happened on a Windows 10 (version 1903) installation.

Please also see https://github.com/influxdata/telegraf/issues/6539 where I provide more details and steps that I used for reproducing including a minimal Go program that uses just the tail module. Although for reproducing I used github.com/influxdata/tail in that program, this probably also applies to github.com/hpcloud/tail, given that influxdata/tail and hpcloud/tail have minimal differences and there appear to be no differences in the relevant tailFileSync function.