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 influxdata/telegraf#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.
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 influxdata/telegraf#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/tailin that program, this probably also applies togithub.com/hpcloud/tail, given thatinfluxdata/tailandhpcloud/tailhave minimal differences and there appear to be no differences in the relevanttailFileSyncfunction.