Skip to content

UI: Fix repeated log entries#11706

Open
exeldro wants to merge 1 commit into
obsproject:masterfrom
exeldro:log_repeats
Open

UI: Fix repeated log entries#11706
exeldro wants to merge 1 commit into
obsproject:masterfrom
exeldro:log_repeats

Conversation

@exeldro

@exeldro exeldro commented Jan 6, 2025

Copy link
Copy Markdown
Contributor

Description

too_many_repeated_entries did only detect repeated entries when the format pointer stayed the same.
With this change it also detects repeat entries when the format pointer is not the same, but the contents has the same length and the same sum.

Motivation and Context

ffmpeg_log uses a DStr internal for the format of blogva, because of that the pointer is different every call and too_many_repeated_entries would never detect any repeats.

How Has This Been Tested?

On windows 11 by having a plugin blog multiple the same messages with different format pointers

Types of changes

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • My code has been run through clang-format.
  • I have read the contributing document.
  • My code is not on the master branch.
  • The code has been tested.
  • All commit messages are properly formatted and commits squashed where appropriate.
  • I have included updates to all appropriate documentation.

@PatTheMav

Copy link
Copy Markdown
Member

Wouldn't it be much simpler to bite the bullet and run a simple strncmp on the strings to compare their content? Afaik that's what rsyslog does (it literally just runs string comparison if the string length is the same) and it was added for low-performing systems many years ago (so "performance" of the comparison didn't seem to be an issue).

The given solution has the potential for false positives (as it only looks at length and sum of byte values) and adds more complexity, and seems to make an already convoluted system even more convoluted, whereas a string comparison seems to do exactly what is intended (answering the question "is this message identical to the prior message") and would not require any distinctions between DStr instances or simple const char pointers.

Or is there some special use case that makes using a string comparison not viable here?

@exeldro

exeldro commented Jan 6, 2025

Copy link
Copy Markdown
Contributor Author

For strncmp you would need to keep a copy of the previous log message which also needs to get a free somewhere.
For false positives to have effect with this fix it would need to have 30 (MAX_REPEATED_LINES) false positives in a row. I think the chance of that happening is negligible.

@WizardCM WizardCM added the kind/bug Categorizes issue or PR as related to a bug. label Jan 11, 2025
Comment thread UI/obs-app.cpp Outdated
@exeldro exeldro requested a review from Lain-B January 13, 2025 10:55
@Warchamp7 Warchamp7 added this to the OBS Studio 32.2 milestone May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Categorizes issue or PR as related to a bug.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants