Skip to content

THRIFT-6438: Name Ruby server threads - #4031

Merged
kpumuk merged 1 commit into
apache:masterfrom
kpumuk:rb-thread-names
Oct 21, 2026
Merged

kpumuk merged 1 commit into
apache:masterfrom
kpumuk:rb-thread-names

Conversation

@kpumuk

@kpumuk kpumuk commented Oct 20, 2026 •

Copy link
Copy Markdown
Member

Ruby server threads appear unnamed in thread dumps, making it difficult to distinguish connection handlers, workers, and server helpers.

Name connection handlers thrift.threaded, pool workers thrift.pool.N, nonblocking workers thrift.nb.N, and helper threads thrift.server, thrift.io, and thrift.shutdown. Worker indexes start at zero for each server run and increase for replacements. Application-owned threads keep their names.

Examples

Live process/thread snapshots from the existing Ruby benchmark. Only workers 0–4 are shown; workers 5–19 are omitted.

ThreadPoolServer

ruby(9269) — ThreadPoolServer
├── {ruby}(9270)
├── {server.rb:88}(9271)
├── {thrift.pool.0}(9272)
├── {thrift.pool.1}(9273)
├── {thrift.pool.2}(9274)
├── {thrift.pool.3}(9275)
└── {thrift.pool.4}(9276)

NonblockingServer

ruby(9355) — NonblockingServer
├── {ruby}(9356)
├── {server.rb:88}(9357)
├── {thrift.io}(9358)
├── {thrift.nb.0}(9359)
├── {thrift.nb.1}(9360)
├── {thrift.nb.2}(9361)
├── {thrift.nb.3}(9362)
└── {thrift.nb.4}(9363)

The server.rb:88 thread is created by the benchmark harness.

  • Did you create an Apache Jira ticket? (Request account here, not required for trivial changes)
  • If a ticket exists: Does your pull request title follow the pattern "THRIFT-NNNN: describe my issue"?
  • Did you squash your changes to a single commit? (not required, but preferred)
  • Did you do your best to avoid breaking changes? If one was needed, did you label the Jira ticket with "Breaking-Change"?
  • If your change does not involve any code, include [skip ci] anywhere in the commit message to free up build resources.

Copilot AI balanced review requested due to automatic review settings October 20, 2026 22:24
@mergeable mergeable Bot added the ruby Pull requests that update Ruby code label Oct 20, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

3 open issues
What changed in this PR

This PR improves Ruby server observability by assigning meaningful names to Apache Thrift Ruby server threads, making thread dumps easier to interpret.

Changes:

  • Name per-connection handler threads for Thrift::ThreadedServer (thrift.threaded).
  • Name Thrift::ThreadPoolServer background server thread (thrift.server) and number worker threads (thrift.pool.N).
  • Name Thrift::NonblockingServer helper threads (thrift.io, thrift.nb.N, thrift.shutdown) and add specs validating naming behavior.
File Description
lib/​rb/​spec/​server_spec.rb Adds thread-naming focused specs and adjusts existing thread stubs to match new Thread.new(arg) usage.
lib/​rb/​lib/​thrift/​server/​threaded_server.rb Names connection handler threads as thrift.threaded.
lib/​rb/​lib/​thrift/​server/​thread_pool_server.rb Names server thread thrift.server and pool workers thrift.pool.N with per-run indexing.
lib/​rb/​lib/​thrift/​server/​nonblocking_server.rb Names nonblocking I/O (thrift.io), worker threads (thrift.nb.N), and async shutdown (thrift.shutdown).

Review effort: Lite

Comment thread lib/rb/lib/thrift/server/threaded_server.rb
Comment thread lib/rb/spec/server_spec.rb
Comment thread lib/rb/spec/server_spec.rb
Copilot AI balanced review requested due to automatic review settings October 20, 2026 23:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Comment thread lib/rb/lib/thrift/server/nonblocking_server.rb
Comment thread lib/rb/lib/thrift/server/nonblocking_server.rb
Comment thread lib/rb/lib/thrift/server/nonblocking_server.rb
Comment thread lib/rb/lib/thrift/server/thread_pool_server.rb
Comment thread lib/rb/lib/thrift/server/thread_pool_server.rb
Comment thread lib/rb/lib/thrift/server/threaded_server.rb
Comment thread lib/rb/spec/server_spec.rb
Comment thread lib/rb/spec/server_spec.rb
Client: rb

Assign dotted role names to threads created by the Ruby servers.
Number pooled workers by creation order within each server run,
including replacement workers, while preserving application thread names.

Co-Authored-By: OpenAI Codex (gpt-6.1-sol) <codex@openai.com>
Copilot AI balanced review requested due to automatic review settings October 21, 2026 02:14

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open issues
9 resolved since last review

Review effort: Lite

Comment thread lib/rb/lib/thrift/server/nonblocking_server.rb
Comment thread lib/rb/lib/thrift/server/thread_pool_server.rb
Comment thread lib/rb/lib/thrift/server/threaded_server.rb
Comment thread lib/rb/spec/server_spec.rb
@kpumuk
kpumuk merged commit d01c127 into apache:master Oct 21, 2026
107 of 109 checks passed
@kpumuk
kpumuk deleted the rb-thread-names branch October 21, 2026 10:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ruby Pull requests that update Ruby code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants