Skip to content

Conversation

@ndyakov
Copy link
Member

@ndyakov ndyakov commented Oct 14, 2025

This branch implements support for streaming credentials with automatic re-authentication of pooled Redis connections. The implementation adds a new pool hook system for background re-authentication, introduces a Used flag to prevent concurrent command execution on connections, and integrates with the existing maintenance notifications system.

@ndyakov ndyakov force-pushed the ndyakov/pool-reauth branch from ef20907 to a65a724 Compare October 14, 2025 18:04
@ndyakov ndyakov force-pushed the ndyakov/pool-reauth branch from a65a724 to 5fe0bfa Compare October 14, 2025 18:06
@ndyakov ndyakov force-pushed the ndyakov/pool-reauth branch from c9e9e6c to 8a629fb Compare October 14, 2025 19:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR addresses a concurrency issue where pool re-authentication could interfere with connection handoff operations during maintenance notifications. The fix introduces connection state management using Usable and Used flags to coordinate between background operations (re-authentication) and handoff processes.

Key changes:

  • Added connection-level credentials listener caching to prevent duplicate listeners per connection
  • Introduced Used flag alongside existing Usable flag to prevent concurrent command execution on connections
  • Modified re-authentication flow to wait for connections to be available before proceeding

Reviewed Changes

Copilot reviewed 11 out of 12 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
redis.go Added credentials listener management with caching per connection and modified re-authentication callbacks to accept connection parameter
internal/pool/conn.go Added Used flag and reorganized connection state fields, modified handoff marking logic to acquire connection before state changes
internal/pool/pool.go Updated connection usage tracking with Used flag in pool operations
internal/pool/pool_single.go Added Used flag management for single connection pools
auth/conn_reauth_credentials_listener.go New file implementing connection-aware credentials listener with timeout-based waiting for connection availability
error.go Added ErrConnUnusableTimeout to bad connection error handling
redis_test.go Added mutex protection to mock streaming provider
sentinel_test.go Renamed test function for clarity
internal/pool/pool_test.go Adjusted test expectations for dial retry behavior
maintnotifications/handoff_worker.go Added formatting and clarifying comments
internal/pool/buffer_size_test.go Updated unsafe pointer field layout to match new connection structure

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@ndyakov ndyakov added the bug label Oct 15, 2025
@ndyakov ndyakov requested a review from Copilot October 15, 2025 16:23
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ndyakov ndyakov requested a review from Copilot October 15, 2025 16:28
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 12 out of 13 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ndyakov ndyakov force-pushed the ndyakov/pool-reauth branch from 5f8a0b9 to 0b2baa1 Compare October 17, 2025 09:39
@ndyakov ndyakov force-pushed the ndyakov/pool-reauth branch from 0b2baa1 to acb55d8 Compare October 17, 2025 09:43
@ndyakov ndyakov requested a review from Copilot October 21, 2025 08:27
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 22 out of 23 changed files in this pull request and generated 2 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
In order to improve performance replace `WithAttributes` with `WithAttributeSet`.
This avoids the slice allocation and copy that is done in `WithAttributes`.

For more information see https://github.com/open-telemetry/opentelemetry-go/blob/v1.38.0/metric/instrument.go#L357-L376
)

Co-authored-by: Nedyalko Dyakov <1547186+ndyakov@users.noreply.github.com>
@ndyakov ndyakov requested a review from Copilot October 21, 2025 13:18
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 22 out of 23 changed files in this pull request and generated 4 comments.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link

@jit-ci jit-ci bot left a comment

Choose a reason for hiding this comment

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

❌ Jit has detected 4 important findings in this PR that you should review.
The findings are detailed below as separate comments.
It’s highly recommended that you fix these security issues before merge.

Repository Risks:

  • Database Integration: Connects to a database, often involving sensitive data that must be securely managed.
  • High Severity Findings: Indicates that the resource has high severity security findings that need attention.

Repository Context:

graph LR
    GitHub$Repository_U23_redis/go_U2D_redis["GitHub Repository<br/>redis/go-redis"]:::GitHub$Repository
    Team_U23_client_U2D_developers["Team<br/>client-developers"]:::Team
    Team_U23_client_U2D_docs["Team<br/>client-docs"]:::Team
    DBIntegration_U23_redis["DBIntegration<br/>redis"]:::DBIntegration
    Team_U23_client_U2D_developers -- "Owns" --> GitHub$Repository_U23_redis/go_U2D_redis
    Team_U23_client_U2D_docs -- "Owns" --> GitHub$Repository_U23_redis/go_U2D_redis
    GitHub$Repository_U23_redis/go_U2D_redis -- "Is accessible to" --> DBIntegration_U23_redis
Loading

@ndyakov ndyakov force-pushed the ndyakov/pool-reauth branch from d99ab6b to 1ee5293 Compare October 21, 2025 15:05
Copy link

@jit-ci jit-ci bot left a comment

Choose a reason for hiding this comment

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

❌ Jit has detected 4 important findings in this PR that you should review.
The findings are detailed as separate comments.
It’s highly recommended that you fix these security issues before merge.

Until now, you ignored/fixed 2 findings.

Copy link

@jit-ci jit-ci bot left a comment

Choose a reason for hiding this comment

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

❌ Jit has detected 4 important findings in this PR that you should review.
The findings are detailed as separate comments.
It’s highly recommended that you fix these security issues before merge.

Until now, you ignored/fixed 6 findings.

@ndyakov ndyakov self-assigned this Oct 21, 2025
@ndyakov ndyakov changed the title fix(pool): wip, pool reauth should not interfere with handoff fix(pool): Pool ReAuth should not interfere with handoff Oct 21, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Copilot reviewed 22 out of 23 changed files in this pull request and generated 1 comment.


Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Copy link
Contributor

@htemelski-redis htemelski-redis left a comment

Choose a reason for hiding this comment

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

Overall looks good.
Just one clarifying question

@ndyakov ndyakov merged commit a15e763 into master Oct 22, 2025
37 checks passed
@ndyakov ndyakov deleted the ndyakov/pool-reauth branch October 22, 2025 09:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants