[Ruby] Fix ARM64 server shutdown timeout in Ruby gRPC#41223
Closed
zarinn3pal wants to merge 2 commits into
Closed
Conversation
Member
|
If the actual fix is in Core, lets fix it in Core itself. |
Contributor
Author
|
Added fix on the core: |
copybara-service Bot
pushed a commit
that referenced
this pull request
Apr 24, 2026
…#41510) On ARM64, server shutdown could hang for 20+ minutes due to a memory visibility issue in the C-core completion queue. The shutdown_called flag lacks memory barriers, causing blocked threads to never wake up on ARM's weak memory model. A workaround fix was created for ruby that sent a dummy RPC before shutdown to unblock the completion queue from the I/O side. [41223](#41223). This PR addresses the issue in the core; such that all wrapped languages can reap the benefit; as well as the root cause is addressed. Converted the `shutdown_called` flag from bool to `std::atomic<bool>` in all internal completion queue data structures. This guarantees that the shutdown state transition is atomically visible across threads, preventing race conditions and ensuring the completion queue drains and shuts down correctly on all architectures. The PR addresses the issue skipped in [40770](#40770) Closes #41510 COPYBARA_INTEGRATE_REVIEW=#41510 from zarinn3pal:fix/cc-queue-shutdown 5e23512 PiperOrigin-RevId: 905116782
asheshvidyut
pushed a commit
to a-detiste/grpc
that referenced
this pull request
Jun 10, 2026
…grpc#41510) On ARM64, server shutdown could hang for 20+ minutes due to a memory visibility issue in the C-core completion queue. The shutdown_called flag lacks memory barriers, causing blocked threads to never wake up on ARM's weak memory model. A workaround fix was created for ruby that sent a dummy RPC before shutdown to unblock the completion queue from the I/O side. [41223](grpc#41223). This PR addresses the issue in the core; such that all wrapped languages can reap the benefit; as well as the root cause is addressed. Converted the `shutdown_called` flag from bool to `std::atomic<bool>` in all internal completion queue data structures. This guarantees that the shutdown state transition is atomically visible across threads, preventing race conditions and ensuring the completion queue drains and shuts down correctly on all architectures. The PR addresses the issue skipped in [40770](grpc#40770) Closes grpc#41510 COPYBARA_INTEGRATE_REVIEW=grpc#41510 from zarinn3pal:fix/cc-queue-shutdown 5e23512 PiperOrigin-RevId: 905116782
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On ARM64, server shutdown could hang for 20+ minutes due to a memory visibility issue in the C-core completion queue. The
shutdown_calledflag lacks memory barriers, causing blocked threads to never wake up on ARM's weak memory model.This workaround sends a dummy RPC before shutdown to unblock the completion queue from the I/O side, avoiding C-core changes.
The PR addresses the issue skipped in #40770