Skip to content

Instantly share code, notes, and snippets.

@joeywang
Last active October 15, 2022 11:00
Show Gist options
  • Select an option

  • Save joeywang/bf8f3a772a4c82e013f5d9195abae88e to your computer and use it in GitHub Desktop.

Select an option

Save joeywang/bf8f3a772a4c82e013f5d9195abae88e to your computer and use it in GitHub Desktop.
✗ bin/rails s
=> Booting Puma
=> Rails 7.0.4 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 6.0.0 (ruby 3.1.2-p20) ("Sunflower")
*  Min threads: 5
*  Max threads: 5
*  Environment: development
*          PID: 69589
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000
* Starting control server on http://0.0.0.0:9000
Use Ctrl-C to stop
puma --control-url tcp://127.0.0.1:9293 --control-token foo

https://github.com/puma/puma/blob/master/lib/puma/app/status.rb

export PUMA_AUTH_TOKEN=....

curl http://0.0.0.0:9000/stats\?token\=$PUMA_AUTH_TOKEN
{"started_at":"2022-10-15T10:09:06Z","backlog":0,"running":5,"pool_capacity":5,"max_threads":5,"requests_count":0,"versions":{"puma":"6.0.0","ruby":{"engine":"ruby","version":"3.1.2","patchlevel":20}}

curl http://0.0.0.0:9000/gc-stats\?token\=$PUMA_AUTH_TOKEN
{"count":36,"time":71,"heap_allocated_pages":575,"heap_sorted_length":649,"heap_allocatable_pages":74,"heap_available_slots":234940,"heap_live_slots":234636,"heap_free_slots":304,"heap_final_slots":0,"heap_marked_slots":166767,"heap_eden_pages":575,"heap_tomb_pages":0,"total_allocated_pages":575,"total_freed_pages":0,"total_allocated_objects":604132,"total_freed_objects":369496,"malloc_increase_bytes":10232704,"malloc_increase_bytes_limit":22573741,"minor_gc_count":29,"major_gc_count":7,"compact_count":0,"read_barrier_faults":0,"total_moved_objects":0,"remembered_wb_unprotected_objects":1049,"remembered_wb_unprotected_objects_limit":2098,"old_objects":164927,"old_objects_limit":329854,"oldmalloc_increase_bytes":10232704,"oldmalloc_increase_bytes_limit":24159190}


curl http://0.0.0.0:9000/thread-backtraces\?token\=$PUMA_AUTH_TOKEN
[{"name":"Thread: TID-23k","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/single.rb:61:in `join'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/single.rb:61:in `run'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:186:in `run'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/rack/handler/puma.rb:72:in `run'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/server.rb:327:in `start'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:38:in `start'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:143:in `block in perform'","<internal:kernel>:90:in `tap'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:134:in `perform'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'","bin/rails:4:in `<main>'"]},{"name":"Thread: TID-27g DEBUGGER__::SESSION@server","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:199:in `pop'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:199:in `pop_event'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:203:in `session_server_main'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:174:in `block in activate'"]},{"name":"Thread: TID-8io puma plgn bg 0","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin/tmp_restart.rb:21:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin/tmp_restart.rb:21:in `block in start'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin.rb:68:in `block (2 levels) in fire_background'"]},{"name":"Thread: TID-8j8 puma ctl threadpool reaper","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"]},{"name":"Thread: TID-8js puma ctl threadpool trimmer","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"]},{"name":"Thread: TID-8kc puma ctl","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `select'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `handle_servers'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:251:in `block in run'"]},{"name":"Thread: TID-8kw puma srv tp 001","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `wait'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `block (2 levels) in spawn_thread'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `synchronize'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'"]},{"name":"Thread: TID-8lg puma srv tp 002","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `wait'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `block (2 levels) in spawn_thread'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `synchronize'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'"]},{"name":"Thread: TID-8m0 puma srv tp 003","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `wait'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `block (2 levels) in spawn_thread'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `synchronize'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'"]},{"name":"Thread: TID-8mk puma srv tp 004","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `wait'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `block (2 levels) in spawn_thread'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `synchronize'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'"]},{"name":"Thread: TID-8n4 puma srv tp 005","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `wait'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `block (2 levels) in spawn_thread'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `synchronize'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'"]},{"name":"Thread: TID-8no puma reactor","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/reactor.rb:75:in `select'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/reactor.rb:75:in `select_loop'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/reactor.rb:39:in `block in run'"]},{"name":"Thread: TID-8o8 puma srv threadpool reaper","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"]},{"name":"Thread: TID-8os puma srv threadpool trimmer","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"]},{"name":"Thread: TID-8pc puma srv","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `select'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `handle_servers'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:251:in `block in run'"]},{"name":"Thread: TID-8so puma ctl tp 001","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:224:in `backtrace'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:224:in `block in thread_status'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:220:in `each'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:220:in `thread_status'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/app/status.rb:59:in `call'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:89:in `block in handle_request'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:343:in `with_force_shutdown'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:88:in `handle_request'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:430:in `process_client'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:233:in `block in run'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:150:in `block in spawn_thread'"]}]

