Skip to content

ZOOKEEPER-4810: Fix buf data race at format_endpoint_info #2140

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
Jun 23, 2025

Conversation

fanyang89
Copy link
Contributor

format_endpoint_info() is widely called in the IO thread. And the some ZOOAPIs will call this method too: zoo_cycle_next_server() and zoo_get_current_server(). These APIs return the same static buffer read/write by IO thread causes data race.

format_endpoint_info() is widely called in the IO thread. And the
some ZOOAPIs will call this method too: zoo_cycle_next_server()
and zoo_get_current_server(). These APIs return the same static buffer
read/write by IO thread causes data race.
@fanyang89 fanyang89 force-pushed the fix-c-client-format-endpoint-race branch from f938c5d to 2357e16 Compare February 20, 2024 09:01
Copy link
Member

@kezhuw kezhuw left a comment

Choose a reason for hiding this comment

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

I built this on linux(gcc/clang) and macos(clang), all succeed.

I lean toward to merge this. If anyone fail to build this on any platforms, s/he could report to us. We could fix it then.

@kezhuw kezhuw requested review from ztzg and anmolnar June 3, 2025 12:51
@kezhuw kezhuw changed the title ZOOKEEPER-4810: Fix buf data race at format_endpoint_info() ZOOKEEPER-4810: Fix buf data race at format_endpoint_info Jun 23, 2025
@kezhuw kezhuw merged commit f6766ec into apache:master Jun 23, 2025
kezhuw pushed a commit that referenced this pull request Jun 23, 2025
ZOOKEEPER-4810: Fix buf data race at format_endpoint_info()
format_endpoint_info() is widely called in the IO thread. And the
some ZOOAPIs will call this method too: zoo_cycle_next_server()
and zoo_get_current_server(). These APIs return the same static buffer
read/write by IO thread causes data race.
Reviewers: kezhuw
Author: fanyang89
Closes #2140 from fanyang89/fix-c-client-format-endpoint-race

(cherry picked from commit f6766ec)
Signed-off-by: Kezhu Wang <[email protected]>
@kezhuw
Copy link
Member

kezhuw commented Jun 23, 2025

Merge and backport to branch-3.9 since it is a bug fix and simple enough.

@fanyang89 Thank you for your contribution!

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.

2 participants