Skip to content

Conversation

giortzisg
Copy link
Contributor

Description

Hotfix for flush only being able to be called once.

@giortzisg giortzisg requested a review from cleptric July 7, 2025 15:37
@giortzisg giortzisg self-assigned this Jul 7, 2025
@giortzisg giortzisg added the Bug Issue type label Jul 7, 2025
cursor[bot]

This comment was marked as outdated.

Copy link

codecov bot commented Jul 7, 2025

Codecov Report

Attention: Patch coverage is 91.48936% with 4 lines in your changes missing coverage. Please review.

Project coverage is 86.86%. Comparing base (221b2ac) to head (49dd461).
Report is 1 commits behind head on master.

Files with missing lines Patch % Lines
batch_logger.go 88.57% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1051      +/-   ##
==========================================
+ Coverage   86.71%   86.86%   +0.15%     
==========================================
  Files          55       55              
  Lines        5804     5840      +36     
==========================================
+ Hits         5033     5073      +40     
+ Misses        629      624       -5     
- Partials      142      143       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

cursor[bot]

This comment was marked as outdated.

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Race Condition in Start and Flush Methods

A race condition exists between the Flush() and Start() methods. If Flush() is called before the run() goroutine (launched by Start()) has started and reached its select statement, the send operation on the unbuffered flushCh will block indefinitely, leading to a deadlock. This occurs because Start() does not wait for the run() goroutine to be ready to receive.

batch_logger.go#L40-L51

func (l *BatchLogger) Flush(timeout <-chan struct{}) {
done := make(chan struct{})
select {
case l.flushCh <- done:
select {
case <-done:
case <-timeout:
}
case <-timeout:
}
}

Fix in CursorFix in Web


Bug: BatchLogger Shutdown Not Triggered on Close

The Client.Close() method fails to shut down the batchLogger's background goroutine, causing a goroutine leak. This occurs because Client.Flush() was modified to no longer terminate the batchLogger, but Client.Close() was not updated to explicitly call client.batchLogger.Shutdown().

client.go#L551-L554

sentry-go/client.go

Lines 551 to 554 in 49dd461

// otherwise some events may be lost.
func (client *Client) Close() {
client.Transport.Close()
}

Fix in CursorFix in Web


Was this report helpful? Give feedback by reacting with 👍 or 👎

@cleptric cleptric merged commit 2668331 into master Jul 7, 2025
18 checks passed
@cleptric cleptric deleted the fix-flush branch July 7, 2025 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Issue type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants