Skip to content

Commit cdb4bb3

Browse files
Add interrupt check.
1 parent e052ad3 commit cdb4bb3

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/ruby/ext/grpc/rb_completion_queue.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,11 @@ grpc_event rb_completion_queue_pluck(grpc_completion_queue* queue, void* tag,
107107
if (next_call.interrupted) {
108108
fprintf(stderr, "[GRPC DEBUG] Loop iteration %d: interrupted=1, checking if signal is pending...\n", loop_count);
109109
fflush(stderr);
110+
// Check if there's actually a signal pending (SIGINT/SIGTERM)
111+
// If rb_thread_check_ints() raises an exception, it means there's a real signal
112+
// If it returns normally, the interruption was spurious and we should retry
113+
rb_thread_check_ints();
114+
// If we get here, interruption was spurious - retry
110115
fprintf(stderr, "[GRPC DEBUG] Loop iteration %d: No signal pending, was spurious, RETRYING\n", loop_count);
111116
fflush(stderr);
112117
}

0 commit comments

Comments
 (0)