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

File unexpectedly closes during tailing process #60

Open
asra-eero opened this issue Aug 4, 2023 · 0 comments
Open

File unexpectedly closes during tailing process #60

asra-eero opened this issue Aug 4, 2023 · 0 comments
Labels
bug Something isn't working

Comments

@asra-eero
Copy link

Describe the bug
We have a file that we're tailing where we're also interested in the file offset location. However, when we do t.Tell(), we sometimes run into the exception "err":"seek <filename>: file already closed"

Code:

	t, err := tail.TailFile(
		path,
		tail.Config{
			Follow:   true,
			ReOpen:   true,
		})

	for line := range t.Lines {
		// Fetch the current offset in the tailed file
		offset, err := t.Tell()
		// consume data
        } 

Has anyone else seen a similar issue with the file being closed? We've kind of solved this by adding a small wait and a retry in the t.Tell() function call, and that's resolved the issue, but we'd like to understand if this is a bug in the underlying tailing code where it's prematurely closing files.

System information

  • tail version: v1.4.8
  • OS: Ubuntu: 18.04
@asra-eero asra-eero added the bug Something isn't working label Aug 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant