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

fix send buffer (log shipping) out of range panic #2080

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

James-Pickett
Copy link
Contributor

@James-Pickett James-Pickett commented Jan 31, 2025

fixes panic: runtime error: index out of range [x] with length x that can occur in sendBuffer if buffer gets purged while waiting on network call to ship logs

@James-Pickett James-Pickett changed the title test and fix panic fix send buffer (log shipping) out of range panic Jan 31, 2025
@James-Pickett James-Pickett marked this pull request as ready for review January 31, 2025 20:34
RebeccaMahany
RebeccaMahany previously approved these changes Jan 31, 2025
@RebeccaMahany RebeccaMahany added the bug-fixes Bug Fixes label Jan 31, 2025
@James-Pickett James-Pickett added this pull request to the merge queue Jan 31, 2025
@James-Pickett James-Pickett removed this pull request from the merge queue due to a manual request Jan 31, 2025
@James-Pickett James-Pickett added this pull request to the merge queue Jan 31, 2025
@James-Pickett James-Pickett removed this pull request from the merge queue due to a manual request Jan 31, 2025
@@ -30,6 +30,9 @@ type SendBuffer struct {
sender sender
sendTicker *time.Ticker
isSending bool

// logsJustPurged is used to prevent attempting to delete logs that were just purged
logsJustPurged bool
Copy link
Contributor

Choose a reason for hiding this comment

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

is this safe as bool and not atomic.Bool because we think it's adequately protected by the writeMutex? (it seems like it at first glance just wanted to double check)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it's protected by the writeMutex... trying to think of a better way to do this, but I think this will suffice

zackattack01
zackattack01 previously approved these changes Jan 31, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-fixes Bug Fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants