Skip to content

fix race condition #7689

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

Merged
merged 1 commit into from
Aug 19, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion rest/utilities_testing_blip_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ func (cd *clientDoc) _proposeChangesEntryForDoc() *proposeChangeBatchEntry {
}
revTreeIDHistory = append(revTreeIDHistory, cd._revisionsBySeq[seq].version.RevTreeID)
}
return &proposeChangeBatchEntry{docID: cd.id, version: latestRev.version, revTreeIDHistory: revTreeIDHistory, hlvHistory: latestRev.HLV, latestServerVersion: cd._latestServerVersion, seq: cd._latestSeq, isDelete: latestRev.isDelete}
return &proposeChangeBatchEntry{docID: cd.id, version: latestRev.version, revTreeIDHistory: revTreeIDHistory, hlvHistory: *latestRev.HLV.Copy(), latestServerVersion: cd._latestServerVersion, seq: cd._latestSeq, isDelete: latestRev.isDelete}
Copy link
Preview

Copilot AI Aug 18, 2025

Choose a reason for hiding this comment

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

The dereferencing of latestRev.HLV.Copy() could lead to a panic if latestRev.HLV is nil. Consider adding a nil check or ensuring Copy() returns a non-nil pointer.

Suggested change
return &proposeChangeBatchEntry{docID: cd.id, version: latestRev.version, revTreeIDHistory: revTreeIDHistory, hlvHistory: *latestRev.HLV.Copy(), latestServerVersion: cd._latestServerVersion, seq: cd._latestSeq, isDelete: latestRev.isDelete}
var hlvCopy db.HybridLogicalVector
if latestRev.HLV != nil {
hlvCopy = *latestRev.HLV.Copy()
} else {
hlvCopy = *db.NewHybridLogicalVector()
}
return &proposeChangeBatchEntry{
docID: cd.id,
version: latestRev.version,
revTreeIDHistory: revTreeIDHistory,
hlvHistory: hlvCopy,
latestServerVersion: cd._latestServerVersion,
seq: cd._latestSeq,
isDelete: latestRev.isDelete,
}

Copilot uses AI. Check for mistakes.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think this is is necessary for testing.

}

// _getLatestHLVCopy returns a copy of the HLV. If there is no document, return an empty HLV.
Expand Down
Loading