Skip to content

Conversation

zcong1993
Copy link

#2557 go-redis v9 AddHook API cause data race issue.

This pr allow users set hooks in options for NewClient APIs, this will not cause data race. And IMO in most cases, users only need to set up hooks when initialize the client like grpc Dial(WithUnaryInterceptor()), and not need to add hooks dynamically at runtime with AddHook.

fix #2557

@ofekshenawa
Copy link
Collaborator

@zcong1993 Could you please add tests for this issue? This will allow us to continue monitoring it in the future.

DisableIndentity bool

// Hooks are initial hooks in options like AddHook.
Hooks []Hook

Choose a reason for hiding this comment

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

The Hooks array should be validated during initialization to ensure that invalid or nil hooks are not added. This can help prevent runtime issues and maintain the integrity of the client setup.

@ofekshenawa
Copy link
Collaborator

ofekshenawa commented Apr 23, 2025

Solved in #2814

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.

Race detector checking failed for AddHook API in redis v9

3 participants