{
  "started_at": "2022-10-15T10:09:06Z",
  "backlog": 0,
  "running": 5,
  "pool_capacity": 5,
  "max_threads": 5,
  "requests_count": 0,
  "versions": {
    "puma": "6.0.0",
    "ruby": {
      "engine": "ruby",
      "version": "3.1.2",
      "patchlevel": 20
    }
  }
}
{
  "count": 36,
  "time": 71,
  "heap_allocated_pages": 575,
  "heap_sorted_length": 649,
  "heap_allocatable_pages": 74,
  "heap_available_slots": 234940,
  "heap_live_slots": 234636,
  "heap_free_slots": 304,
  "heap_final_slots": 0,
  "heap_marked_slots": 166767,
  "heap_eden_pages": 575,
  "heap_tomb_pages": 0,
  "total_allocated_pages": 575,
  "total_freed_pages": 0,
  "total_allocated_objects": 604132,
  "total_freed_objects": 369496,
  "malloc_increase_bytes": 10232704,
  "malloc_increase_bytes_limit": 22573741,
  "minor_gc_count": 29,
  "major_gc_count": 7,
  "compact_count": 0,
  "read_barrier_faults": 0,
  "total_moved_objects": 0,
  "remembered_wb_unprotected_objects": 1049,
  "remembered_wb_unprotected_objects_limit": 2098,
  "old_objects": 164927,
  "old_objects_limit": 329854,
  "oldmalloc_increase_bytes": 10232704,
  "oldmalloc_increase_bytes_limit": 24159190
}
[
  {
    "name": "Thread: TID-23k",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/single.rb:61:in `join'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/single.rb:61:in `run'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:186:in `run'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/rack/handler/puma.rb:72:in `run'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/server.rb:327:in `start'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:38:in `start'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:143:in `block in perform'",
      "<internal:kernel>:90:in `tap'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:134:in `perform'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'",
      "bin/rails:4:in `<main>'"
    ]
  },
  {
    "name": "Thread: TID-27g DEBUGGER__::SESSION@server",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:199:in `pop'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:199:in `pop_event'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:203:in `session_server_main'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:174:in `block in activate'"
    ]
  },
  {
    "name": "Thread: TID-8io puma plgn bg 0",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin/tmp_restart.rb:21:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin/tmp_restart.rb:21:in `block in start'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin.rb:68:in `block (2 levels) in fire_background'"
    ]
  },
  {
    "name": "Thread: TID-8j8 puma ctl threadpool reaper",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"
    ]
  },
  {
    "name": "Thread: TID-8js puma ctl threadpool trimmer",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"
    ]
  },
  {
    "name": "Thread: TID-8kc puma ctl",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `select'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `handle_servers'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:251:in `block in run'"
    ]
  },
  {
    "name": "Thread: TID-8kw puma srv tp 001",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `wait'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `block (2 levels) in spawn_thread'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `synchronize'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'"
    ]
  },
  {
    "name": "Thread: TID-8lg puma srv tp 002",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `wait'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `block (2 levels) in spawn_thread'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `synchronize'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'"
    ]
  },
  {
    "name": "Thread: TID-8m0 puma srv tp 003",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `wait'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `block (2 levels) in spawn_thread'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `synchronize'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'"
    ]
  },
  {
    "name": "Thread: TID-8mk puma srv tp 004",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `wait'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `block (2 levels) in spawn_thread'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `synchronize'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'"
    ]
  },
  {
    "name": "Thread: TID-8n4 puma srv tp 005",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `wait'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:136:in `block (2 levels) in spawn_thread'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `synchronize'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'"
    ]
  },
  {
    "name": "Thread: TID-8no puma reactor",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/reactor.rb:75:in `select'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/reactor.rb:75:in `select_loop'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/reactor.rb:39:in `block in run'"
    ]
  },
  {
    "name": "Thread: TID-8o8 puma srv threadpool reaper",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"
    ]
  },
  {
    "name": "Thread: TID-8os puma srv threadpool trimmer",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"
    ]
  },
  {
    "name": "Thread: TID-8pc puma srv",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `select'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `handle_servers'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:251:in `block in run'"
    ]
  },
  {
    "name": "Thread: TID-8so puma ctl tp 001",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:224:in `backtrace'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:224:in `block in thread_status'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:220:in `each'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:220:in `thread_status'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/app/status.rb:59:in `call'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:89:in `block in handle_request'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:343:in `with_force_shutdown'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:88:in `handle_request'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:430:in `process_client'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:233:in `block in run'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:150:in `block in spawn_thread'"
    ]
  }
]
puma --control-url tcp://127.0.0.1:9293 --control-token foo

pumactl --control-url 'tcp://127.0.0.1:9293' --control-token foo restart

Cluster mode

pumactl --control-url 'tcp://127.0.0.1:9000' --control-token $PUMA_AUTH_TOKEN stats
Command stats sent success
{"started_at":"2022-10-15T10:55:35Z","workers":2,"phase":0,"booted_workers":2,"old_workers":0,"worker_status":[{"started_at":"2022-10-15T10:55:35Z","pid":81468,"index":0,"phase":0,"booted":true,"last_checkin":"2022-10-15T10:56:25Z","last_status":{"backlog":0,"running":5,"pool_capacity":5,"max_threads":5,"requests_count":0}},{"started_at":"2022-10-15T10:55:35Z","pid":81469,"index":1,"phase":0,"booted":true,"last_checkin":"2022-10-15T10:56:25Z","last_status":{"backlog":0,"running":5,"pool_capacity":5,"max_threads":5,"requests_count":0}}],"versions":{"puma":"6.0.0","ruby":{"engine":"ruby","version":"3.1.2","patchlevel":20}}}

pumactl --control-url 'tcp://127.0.0.1:9000' --control-token $PUMA_AUTH_TOKEN gc-stats
Command gc-stats sent success
{"count":36,"time":68,"heap_allocated_pages":567,"heap_sorted_length":649,"heap_allocatable_pages":82,"heap_available_slots":231676,"heap_live_slots":231340,"heap_free_slots":336,"heap_final_slots":0,"heap_marked_slots":166738,"heap_eden_pages":567,"heap_tomb_pages":0,"total_allocated_pages":567,"total_freed_pages":0,"total_allocated_objects":600874,"total_freed_objects":369534,"malloc_increase_bytes":10024272,"malloc_increase_bytes_limit":22558510,"minor_gc_count":29,"major_gc_count":7,"compact_count":0,"read_barrier_faults":0,"total_moved_objects":0,"remembered_wb_unprotected_objects":1049,"remembered_wb_unprotected_objects_limit":2098,"old_objects":164900,"old_objects_limit":329800,"oldmalloc_increase_bytes":10024272,"oldmalloc_increase_bytes_limit":24159190}

