Skip to content

Conversation

@MeredithAnya
Copy link
Member

I updated the GNU Integration in #4598 but I didn't make the path optional so if we didn't have the path included, then the stacktrace didn't get parsed:

# got parsed
"17. DB::TCPHandler::runImpl() @ 0x00000000121bb5d8 in /usr/bin/clickhouse"

# didn't get parsed
"17. DB::TCPHandler::runImpl() @ 0x00000000121bb5d8"

So updated it so that regardless of whether the path is present it will get parsed

@MeredithAnya MeredithAnya requested a review from a team as a code owner August 11, 2025 21:38
@codecov
Copy link

codecov bot commented Aug 11, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.09%. Comparing base (0dc5d43) to head (ffffd4b).
⚠️ Report is 1 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4688      +/-   ##
==========================================
+ Coverage   85.04%   85.09%   +0.05%     
==========================================
  Files         156      156              
  Lines       15858    15859       +1     
  Branches     2684     2684              
==========================================
+ Hits        13486    13496      +10     
+ Misses       1589     1584       -5     
+ Partials      783      779       -4     
Files with missing lines Coverage Δ
sentry_sdk/integrations/gnu_backtrace.py 74.50% <100.00%> (+0.50%) ⬆️

... and 4 files with indirect coverage changes

cursor[bot]

This comment was marked as outdated.

Comment on lines 15 to 18
FUNCTION_RE = r"[^@]+?)\s+@\s+0x[0-9a-fA-F]+"

FRAME_RE = r"""
^(?P<index>\d+)\.\s+(?P<function>{FUNCTION_RE}\s+in\s+(?P<package>.+)$
^(?P<index>\d+)\.\s+(?P<function>{FUNCTION_RE}(?:\s+in\s+(?P<package>.+))?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Potential bug: The `FUNCTION_RE` regex is syntactically incorrect, causing compilation to fail. This silently breaks the entire GNU backtrace integration, preventing stacktrace parsing.
  • Description: The FUNCTION_RE variable contains a malformed regular expression with an unbalanced parenthesis. When this is formatted into the main FRAME_RE, it results in a regex that cannot be compiled by re.compile. Because this compilation happens inside a capture_internal_exceptions() block, the re.error is caught and suppressed. Consequently, the GNU backtrace integration silently fails to parse any backtraces, leading to a complete loss of this debugging functionality without any warning to the user.
  • Suggested fix: The FUNCTION_RE constant is malformed with an extra parenthesis. It should be corrected to r&#x27;[^@]+?&#x27;. Consequently, FRAME_RE must be updated to explicitly include the address pattern (\s+@\s+0x[0-9a-fA-F]+) and correctly close the function capture group, ensuring the final regex is syntactically valid.
    severity: 0.8, confidence: 0.95

Did we get this right? 👍 / 👎 to inform future reviews.

Copy link
Contributor

@sentrivana sentrivana left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@sentrivana sentrivana enabled auto-merge (squash) August 12, 2025 11:14
@sentrivana sentrivana merged commit 775dae8 into master Aug 12, 2025
138 checks passed
@sentrivana sentrivana deleted the meredith/8-11-25 branch August 12, 2025 11:23
MeredithAnya added a commit to getsentry/snuba that referenced this pull request Aug 15, 2025
okay so I had to add a fix
(getsentry/sentry-python#4688) to the earlier
change (getsentry/sentry-python#4598) I made in
the sentry-python sdk.

so now I'm bumping the sentry-sdk to `2.35.0` to grab that fix. I added
the `update_current_span ` convenience funtion that was also in this
release getsentry/sentry-python#4673

**testing:**
going to test this out in S4S first before moving on to de and us
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants