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

Tailviewer may display the same log line multiple times in rare cases #221

Closed
Kittyfisto opened this issue Oct 22, 2019 · 3 comments
Closed
Labels

Comments

@Kittyfisto
Copy link
Owner

Kittyfisto commented Oct 22, 2019

Current behaviour

Under rare circumstances, see below, tailviewer will display certain lines of a log file multiple times in succession. This can appear in various patterns, for example (N, N, N+1, N+2, etc..) or (N, N+1, N, N+1, N+2, etc...).

Expected behaviour

Tailviewer should not artificially duplicate lines and display them as they are in the origin log file.

Steps to reproduce the problem

  1. Create an empty log file
  2. Open the log file in tailviewer
  3. Open the log file in a text editor
  4. Write some lines to the file in the text editor and hit save
  5. Continue the last line written, then add at least two more lines, then hit save
  6. Tailviewer will display the line which was continued in step 5 twice

Workaround

Whenever this problem occurs, changing any filter of the log file will cause the problem to disappear. For example simply toggling (enabling/disabling or vice versa) any non-empty filter will make this problem go away.

@Kittyfisto Kittyfisto added the bug label Oct 22, 2019
@Kittyfisto
Copy link
Owner Author

Kittyfisto commented Oct 22, 2019

This problem currently only occurs when all of the following conditions are met:

  • The log file being displayed is currently being written to
  • The log file contains timestamps which tailviewer is able to parse
  • The log file contains some log levels which tailviewer is able to parse (and others which it cannot)
  • The application writing to the log file writes a single line in multiple parts (i.e. write half of the line, flush, write second half of the line, flush)
  • The line being written in multiple parts does not mention a parseable log level
  • A race occurs where tailviewer is able to read the first half of the line before the application from above manages to write the second half

It is a very rare occurrence so far and has been reported by one colleague so far.

The problem itself is caused by a bug in the FilteredLogFile class and should be able to be solved there.

Kittyfisto added a commit that referenced this issue Oct 23, 2019
This bug was caused by two things:
- MultiLineLogFile which incorrectly classified two successive lines to belong to the same log entry because the second line didn't contain a log level (whereas the first one did), EVEN though both lines had a timestamp
- FilteredLogFile which built upon the previous error and then duplicated lines belonging to this multiline log entry
@Kittyfisto
Copy link
Owner Author

Fixed with v0.9.0

@AdrianEggenberger
Copy link

I have seen this behavior today in release 1.00 RC1. All the criteria from above seem to be given in my case. I have an application that writes log4net data to a text file. The Tailviewer is used to visualize the content with an active filter enabled.

In the duplicated lines even the line number is duplicated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants