Normalize TDLib fatal log lines before hashing - #3374
Open
FrayxRulez wants to merge 1 commit into
Open
Conversation
A LOG(FATAL) line becomes the crash report message, and its thread number, scheduler tag, session index and printed values differ on every crash, so a single assertion is hashed into a group per report. Keep the source location, the actor name and the stringified condition, drop the rest. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When TDLib hits an internal
LOG(FATAL)it aborts, and the log line it printed becomes the crash report's message — which is what the backend hashes. Those lines look like this:Everything volatile in them is in the message: the thread number, the scheduler tag, the datacenter index inside the session actor, and the message/chat/file ids and offsets in the trailing text. So one assertion fragments into a group per report, every group looks like a singleton, and the whole class reads as noise.
TryTranslateTdlibLogfollowsTryTranslateAstaCall: a recogniser that rewrites a line it recognises to a canonical form, and returns the line completely unchanged when it does not match. It matches TDLib's prefix by shape — level, thread,file.ext:line, then any number of context tags — not against a list of known files, so a new assertion normalises without a change here.What it keeps, because it is the identity of the assertion:
crypto.cpp:420),Session:4:download#0→Session:download;downloadis a different code path frommain, the4is only which datacenter the account is on),`id == 0 || is_server()`,[&res != 1]) verbatim, digits included,UserManager.cpp 4821,DialogDb.cpp at line 170) —Status.handLogEvent.hare generic helpers whose real site is that trailing reference, and two sites in one file would otherwise merge.What it drops: the thread and scheduler tags, the actor's instance index, and — the one genuinely arguable call — the numbers and quoted strings left in the free text. Those are the values the assertion happened to print, the file:line above already identifies which assertion failed, and the quoted string is invariably the database path, which carries the user's profile directory into the report.
Checked against every distinct
TdExceptionmessage the dashboard holds for the last 28 days: the rule collapses that set to well under half as many distinct forms, it is idempotent, and it leaves every message of every other error type in that set byte-for-byte unchanged. Note only the first line of a message is hashed, so that is the line this has to get right.Not built. A .NET Native build was not available; the file was checked with
CSharpSyntaxTree.ParseText(...).GetDiagnostics()(clean, so no syntax errors — that catches typos, not type errors), and the four regexes were run as real .NETRegexobjects over the message corpus described above, which is what produced the figures.🤖 Generated with Claude Code