pumactl --control-url 'tcp://127.0.0.1:9000' --control-token $PUMA_AUTH_TOKEN thread-backtraces
Command thread-backtraces sent success
[{"name":"Thread: TID-23k","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/cluster.rb:440:in `wait_readable'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/cluster.rb:440:in `run'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:186:in `run'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/rack/handler/puma.rb:72:in `run'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/server.rb:327:in `start'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:38:in `start'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:143:in `block in perform'","<internal:kernel>:90:in `tap'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:134:in `perform'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'","bin/rails:4:in `<main>'"]},{"name":"Thread: TID-27g DEBUGGER__::SESSION@server","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:199:in `pop'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:199:in `pop_event'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:203:in `session_server_main'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:174:in `block in activate'"]},{"name":"Thread: TID-8io puma plgn bg 0","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin/tmp_restart.rb:21:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin/tmp_restart.rb:21:in `block in start'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin.rb:68:in `block (2 levels) in fire_background'"]},{"name":"Thread: TID-8j8 puma ctl threadpool reaper","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"]},{"name":"Thread: TID-8js puma ctl threadpool trimmer","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"]},{"name":"Thread: TID-8kc puma ctl","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `select'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `handle_servers'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:251:in `block in run'"]},{"name":"Thread: TID-8m0 puma ctl tp 001","backtrace":["ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:224:in `backtrace'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:224:in `block in thread_status'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:220:in `each'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:220:in `thread_status'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/app/status.rb:59:in `call'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:89:in `block in handle_request'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:343:in `with_force_shutdown'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:88:in `handle_request'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:430:in `process_client'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:233:in `block in run'","ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:150:in `block in spawn_thread'"]}]
{
  "started_at": "2022-10-15T10:55:35Z",
  "workers": 2,
  "phase": 0,
  "booted_workers": 2,
  "old_workers": 0,
  "worker_status": [
    {
      "started_at": "2022-10-15T10:55:35Z",
      "pid": 81468,
      "index": 0,
      "phase": 0,
      "booted": true,
      "last_checkin": "2022-10-15T10:56:25Z",
      "last_status": {
        "backlog": 0,
        "running": 5,
        "pool_capacity": 5,
        "max_threads": 5,
        "requests_count": 0
      }
    },
    {
      "started_at": "2022-10-15T10:55:35Z",
      "pid": 81469,
      "index": 1,
      "phase": 0,
      "booted": true,
      "last_checkin": "2022-10-15T10:56:25Z",
      "last_status": {
        "backlog": 0,
        "running": 5,
        "pool_capacity": 5,
        "max_threads": 5,
        "requests_count": 0
      }
    }
  ],
  "versions": {
    "puma": "6.0.0",
    "ruby": {
      "engine": "ruby",
      "version": "3.1.2",
      "patchlevel": 20
    }
  }
}
{
  "count": 36,
  "time": 68,
  "heap_allocated_pages": 567,
  "heap_sorted_length": 649,
  "heap_allocatable_pages": 82,
  "heap_available_slots": 231676,
  "heap_live_slots": 231340,
  "heap_free_slots": 336,
  "heap_final_slots": 0,
  "heap_marked_slots": 166738,
  "heap_eden_pages": 567,
  "heap_tomb_pages": 0,
  "total_allocated_pages": 567,
  "total_freed_pages": 0,
  "total_allocated_objects": 600874,
  "total_freed_objects": 369534,
  "malloc_increase_bytes": 10024272,
  "malloc_increase_bytes_limit": 22558510,
  "minor_gc_count": 29,
  "major_gc_count": 7,
  "compact_count": 0,
  "read_barrier_faults": 0,
  "total_moved_objects": 0,
  "remembered_wb_unprotected_objects": 1049,
  "remembered_wb_unprotected_objects_limit": 2098,
  "old_objects": 164900,
  "old_objects_limit": 329800,
  "oldmalloc_increase_bytes": 10024272,
  "oldmalloc_increase_bytes_limit": 24159190
}
[
  {
    "name": "Thread: TID-23k",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/cluster.rb:440:in `wait_readable'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/cluster.rb:440:in `run'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:186:in `run'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/rack/handler/puma.rb:72:in `run'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/rack-2.2.4/lib/rack/server.rb:327:in `start'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:38:in `start'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:143:in `block in perform'",
      "<internal:kernel>:90:in `tap'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands/server/server_command.rb:134:in `perform'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/command.rb:27:in `run'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor/invocation.rb:127:in `invoke_command'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/thor-1.2.1/lib/thor.rb:392:in `dispatch'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command/base.rb:87:in `perform'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/command.rb:48:in `invoke'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/railties-7.0.4/lib/rails/commands.rb:18:in `<main>'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/bootsnap-1.13.0/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:32:in `require'",
      "bin/rails:4:in `<main>'"
    ]
  },
  {
    "name": "Thread: TID-27g DEBUGGER__::SESSION@server",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:199:in `pop'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:199:in `pop_event'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:203:in `session_server_main'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/debug-1.6.2/lib/debug/session.rb:174:in `block in activate'"
    ]
  },
  {
    "name": "Thread: TID-8io puma plgn bg 0",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin/tmp_restart.rb:21:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin/tmp_restart.rb:21:in `block in start'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/plugin.rb:68:in `block (2 levels) in fire_background'"
    ]
  },
  {
    "name": "Thread: TID-8j8 puma ctl threadpool reaper",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"
    ]
  },
  {
    "name": "Thread: TID-8js puma ctl threadpool trimmer",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `sleep'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:314:in `block in start!'"
    ]
  },
  {
    "name": "Thread: TID-8kc puma ctl",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `select'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:321:in `handle_servers'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:251:in `block in run'"
    ]
  },
  {
    "name": "Thread: TID-8m0 puma ctl tp 001",
    "backtrace": [
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:224:in `backtrace'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:224:in `block in thread_status'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:220:in `each'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/launcher.rb:220:in `thread_status'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/app/status.rb:59:in `call'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:89:in `block in handle_request'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:343:in `with_force_shutdown'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/request.rb:88:in `handle_request'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:430:in `process_client'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/server.rb:233:in `block in run'",
      "ruby/3.1.2/lib/ruby/gems/3.1.0/gems/puma-6.0.0/lib/puma/thread_pool.rb:150:in `block in spawn_thread'"
    ]
  }
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment