puma 5.0.4 → 5.3.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puma might be problematic. Click here for more details.

Files changed (52) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +175 -48
  3. data/README.md +49 -19
  4. data/docs/architecture.md +22 -18
  5. data/docs/compile_options.md +19 -0
  6. data/docs/deployment.md +2 -2
  7. data/docs/fork_worker.md +2 -0
  8. data/docs/jungle/rc.d/README.md +1 -1
  9. data/docs/kubernetes.md +66 -0
  10. data/docs/plugins.md +2 -2
  11. data/docs/rails_dev_mode.md +29 -0
  12. data/docs/restart.md +1 -1
  13. data/docs/stats.md +142 -0
  14. data/docs/systemd.md +25 -3
  15. data/ext/puma_http11/extconf.rb +18 -5
  16. data/ext/puma_http11/http11_parser.c +45 -47
  17. data/ext/puma_http11/http11_parser.h +1 -1
  18. data/ext/puma_http11/http11_parser.java.rl +1 -1
  19. data/ext/puma_http11/http11_parser.rl +1 -1
  20. data/ext/puma_http11/mini_ssl.c +162 -84
  21. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +5 -7
  22. data/ext/puma_http11/puma_http11.c +8 -2
  23. data/lib/puma/app/status.rb +4 -7
  24. data/lib/puma/binder.rb +87 -43
  25. data/lib/puma/cli.rb +4 -0
  26. data/lib/puma/client.rb +7 -10
  27. data/lib/puma/cluster/worker.rb +8 -2
  28. data/lib/puma/cluster/worker_handle.rb +9 -2
  29. data/lib/puma/cluster.rb +45 -9
  30. data/lib/puma/configuration.rb +15 -1
  31. data/lib/puma/const.rb +12 -4
  32. data/lib/puma/control_cli.rb +75 -70
  33. data/lib/puma/detect.rb +14 -10
  34. data/lib/puma/dsl.rb +122 -22
  35. data/lib/puma/error_logger.rb +12 -5
  36. data/lib/puma/events.rb +18 -3
  37. data/lib/puma/json.rb +96 -0
  38. data/lib/puma/launcher.rb +52 -6
  39. data/lib/puma/minissl/context_builder.rb +6 -0
  40. data/lib/puma/minissl.rb +48 -17
  41. data/lib/puma/null_io.rb +12 -0
  42. data/lib/puma/queue_close.rb +7 -7
  43. data/lib/puma/reactor.rb +19 -12
  44. data/lib/puma/request.rb +28 -10
  45. data/lib/puma/runner.rb +19 -7
  46. data/lib/puma/server.rb +48 -113
  47. data/lib/puma/state_file.rb +5 -3
  48. data/lib/puma/systemd.rb +46 -0
  49. data/lib/puma/thread_pool.rb +4 -3
  50. data/lib/puma.rb +36 -10
  51. data/lib/rack/handler/puma.rb +1 -0
  52. metadata +12 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 88dc01e1628aacb4ee705cc2ab0ecda793913c284737acf93c92674b45a8ec93
4
- data.tar.gz: bcfb46e65dc12b753628656ed7450643a6e6b2a451e2024c872275aa72f28422
3
+ metadata.gz: bcabc9a852bfbed380445b6649ee9e27a2e4741994a27b579e5c4fe94ab6e282
4
+ data.tar.gz: 00ae9ffe82807c9419afaaf955af384f2c87b07914ab36e32c060a83df4075e9
5
5
  SHA512:
6
- metadata.gz: 0b5815aa75f4b0f0af4e8e1a2ecb3f46d7fc9e9c6c9f340f5ee8b4c4f1def02d24736a685520699ed46946557a7b1355ff1df765fd7670fb8ecbbc5d4df5eb64
7
- data.tar.gz: f4294d0f1c811b4e230fa42162be39abab57c6c14d0c2b81a887893a997e8864b3afe9e06c32a2f5185166cfa680b6c1f66c473ef7f839c1430f41248f782793
6
+ metadata.gz: 6a6d4ca8d9ffeea284756f5cc6418b0d6649e360ab5b76bec8db8a6bd6d5cf059957725f3ac50949fd15bc1e54f31c6f50b1b5073cef6814dfca042d84cc04e6
7
+ data.tar.gz: f5ad303fd4d4d3256fa0b20a0d608c2cfdea87901c8c56407420078cac5cd69591a686d12153865855532d0702122d34c80bf60ae4aed1f5ec081d20d3414f7e
data/History.md CHANGED
@@ -1,19 +1,103 @@
1
- ## 5.1.0
1
+ ## 5.3.1 / 2021-05-11
2
+
3
+ * Security
4
+ * Close keepalive connections after the maximum number of fast inlined requests (#2625)
5
+
6
+ ## 5.3.0 / 2021-05-07
2
7
 
3
8
  * Features
4
- * Your feature goes here <Most recent on the top, like GitHub> (#Github Number)
5
- * Integrate with systemd's watchdog and notification features (#2438)
6
- * Adds max_fast_inline as a configuration option for the Server object (#2406)
9
+ * Add support for Linux's abstract sockets ([#2564], [#2526])
10
+ * Add debug to worker timeout and startup ([#2559], [#2528])
11
+ * Print warning when running one-worker cluster ([#2565], [#2534])
12
+ * Don't close systemd activated socket on pumactl restart ([#2563], [#2504])
7
13
 
8
14
  * Bugfixes
9
- * Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
10
- * Ignore illegal (by Rack spec) response header (#2439)
11
- * Close idle connections immediately on shutdown (#2460)
15
+ * systemd - fix event firing ([#2591], [#2572])
16
+ * Immediately unlink temporary files ([#2613])
17
+ * Improve parsing of HTTP_HOST header ([#2605], [#2584])
18
+ * Handle fatal error that has no backtrace ([#2607], [#2552])
19
+ * Fix timing out requests too early ([#2606], [#2574])
20
+ * Handle segfault in Ruby 2.6.6 on thread-locals ([#2567], [#2566])
21
+ * Server#closed_socket? - parameter may be a MiniSSL::Socket ([#2596])
22
+ * Define UNPACK_TCP_STATE_FROM_TCP_INFO in the right place ([#2588], [#2556])
23
+ * request.rb - fix chunked assembly for ascii incompatible encodings, add test ([#2585], [#2583])
24
+
25
+ * Performance
26
+ * Reset peerip only if remote_addr_header is set ([#2609])
27
+ * Reduce puma_parser struct size ([#2590])
28
+
29
+ * Refactor
30
+ * Refactor drain on shutdown ([#2600])
31
+ * Micro optimisations in `wait_for_less_busy_worker` feature ([#2579])
32
+ * Lots of test fixes
33
+
34
+ ## 5.2.2 / 2021-02-22
35
+
36
+ * Bugfixes
37
+ * Add `#flush` and `#sync` methods to `Puma::NullIO` ([#2553])
38
+ * Restore `sync=true` on `STDOUT` and `STDERR` streams ([#2557])
39
+
40
+ ## 5.2.1 / 2021-02-05
41
+
42
+ * Bugfixes
43
+ * Fix TCP cork/uncork operations to work with ssl clients ([#2550])
44
+ * Require rack/common_logger explicitly if :verbose is true ([#2547])
45
+ * MiniSSL::Socket#write - use data.byteslice(wrote..-1) ([#2543])
46
+ * Set `@env[CONTENT_LENGTH]` value as string. ([#2549])
47
+
48
+ ## 5.2.0 / 2021-01-27
49
+
50
+ * Features
51
+ * 10x latency improvement for MRI on ssl connections by reducing overhead ([#2519])
52
+ * Add option to specify the desired IO selector backend for libev ([#2522])
53
+ * Add ability to set OpenSSL verification flags (MRI only) ([#2490])
54
+ * Uses `flush` after writing messages to avoid mutating $stdout and $stderr using `sync=true` ([#2486])
55
+
56
+ * Bugfixes
57
+ * MiniSSL - Update dhparam to 2048 bit for use with SSL_CTX_set_tmp_dh ([#2535])
58
+ * Change 'Goodbye!' message to be output after listeners are closed ([#2529])
59
+ * Fix ssl bind logging with 0.0.0.0 and localhost ([#2533])
60
+ * Fix compiler warnings, but skipped warnings related to ragel state machine generated code ([#1953])
61
+ * Fix phased restart errors related to nio4r gem when using the Puma control server ([#2516])
62
+ * Add `#string` method to `Puma::NullIO` ([#2520])
63
+ * Fix binding via Rack handler to IPv6 addresses ([#2521])
64
+
65
+ * Refactor
66
+ * Refactor MiniSSL::Context on MRI, fix MiniSSL::Socket#write ([#2519])
67
+ * Remove `Server#read_body` ([#2531])
68
+ * Fail build if compiling extensions raises warnings on GH Actions, configurable via `MAKE_WARNINGS_INTO_ERRORS` ([#1953])
69
+
70
+ ## 5.1.1 / 2020-12-10
71
+
72
+ * Bugfixes
73
+ * Fix over eager matching against banned header names ([#2510])
74
+
75
+ ## 5.1.0 / 2020-11-30
76
+
77
+ * Features
78
+ * Phased restart availability is now always logged, even if it is not available.
79
+ * Prints the loaded configuration if the environment variable `PUMA_LOG_CONFIG` is present ([#2472])
80
+ * Integrate with systemd's watchdog and notification features ([#2438])
81
+ * Adds max_fast_inline as a configuration option for the Server object ([#2406])
82
+ * You can now fork workers from worker 0 using SIGURG w/o fork_worker enabled [#2449]
83
+ * Add option to bind to systemd activated sockets ([#2362])
84
+ * Add compile option to change the `QUERY_STRING` max length ([#2485])
85
+
86
+ * Bugfixes
87
+ * Fix JRuby handling in Puma::DSL#ssl_bind ([#2489])
88
+ * control_cli.rb - all normal output should be to @stdout ([#2487])
89
+ * Catch 'Error in reactor loop escaped: mode not supported for this object: r' ([#2477])
90
+ * Ignore Rails' reaper thread (and any thread marked forksafe) for warning ([#2475])
91
+ * Ignore illegal (by Rack spec) response header ([#2439])
92
+ * Close idle connections immediately on shutdown ([#2460])
93
+ * Fix some instances of phased restart errors related to the `json` gem ([#2473])
94
+ * Remove use of `json` gem to fix phased restart errors ([#2479])
95
+ * Fix grouping regexp of ILLEGAL_HEADER_KEY_REGEX ([#2495])
12
96
 
13
97
  ## 5.0.4 / 2020-10-27
14
98
 
15
99
  * Bugfixes
16
- * Pass preloaded application into new workers if available when using `preload_app` (#2461)
100
+ * Pass preloaded application into new workers if available when using `preload_app` ([#2461], [#2454])
17
101
 
18
102
  ## 5.0.3 / 2020-10-26
19
103
 
@@ -21,7 +105,7 @@
21
105
  * Add Client#io_ok?, check before Reactor#register ([#2432])
22
106
  * Fix hang on shutdown in refork ([#2442])
23
107
  * Fix `Bundler::GemNotFound` errors for `nio4r` gem during phased restarts ([#2427], [#2018])
24
- * Server run thread safety fix ([#2435])
108
+ * Server run thread safety fix ([#2435])
25
109
  * Fire `on_booted` after server starts ([#2431], [#2212])
26
110
  * Cleanup daemonization in rc.d script ([#2409])
27
111
 
@@ -33,11 +117,12 @@
33
117
  * client.rb - remove JRuby specific 'finish' code ([#2412])
34
118
  * Consolidate fast_write calls in Server, extract early_hints assembly ([#2405])
35
119
  * Remove upstart from docs ([#2408])
120
+ * Extract worker process into separate class ([#2374])
36
121
  * Consolidate option handling in Server, Server small refactors, doc changes ([#2389])
37
122
 
38
123
  ## 5.0.2 / 2020-09-28
39
124
 
40
- * Bugfixes
125
+ * Bugfixes
41
126
  * Reverted API changes to Server.
42
127
 
43
128
  ## 5.0.1 / 2020-09-28
@@ -76,13 +161,13 @@
76
161
  * min_threads now set by environment variables PUMA_MIN_THREADS and MIN_THREADS. ([#2143])
77
162
  * max_threads now set by environment variables PUMA_MAX_THREADS and MAX_THREADS. ([#2143])
78
163
  * max_threads default to 5 in MRI or 16 for all other interpreters. ([#2143])
79
- * preload by default if workers > 1 ([#2143])
164
+ * `preload_app!` is on by default if number of workers > 1 and set via `WEB_CONCURRENCY` ([#2143])
80
165
  * Puma::Plugin.workers_supported? has been removed. Use Puma.forkable? instead. ([#2143])
81
166
  * `tcp_mode` has been removed without replacement. ([#2169])
82
167
  * Daemonization has been removed without replacement. ([#2170])
83
168
  * Changed #connected_port to #connected_ports ([#2076])
84
169
  * Configuration: `environment` is read from `RAILS_ENV`, if `RACK_ENV` can't be found ([#2022])
85
- * Log binding on http:// for TCP bindings to make it clickable
170
+ * Log binding on http:// for TCP bindings to make it clickable ([#2300])
86
171
 
87
172
  * Bugfixes
88
173
  * Fix JSON loading issues on phased-restarts ([#2269])
@@ -128,6 +213,16 @@
128
213
  * Support parallel tests in verbose progress reporting ([#2223])
129
214
  * Refactor error handling in server accept loop ([#2239])
130
215
 
216
+ ## 4.3.8 / 2021-05-11
217
+
218
+ * Security
219
+ * Close keepalive connections after the maximum number of fast inlined requests (#2625)
220
+
221
+ ## 4.3.7 / 2020-11-30
222
+
223
+ * Bugfixes
224
+ * Backport set CONTENT_LENGTH for chunked requests (Originally: [#2287], backport: [#2496])
225
+
131
226
  ## 4.3.6 / 2020-09-05
132
227
 
133
228
  * Bugfixes
@@ -1651,6 +1746,70 @@ be added back in a future date when a java Puma::MiniSSL is added.
1651
1746
  * Bugfixes
1652
1747
  * Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
1653
1748
 
1749
+ [#2564]:https://github.com/puma/puma/pull/2564 "PR by @MSP-Greg, merged 2021-04-24"
1750
+ [#2526]:https://github.com/puma/puma/issues/2526 "Issue by @nerdrew, closed 2021-04-24"
1751
+ [#2559]:https://github.com/puma/puma/pull/2559 "PR by @ylecuyer, merged 2021-03-11"
1752
+ [#2528]:https://github.com/puma/puma/issues/2528 "Issue by @cjlarose, closed 2021-03-11"
1753
+ [#2565]:https://github.com/puma/puma/pull/2565 "PR by @CGA1123, merged 2021-03-09"
1754
+ [#2534]:https://github.com/puma/puma/issues/2534 "Issue by @nateberkopec, closed 2021-03-09"
1755
+ [#2563]:https://github.com/puma/puma/pull/2563 "PR by @MSP-Greg, merged 2021-03-06"
1756
+ [#2504]:https://github.com/puma/puma/issues/2504 "Issue by @fsateler, closed 2021-03-06"
1757
+ [#2591]:https://github.com/puma/puma/pull/2591 "PR by @MSP-Greg, merged 2021-05-05"
1758
+ [#2572]:https://github.com/puma/puma/issues/2572 "Issue by @josefbilendo, closed 2021-05-05"
1759
+ [#2613]:https://github.com/puma/puma/pull/2613 "PR by @smcgivern, merged 2021-04-27"
1760
+ [#2605]:https://github.com/puma/puma/pull/2605 "PR by @pascalbetz, merged 2021-04-26"
1761
+ [#2584]:https://github.com/puma/puma/issues/2584 "Issue by @kaorihinata, closed 2021-04-26"
1762
+ [#2607]:https://github.com/puma/puma/pull/2607 "PR by @calvinxiao, merged 2021-04-23"
1763
+ [#2552]:https://github.com/puma/puma/issues/2552 "Issue by @feliperaul, opened 2021-02-09"
1764
+ [#2606]:https://github.com/puma/puma/pull/2606 "PR by @wjordan, merged 2021-04-20"
1765
+ [#2574]:https://github.com/puma/puma/issues/2574 "Issue by @darkhelmet, closed 2021-04-20"
1766
+ [#2567]:https://github.com/puma/puma/pull/2567 "PR by @kddeisz, merged 2021-04-19"
1767
+ [#2566]:https://github.com/puma/puma/issues/2566 "Issue by @kddeisz, closed 2021-04-19"
1768
+ [#2596]:https://github.com/puma/puma/pull/2596 "PR by @MSP-Greg, merged 2021-04-18"
1769
+ [#2588]:https://github.com/puma/puma/pull/2588 "PR by @dentarg, merged 2021-04-02"
1770
+ [#2556]:https://github.com/puma/puma/issues/2556 "Issue by @gamecreature, closed 2021-04-02"
1771
+ [#2585]:https://github.com/puma/puma/pull/2585 "PR by @MSP-Greg, merged 2021-03-26"
1772
+ [#2583]:https://github.com/puma/puma/issues/2583 "Issue by @jboler, closed 2021-03-26"
1773
+ [#2609]:https://github.com/puma/puma/pull/2609 "PR by @calvinxiao, merged 2021-04-26"
1774
+ [#2590]:https://github.com/puma/puma/pull/2590 "PR by @calvinxiao, merged 2021-04-05"
1775
+ [#2600]:https://github.com/puma/puma/pull/2600 "PR by @wjordan, merged 2021-04-30"
1776
+ [#2579]:https://github.com/puma/puma/pull/2579 "PR by @ghiculescu, merged 2021-03-17"
1777
+ [#2553]:https://github.com/puma/puma/pull/2553 "PR by @olivierbellone, merged 2021-02-10"
1778
+ [#2557]:https://github.com/puma/puma/pull/2557 "PR by @cjlarose, merged 2021-02-22"
1779
+ [#2550]:https://github.com/puma/puma/pull/2550 "PR by @MSP-Greg, merged 2021-02-05"
1780
+ [#2547]:https://github.com/puma/puma/pull/2547 "PR by @wildmaples, merged 2021-02-03"
1781
+ [#2543]:https://github.com/puma/puma/pull/2543 "PR by @MSP-Greg, merged 2021-02-01"
1782
+ [#2549]:https://github.com/puma/puma/pull/2549 "PR by @nmb, merged 2021-02-04"
1783
+ [#2519]:https://github.com/puma/puma/pull/2519 "PR by @MSP-Greg, merged 2021-01-26"
1784
+ [#2522]:https://github.com/puma/puma/pull/2522 "PR by @jcmfernandes, merged 2021-01-12"
1785
+ [#2490]:https://github.com/puma/puma/pull/2490 "PR by @Bonias, merged 2020-12-07"
1786
+ [#2486]:https://github.com/puma/puma/pull/2486 "PR by @ccverak, merged 2020-12-02"
1787
+ [#2535]:https://github.com/puma/puma/pull/2535 "PR by @MSP-Greg, merged 2021-01-27"
1788
+ [#2529]:https://github.com/puma/puma/pull/2529 "PR by @MSP-Greg, merged 2021-01-24"
1789
+ [#2533]:https://github.com/puma/puma/pull/2533 "PR by @MSP-Greg, merged 2021-01-24"
1790
+ [#1953]:https://github.com/puma/puma/issues/1953 "Issue by @nateberkopec, closed 2020-12-01"
1791
+ [#2516]:https://github.com/puma/puma/pull/2516 "PR by @cjlarose, merged 2020-12-17"
1792
+ [#2520]:https://github.com/puma/puma/pull/2520 "PR by @dentarg, merged 2021-01-04"
1793
+ [#2521]:https://github.com/puma/puma/pull/2521 "PR by @ojab, merged 2021-01-04"
1794
+ [#2531]:https://github.com/puma/puma/pull/2531 "PR by @wjordan, merged 2021-01-19"
1795
+ [#2510]:https://github.com/puma/puma/pull/2510 "PR by @micke, merged 2020-12-10"
1796
+ [#2472]:https://github.com/puma/puma/pull/2472 "PR by @ccverak, merged 2020-11-02"
1797
+ [#2438]:https://github.com/puma/puma/pull/2438 "PR by @ekohl, merged 2020-10-26"
1798
+ [#2406]:https://github.com/puma/puma/pull/2406 "PR by @fdel15, merged 2020-10-19"
1799
+ [#2449]:https://github.com/puma/puma/pull/2449 "PR by @MSP-Greg, merged 2020-10-28"
1800
+ [#2362]:https://github.com/puma/puma/pull/2362 "PR by @ekohl, merged 2020-11-10"
1801
+ [#2485]:https://github.com/puma/puma/pull/2485 "PR by @elct9620, merged 2020-11-18"
1802
+ [#2489]:https://github.com/puma/puma/pull/2489 "PR by @MSP-Greg, merged 2020-11-27"
1803
+ [#2487]:https://github.com/puma/puma/pull/2487 "PR by @MSP-Greg, merged 2020-11-17"
1804
+ [#2477]:https://github.com/puma/puma/pull/2477 "PR by @MSP-Greg, merged 2020-11-16"
1805
+ [#2475]:https://github.com/puma/puma/pull/2475 "PR by @nateberkopec, merged 2020-11-02"
1806
+ [#2439]:https://github.com/puma/puma/pull/2439 "PR by @kuei0221, merged 2020-10-26"
1807
+ [#2460]:https://github.com/puma/puma/pull/2460 "PR by @cjlarose, merged 2020-10-27"
1808
+ [#2473]:https://github.com/puma/puma/pull/2473 "PR by @cjlarose, merged 2020-11-01"
1809
+ [#2479]:https://github.com/puma/puma/pull/2479 "PR by @cjlarose, merged 2020-11-10"
1810
+ [#2495]:https://github.com/puma/puma/pull/2495 "PR by @JuanitoFatas, merged 2020-11-27"
1811
+ [#2461]:https://github.com/puma/puma/pull/2461 "PR by @cjlarose, merged 2020-10-27"
1812
+ [#2454]:https://github.com/puma/puma/issues/2454 "Issue by @majksner, closed 2020-10-27"
1654
1813
  [#2432]:https://github.com/puma/puma/pull/2432 "PR by @MSP-Greg, merged 2020-10-25"
1655
1814
  [#2442]:https://github.com/puma/puma/pull/2442 "PR by @wjordan, merged 2020-10-22"
1656
1815
  [#2427]:https://github.com/puma/puma/pull/2427 "PR by @cjlarose, merged 2020-10-20"
@@ -1666,22 +1825,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
1666
1825
  [#2412]:https://github.com/puma/puma/pull/2412 "PR by @MSP-Greg, merged 2020-10-06"
1667
1826
  [#2405]:https://github.com/puma/puma/pull/2405 "PR by @MSP-Greg, merged 2020-10-05"
1668
1827
  [#2408]:https://github.com/puma/puma/pull/2408 "PR by @fliiiix, merged 2020-10-03"
1669
- [#2389]:https://github.com/puma/puma/pull/2389 "PR by @MSP-Greg, merged 2020-09-29"
1670
- [#2432]:https://github.com/puma/puma/pull/2432 "PR by @MSP-Greg, merged 2020-10-25"
1671
- [#2442]:https://github.com/puma/puma/pull/2442 "PR by @wjordan, merged 2020-10-22"
1672
- [#2427]:https://github.com/puma/puma/pull/2427 "PR by @cjlarose, merged 2020-10-20"
1673
- [#2018]:https://github.com/puma/puma/issues/2018 "Issue by @gingerlime, closed 2020-10-20"
1674
- [#2435]:https://github.com/puma/puma/pull/2435 "PR by @wjordan, merged 2020-10-20"
1675
- [#2431]:https://github.com/puma/puma/pull/2431 "PR by @wjordan, merged 2020-10-16"
1676
- [#2212]:https://github.com/puma/puma/issues/2212 "Issue by @junaruga, closed 2020-10-16"
1677
- [#2409]:https://github.com/puma/puma/pull/2409 "PR by @fliiiix, merged 2020-10-03"
1678
- [#2448]:https://github.com/puma/puma/pull/2448 "PR by @MSP-Greg, merged 2020-10-25"
1679
- [#2450]:https://github.com/puma/puma/pull/2450 "PR by @MSP-Greg, merged 2020-10-25"
1680
- [#2419]:https://github.com/puma/puma/pull/2419 "PR by @MSP-Greg, merged 2020-10-09"
1681
- [#2279]:https://github.com/puma/puma/pull/2279 "PR by @wjordan, merged 2020-10-06"
1682
- [#2412]:https://github.com/puma/puma/pull/2412 "PR by @MSP-Greg, merged 2020-10-06"
1683
- [#2405]:https://github.com/puma/puma/pull/2405 "PR by @MSP-Greg, merged 2020-10-05"
1684
- [#2408]:https://github.com/puma/puma/pull/2408 "PR by @fliiiix, merged 2020-10-03"
1828
+ [#2374]:https://github.com/puma/puma/pull/2374 "PR by @cjlarose, merged 2020-09-29"
1685
1829
  [#2389]:https://github.com/puma/puma/pull/2389 "PR by @MSP-Greg, merged 2020-09-29"
1686
1830
  [#2381]:https://github.com/puma/puma/pull/2381 "PR by @joergschray, merged 2020-09-24"
1687
1831
  [#2271]:https://github.com/puma/puma/pull/2271 "PR by @wjordan, merged 2020-09-24"
@@ -1708,14 +1852,11 @@ be added back in a future date when a java Puma::MiniSSL is added.
1708
1852
  [#2288]:https://github.com/puma/puma/pull/2288 "PR by @FTLam11, merged 2020-06-02"
1709
1853
  [#1487]:https://github.com/puma/puma/pull/1487 "PR by @jxa, merged 2018-05-09"
1710
1854
  [#2143]:https://github.com/puma/puma/pull/2143 "PR by @jalevin, merged 2020-04-21"
1711
- [#2143]:https://github.com/puma/puma/pull/2143 "PR by @jalevin, merged 2020-04-21"
1712
- [#2143]:https://github.com/puma/puma/pull/2143 "PR by @jalevin, merged 2020-04-21"
1713
- [#2143]:https://github.com/puma/puma/pull/2143 "PR by @jalevin, merged 2020-04-21"
1714
- [#2143]:https://github.com/puma/puma/pull/2143 "PR by @jalevin, merged 2020-04-21"
1715
1855
  [#2169]:https://github.com/puma/puma/pull/2169 "PR by @nateberkopec, merged 2020-03-10"
1716
1856
  [#2170]:https://github.com/puma/puma/pull/2170 "PR by @nateberkopec, merged 2020-03-10"
1717
1857
  [#2076]:https://github.com/puma/puma/pull/2076 "PR by @drews256, merged 2020-02-27"
1718
1858
  [#2022]:https://github.com/puma/puma/pull/2022 "PR by @olleolleolle, merged 2019-11-11"
1859
+ [#2300]:https://github.com/puma/puma/pull/2300 "PR by @alexeevit, merged 2020-07-06"
1719
1860
  [#2269]:https://github.com/puma/puma/pull/2269 "PR by @MSP-Greg, merged 2020-08-31"
1720
1861
  [#2312]:https://github.com/puma/puma/pull/2312 "PR by @MSP-Greg, merged 2020-07-20"
1721
1862
  [#2338]:https://github.com/puma/puma/issues/2338 "Issue by @micahhainlinestitchfix, closed 2020-08-18"
@@ -1732,7 +1873,6 @@ be added back in a future date when a java Puma::MiniSSL is added.
1732
1873
  [#2198]:https://github.com/puma/puma/pull/2198 "PR by @eregon, merged 2020-03-24"
1733
1874
  [#2216]:https://github.com/puma/puma/pull/2216 "PR by @praboud-stripe, merged 2020-04-06"
1734
1875
  [#2122]:https://github.com/puma/puma/pull/2122 "PR by @wjordan, merged 2020-04-10"
1735
- [#2220]:https://github.com/puma/puma/pull/2220 "PR by @wjordan, merged 2020-04-14"
1736
1876
  [#2177]:https://github.com/puma/puma/issues/2177 "Issue by @GuiTeK, closed 2020-04-08"
1737
1877
  [#2221]:https://github.com/puma/puma/pull/2221 "PR by @wjordan, merged 2020-04-17"
1738
1878
  [#2233]:https://github.com/puma/puma/pull/2233 "PR by @ayufan, merged 2020-04-25"
@@ -1741,7 +1881,6 @@ be added back in a future date when a java Puma::MiniSSL is added.
1741
1881
  [#2267]:https://github.com/puma/puma/pull/2267 "PR by @wjordan, merged 2020-05-20"
1742
1882
  [#2287]:https://github.com/puma/puma/pull/2287 "PR by @eugeneius, merged 2020-05-31"
1743
1883
  [#2317]:https://github.com/puma/puma/pull/2317 "PR by @MSP-Greg, merged 2020-09-01"
1744
- [#2312]:https://github.com/puma/puma/pull/2312 "PR by @MSP-Greg, merged 2020-07-20"
1745
1884
  [#2319]:https://github.com/puma/puma/issues/2319 "Issue by @AlexWayfer, closed 2020-09-03"
1746
1885
  [#2326]:https://github.com/puma/puma/pull/2326 "PR by @rkistner, closed 2020-09-04"
1747
1886
  [#2299]:https://github.com/puma/puma/issues/2299 "Issue by @JohnPhillips31416, closed 2020-09-17"
@@ -1750,12 +1889,11 @@ be added back in a future date when a java Puma::MiniSSL is added.
1750
1889
  [#2111]:https://github.com/puma/puma/pull/2111 "PR by @wjordan, merged 2020-02-20"
1751
1890
  [#1980]:https://github.com/puma/puma/pull/1980 "PR by @nateberkopec, merged 2020-02-27"
1752
1891
  [#2189]:https://github.com/puma/puma/pull/2189 "PR by @jkowens, merged 2020-03-19"
1753
- [#2220]:https://github.com/puma/puma/pull/2220 "PR by @wjordan, merged 2020-04-14"
1754
1892
  [#2124]:https://github.com/puma/puma/pull/2124 "PR by @wjordan, merged 2020-04-14"
1755
1893
  [#2223]:https://github.com/puma/puma/pull/2223 "PR by @wjordan, merged 2020-04-20"
1756
1894
  [#2239]:https://github.com/puma/puma/pull/2239 "PR by @wjordan, merged 2020-05-15"
1895
+ [#2496]:https://github.com/puma/puma/pull/2496 "PR by @TheRusskiy, merged 2020-11-30"
1757
1896
  [#2304]:https://github.com/puma/puma/issues/2304 "Issue by @mpeltomaa, closed 2020-09-05"
1758
- [#2269]:https://github.com/puma/puma/pull/2269 "PR by @MSP-Greg, merged 2020-08-31"
1759
1897
  [#2132]:https://github.com/puma/puma/issues/2132 "Issue by @bmclean, closed 2020-02-28"
1760
1898
  [#2010]:https://github.com/puma/puma/pull/2010 "PR by @nateberkopec, merged 2019-10-07"
1761
1899
  [#2012]:https://github.com/puma/puma/pull/2012 "PR by @headius, merged 2019-10-07"
@@ -1783,8 +1921,6 @@ be added back in a future date when a java Puma::MiniSSL is added.
1783
1921
  [#1961]:https://github.com/puma/puma/pull/1961 "PR by @nateberkopec, merged 2019-09-11"
1784
1922
  [#1970]:https://github.com/puma/puma/pull/1970 "PR by @MSP-Greg, merged 2019-09-18"
1785
1923
  [#1946]:https://github.com/puma/puma/pull/1946 "PR by @nateberkopec, merged 2019-09-02"
1786
- [#1941]:https://github.com/puma/puma/pull/1941 "PR by @MSP-Greg, merged 2019-09-02"
1787
- [#1908]:https://github.com/puma/puma/pull/1908 "PR by @MSP-Greg, merged 2019-08-23"
1788
1924
  [#1831]:https://github.com/puma/puma/pull/1831 "PR by @spk, merged 2019-07-27"
1789
1925
  [#1816]:https://github.com/puma/puma/pull/1816 "PR by @ylecuyer, merged 2019-08-01"
1790
1926
  [#1844]:https://github.com/puma/puma/pull/1844 "PR by @ylecuyer, merged 2019-08-01"
@@ -1808,7 +1944,6 @@ be added back in a future date when a java Puma::MiniSSL is added.
1808
1944
  [#1872]:https://github.com/puma/puma/pull/1872 "PR by @MSP-Greg, merged 2019-07-30"
1809
1945
  [#1833]:https://github.com/puma/puma/issues/1833 "Issue by @julik, closed 2019-07-09"
1810
1946
  [#1888]:https://github.com/puma/puma/pull/1888 "PR by @ClikeX, merged 2019-08-06"
1811
- [#1842]:https://github.com/puma/puma/issues/1842 "Issue by @nateberkopec, closed 2019-09-18"
1812
1947
  [#1829]:https://github.com/puma/puma/pull/1829 "PR by @Fudoshiki, merged 2019-07-09"
1813
1948
  [#1832]:https://github.com/puma/puma/pull/1832 "PR by @MSP-Greg, merged 2019-07-08"
1814
1949
  [#1827]:https://github.com/puma/puma/pull/1827 "PR by @amrrbakry, merged 2019-06-27"
@@ -1844,7 +1979,6 @@ be added back in a future date when a java Puma::MiniSSL is added.
1844
1979
  [#1604]:https://github.com/puma/puma/pull/1604 "PR by @schneems, merged 2018-07-02"
1845
1980
  [#1579]:https://github.com/puma/puma/pull/1579 "PR by @schneems, merged 2018-06-14"
1846
1981
  [#1506]:https://github.com/puma/puma/pull/1506 "PR by @dekellum, merged 2018-05-09"
1847
- [#1487]:https://github.com/puma/puma/pull/1487 "PR by @jxa, merged 2018-05-09"
1848
1982
  [#1563]:https://github.com/puma/puma/pull/1563 "PR by @dannyfallon, merged 2018-05-01"
1849
1983
  [#1557]:https://github.com/puma/puma/pull/1557 "PR by @swrobel, merged 2018-05-09"
1850
1984
  [#1529]:https://github.com/puma/puma/pull/1529 "PR by @desnudopenguino, merged 2018-03-20"
@@ -1940,11 +2074,6 @@ be added back in a future date when a java Puma::MiniSSL is added.
1940
2074
  [#1138]:https://github.com/puma/puma/pull/1138 "PR by @steakknife, merged 2016-12-13"
1941
2075
  [#1118]:https://github.com/puma/puma/pull/1118 "PR by @hiroara, merged 2016-11-20"
1942
2076
  [#1075]:https://github.com/puma/puma/issues/1075 "Issue by @pvalena, closed 2016-09-06"
1943
- [#1118]:https://github.com/puma/puma/pull/1118 "PR by @hiroara, merged 2016-11-20"
1944
- [#1036]:https://github.com/puma/puma/issues/1036 "Issue by @matobinder, closed 2016-08-03"
1945
- [#1120]:https://github.com/puma/puma/pull/1120 "PR by @prathamesh-sonpatki, merged 2016-11-21"
1946
- [#1002]:https://github.com/puma/puma/issues/1002 "Issue by @mattyb, closed 2016-07-26"
1947
- [#1089]:https://github.com/puma/puma/issues/1089 "Issue by @AdamBialas, closed 2016-09-17"
1948
2077
  [#932]:https://github.com/puma/puma/issues/932 "Issue by @everplays, closed 2016-07-24"
1949
2078
  [#519]:https://github.com/puma/puma/issues/519 "Issue by @tmornini, closed 2016-07-25"
1950
2079
  [#828]:https://github.com/puma/puma/issues/828 "Issue by @Zapotek, closed 2016-07-24"
@@ -1955,7 +2084,6 @@ be added back in a future date when a java Puma::MiniSSL is added.
1955
2084
  [#925]:https://github.com/puma/puma/issues/925 "Issue by @lokenmakwana, closed 2016-07-24"
1956
2085
  [#911]:https://github.com/puma/puma/issues/911 "Issue by @veganstraightedge, closed 2016-07-24"
1957
2086
  [#620]:https://github.com/puma/puma/issues/620 "Issue by @javanthropus, closed 2016-07-25"
1958
- [#1027]:https://github.com/puma/puma/issues/1027 "Issue by @rosenfeld, closed 2016-07-24"
1959
2087
  [#778]:https://github.com/puma/puma/issues/778 "Issue by @niedhui, closed 2016-07-24"
1960
2088
  [#1021]:https://github.com/puma/puma/pull/1021 "PR by @sarahzrf, merged 2016-07-20"
1961
2089
  [#1022]:https://github.com/puma/puma/issues/1022 "Issue by @AKovtunov, closed 2017-08-16"
@@ -1983,7 +2111,6 @@ be added back in a future date when a java Puma::MiniSSL is added.
1983
2111
  [#788]:https://github.com/puma/puma/issues/788 "Issue by @herregroen, closed 2016-04-07"
1984
2112
  [#894]:https://github.com/puma/puma/issues/894 "Issue by @rafbm, closed 2016-04-07"
1985
2113
  [#937]:https://github.com/puma/puma/issues/937 "Issue by @huangxiangdan, closed 2016-04-07"
1986
- [#840]:https://github.com/puma/puma/issues/840 "Issue by @maxkwallace, closed 2016-04-07"
1987
2114
  [#945]:https://github.com/puma/puma/pull/945 "PR by @dekellum, merged 2016-04-07"
1988
2115
  [#946]:https://github.com/puma/puma/pull/946 "PR by @vipulnsward, merged 2016-04-07"
1989
2116
  [#947]:https://github.com/puma/puma/pull/947 "PR by @vipulnsward, merged 2016-04-07"
@@ -2113,7 +2240,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
2113
2240
  [#646]:https://github.com/puma/puma/pull/646 "PR by @mkonecny, merged 2015-02-05"
2114
2241
  [#630]:https://github.com/puma/puma/issues/630 "Issue by @jelmd, closed 2015-01-20"
2115
2242
  [#622]:https://github.com/puma/puma/issues/622 "Issue by @sabamotto, closed 2015-01-20"
2116
- [#583]:https://github.com/puma/puma/issues/583 "Issue by @emq, closed 2015-01-20"
2243
+ [#583]:https://github.com/puma/puma/issues/583 "Issue by @rwojsznis, closed 2015-01-20"
2117
2244
  [#586]:https://github.com/puma/puma/issues/586 "Issue by @ponchik, closed 2015-01-20"
2118
2245
  [#359]:https://github.com/puma/puma/issues/359 "Issue by @natew, closed 2014-12-13"
2119
2246
  [#633]:https://github.com/puma/puma/issues/633 "Issue by @joevandyk, closed 2015-01-20"
data/README.md CHANGED
@@ -16,7 +16,7 @@ Puma is a **simple, fast, multi-threaded, and highly concurrent HTTP 1.1 server
16
16
 
17
17
  Puma processes requests using a C-optimized Ragel extension (inherited from Mongrel) that provides fast, accurate HTTP 1.1 protocol parsing in a portable way. Puma then serves the request using a thread pool. Each request is served in a separate thread, so truly concurrent Ruby implementations (JRuby, Rubinius) will use all available CPU cores.
18
18
 
19
- Puma was designed to be the go-to server for [Rubinius](https://rubinius.com), but also works well with JRuby and MRI.
19
+ Originally designed as a server for [Rubinius](https://github.com/rubinius/rubinius), Puma also works well with Ruby (MRI) and JRuby.
20
20
 
21
21
  On MRI, there is a Global VM Lock (GVL) that ensures only one thread can run Ruby code at a time. But if you're doing a lot of blocking IO (such as HTTP calls to external APIs like Twitter), Puma still improves MRI's throughput by allowing IO waiting to be done in parallel.
22
22
 
@@ -64,20 +64,30 @@ You can run your Sinatra application with Puma from the command line like this:
64
64
  $ ruby app.rb -s Puma
65
65
  ```
66
66
 
67
- Or you can configure your Sinatra application to always use Puma:
67
+ In order to actually configure Puma using a config file, like `puma.rb`, however, you need to use the `puma` executable. To do this, you must add a rackup file to your Sinatra app:
68
68
 
69
69
  ```ruby
70
- require 'sinatra'
71
- configure { set :server, :puma }
70
+ # config.ru
71
+ require './app'
72
+ run Sinatra::Application
73
+ ```
74
+
75
+ You can then start your application using:
76
+
77
+ ```
78
+ $ bundle exec puma
72
79
  ```
73
80
 
74
81
  ## Configuration
75
82
 
76
- Puma provides numerous options. Consult `puma -h` (or `puma --help`) for a full list of CLI options, or see [dsl.rb](https://github.com/puma/puma/blob/master/lib/puma/dsl.rb).
83
+ Puma provides numerous options. Consult `puma -h` (or `puma --help`) for a full list of CLI options, or see `Puma::DSL` or [dsl.rb](https://github.com/puma/puma/blob/master/lib/puma/dsl.rb).
77
84
 
78
85
  You can also find several configuration examples as part of the
79
86
  [test](https://github.com/puma/puma/tree/master/test/config) suite.
80
87
 
88
+ For debugging purposes, you can set the environment variable `PUMA_LOG_CONFIG` with a value
89
+ and the loaded configuration will be printed as part of the boot process.
90
+
81
91
  ### Thread Pool
82
92
 
83
93
  Puma uses a thread pool. You can set the minimum and maximum number of threads that are available in the pool with the `-t` (or `--threads`) flag:
@@ -136,12 +146,12 @@ before_fork do
136
146
  end
137
147
  ```
138
148
 
139
- Preloading can’t be used with phased restart, since phased restart kills and restarts workers one-by-one, and preload_app copies the code of master into the workers.
149
+ Preloading can’t be used with phased restart, since phased restart kills and restarts workers one-by-one, and `preload_app!` copies the code of master into the workers.
140
150
 
141
151
  ### Error handling
142
152
 
143
153
  If puma encounters an error outside of the context of your application, it will respond with a 500 and a simple
144
- textual error message (see `lowlevel_error` in [this file](https://github.com/puma/puma/blob/master/lib/puma/server.rb)).
154
+ textual error message (see `Puma::Server#lowlevel_error` or [server.rb](https://github.com/puma/puma/blob/master/lib/puma/server.rb)).
145
155
  You can specify custom behavior for this scenario. For example, you can report the error to your third-party
146
156
  error-tracking service (in this example, [rollbar](https://rollbar.com)):
147
157
 
@@ -194,7 +204,7 @@ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ssl_cipher_fil
194
204
  $ puma -b 'ssl://127.0.0.1:9292?keystore=path_to_keystore&keystore-pass=keystore_password&ssl_cipher_list=TLS_RSA_WITH_AES_128_CBC_SHA,TLS_RSA_WITH_AES_256_CBC_SHA'
195
205
  ```
196
206
 
197
- See https://www.openssl.org/docs/man1.0.2/apps/ciphers.html for cipher filter format and full list of cipher suites.
207
+ See https://www.openssl.org/docs/man1.1.1/man1/ciphers.html for cipher filter format and full list of cipher suites.
198
208
 
199
209
  Disable TLS v1 with the `no_tlsv1` option:
200
210
 
@@ -202,6 +212,23 @@ Disable TLS v1 with the `no_tlsv1` option:
202
212
  $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&no_tlsv1=true'
203
213
  ```
204
214
 
215
+ #### Controlling OpenSSL Verification Flags
216
+
217
+ To enable verification flags offered by OpenSSL, use `verification_flags` (not available for JRuby):
218
+
219
+ ```
220
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN'
221
+ ```
222
+
223
+ You can also set multiple verification flags (by separating them with coma):
224
+
225
+ ```
226
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN,CRL_CHECK'
227
+ ```
228
+
229
+ List of available flags: `USE_CHECK_TIME`, `CRL_CHECK`, `CRL_CHECK_ALL`, `IGNORE_CRITICAL`, `X509_STRICT`, `ALLOW_PROXY_CERTS`, `POLICY_CHECK`, `EXPLICIT_POLICY`, `INHIBIT_ANY`, `INHIBIT_MAP`, `NOTIFY_POLICY`, `EXTENDED_CRL_SUPPORT`, `USE_DELTAS`, `CHECK_SS_SIGNATURE`, `TRUSTED_FIRST`, `SUITEB_128_LOS_ONLY`, `SUITEB_192_LOS`, `SUITEB_128_LOS`, `PARTIAL_CHAIN`, `NO_ALT_CHAINS`, `NO_CHECK_TIME`
230
+ (see https://www.openssl.org/docs/manmaster/man3/X509_VERIFY_PARAM_set_hostflags.html#VERIFICATION-FLAGS).
231
+
205
232
  ### Control/Status Server
206
233
 
207
234
  Puma has a built-in status and control app that can be used to query and control Puma.
@@ -210,7 +237,7 @@ Puma has a built-in status and control app that can be used to query and control
210
237
  $ puma --control-url tcp://127.0.0.1:9293 --control-token foo
211
238
  ```
212
239
 
213
- Puma will start the control server on localhost port 9293. All requests to the control server will need to include control token (in this case, `token=foo`) as a query parameter. This allows for simple authentication. Check out [status.rb](https://github.com/puma/puma/blob/master/lib/puma/app/status.rb) to see what the status app has available.
240
+ Puma will start the control server on localhost port 9293. All requests to the control server will need to include control token (in this case, `token=foo`) as a query parameter. This allows for simple authentication. Check out `Puma::App::Status` or [status.rb](https://github.com/puma/puma/blob/master/lib/puma/app/status.rb) to see what the status app has available.
214
241
 
215
242
  You can also interact with the control server via `pumactl`. This command will restart Puma:
216
243
 
@@ -228,7 +255,7 @@ You can also provide a configuration file with the `-C` (or `--config`) flag:
228
255
  $ puma -C /path/to/config
229
256
  ```
230
257
 
231
- If no configuration file is specified, Puma will look for a configuration file at `config/puma.rb`. If an environment is specified, either via the `-e` and `--environment` flags, or through the `RACK_ENV` or the `RAILS_ENV` environment variables, Puma looks for configuration at `config/puma/<environment_name>.rb`.
258
+ If no configuration file is specified, Puma will look for a configuration file at `config/puma.rb`. If an environment is specified, either via the `-e` and `--environment` flags, or through the `RACK_ENV` or the `RAILS_ENV` environment variables, Puma first looks for configuration at `config/puma/<environment_name>.rb`, and then falls back to `config/puma.rb`.
232
259
 
233
260
  If you want to prevent Puma from looking for a configuration file in those locations, provide a dash as the argument to the `-C` (or `--config`) flag:
234
261
 
@@ -236,19 +263,19 @@ If you want to prevent Puma from looking for a configuration file in those locat
236
263
  $ puma -C "-"
237
264
  ```
238
265
 
239
- The other side-effects of setting the environment are whether to show stack traces (in `development` or `test`), and setting RACK_ENV may potentially affect middleware looking for this value to change their behavior. The default puma RACK_ENV value is `development`. You can see all config default values [here](https://github.com/puma/puma/blob/12d1706ddc71b89ed2ee26275e31c788e94ff541/lib/puma/configuration.rb#L170).
266
+ The other side-effects of setting the environment are whether to show stack traces (in `development` or `test`), and setting RACK_ENV may potentially affect middleware looking for this value to change their behavior. The default puma RACK_ENV value is `development`. You can see all config default values in `Puma::Configuration#puma_default_options` or [configuration.rb](https://github.com/puma/puma/blob/61c6213fbab/lib/puma/configuration.rb#L182-L204).
240
267
 
241
- Check out [dsl.rb](https://github.com/puma/puma/blob/master/lib/puma/dsl.rb) to see all available options.
268
+ Check out `Puma::DSL` or [dsl.rb](https://github.com/puma/puma/blob/master/lib/puma/dsl.rb) to see all available options.
242
269
 
243
270
  ## Restart
244
271
 
245
272
  Puma includes the ability to restart itself. When available (MRI, Rubinius, JRuby), Puma performs a "hot restart". This is the same functionality available in *Unicorn* and *NGINX* which keep the server sockets open between restarts. This makes sure that no pending requests are dropped while the restart is taking place.
246
273
 
247
- For more, see the [restart documentation](https://github.com/puma/puma/blob/master/docs/restart.md).
274
+ For more, see the [Restart documentation](docs/restart.md).
248
275
 
249
276
  ## Signals
250
277
 
251
- Puma responds to several signals. A detailed guide to using UNIX signals with Puma can be found in the [signals documentation](https://github.com/puma/puma/blob/master/docs/signals.md).
278
+ Puma responds to several signals. A detailed guide to using UNIX signals with Puma can be found in the [Signals documentation](docs/signals.md).
252
279
 
253
280
  ## Platform Constraints
254
281
 
@@ -256,6 +283,7 @@ Some platforms do not support all Puma features.
256
283
 
257
284
  * **JRuby**, **Windows**: server sockets are not seamless on restart, they must be closed and reopened. These platforms have no way to pass descriptors into a new process that is exposed to Ruby. Also, cluster mode is not supported due to a lack of fork(2).
258
285
  * **Windows**: Cluster mode is not supported due to a lack of fork(2).
286
+ * **Kubernetes**: The way Kubernetes handles pod shutdowns interacts poorly with server processes implementing graceful shutdown, like Puma. See the [kubernetes section of the documentation](docs/kubernetes.md) for more details.
259
287
 
260
288
  ## Known Bugs
261
289
 
@@ -278,8 +306,12 @@ It is common to use process monitors with Puma. Modern process monitors like sys
278
306
  provide continuous monitoring and restarts for increased
279
307
  reliability in production environments:
280
308
 
281
- * [docs/jungle](https://github.com/puma/puma/tree/master/docs/jungle) for rc.d
282
- * [docs/systemd](https://github.com/puma/puma/blob/master/docs/systemd.md)
309
+ * [rc.d](docs/jungle/rc.d/README.md)
310
+ * [systemd](docs/systemd.md)
311
+
312
+ Community guides:
313
+
314
+ * [Deploying Puma on OpenBSD using relayd and httpd](https://gist.github.com/anon987654321/4532cf8d6c59c1f43ec8973faa031103)
283
315
 
284
316
  ## Community Extensions
285
317
 
@@ -295,9 +327,7 @@ reliability in production environments:
295
327
 
296
328
  ## Contributing
297
329
 
298
- Find details for contributing in the [contribution guide].
299
-
300
- [contribution guide]: https://github.com/puma/puma/blob/master/CONTRIBUTING.md
330
+ Find details for contributing in the [contribution guide](CONTRIBUTING.md).
301
331
 
302
332
  ## License
303
333
 
data/docs/architecture.md CHANGED
@@ -4,34 +4,38 @@
4
4
 
5
5
  ![https://bit.ly/2iJuFky](images/puma-general-arch.png)
6
6
 
7
- Puma is a threaded web server, processing requests across a TCP or UNIX socket.
7
+ Puma is a threaded Ruby HTTP application server, processing requests across a TCP or UNIX socket.
8
8
 
9
- Workers accept connections from the socket and a thread in the worker's thread pool processes the client's request.
10
9
 
11
- Clustered mode is shown/discussed here. Single mode is analogous to having a single worker process.
10
+ Puma processes (there can be one or many) accept connections from the socket via a thread (in the [`Reactor`](../lib/puma/reactor.rb) class). The connection, once fully buffered and read, moves in to the `todo` list, where it will be picked up by a free/waiting thread in the threadpool (the [`ThreadPool`](../lib/puma/thread_pool.rb) class).
12
11
 
13
- ## Connection pipeline
12
+ Puma works in two main modes: cluster and single. In single mode, only one Puma process is booted. In cluster mode, a `master` process is booted, which prepares (and may boot) the application, and then uses the `fork()` system call to create 1 or more `child` processes. These `child` processes all listen to the same socket. The `master` process does not listen to the socket or process requests - its purpose is mostly to manage and listen for UNIX signals and possibly kill or boot `child` processes.
13
+
14
+ We sometimes call `child` processes (or Puma processes in `single` mode) _workers_, and we sometimes call the threads created by Puma's [`ThreadPool`](../lib/puma/thread_pool.rb) _worker threads_.
15
+
16
+ ## How Requests Work
14
17
 
15
18
  ![https://bit.ly/2zwzhEK](images/puma-connection-flow.png)
16
19
 
17
20
  * Upon startup, Puma listens on a TCP or UNIX socket.
18
- * The backlog of this socket is configured (with a default of 1024), determining how many established but unaccepted connections can exist concurrently.
19
- * This socket backlog is distinct from the "backlog" of work as reported by the control server stats. The latter is the number of connections in that worker's "todo" set waiting for a worker thread.
20
- * By default, a single, separate thread is used to receive HTTP requests across the socket.
21
- * When at least one worker thread is available for work, a connection is accepted and placed in this request buffer
22
- * This thread waits for entire HTTP requests to be received over the connection
23
- * The time spent waiting for the HTTP request body to be received is exposed to the Rack app as `env['puma.request_body_wait']` (milliseconds)
24
- * Once received, the connection is pushed into the "todo" set
25
- * Worker threads pop work off the "todo" set for processing
26
- * The thread processes the request via the rack application (which generates the HTTP response)
27
- * The thread writes the response to the connection
28
- * Finally, the thread become available to process another connection in the "todo" set
29
-
30
- ### Disabling `queue_requests`
21
+ * The backlog of this socket is configured (with a default of 1024). This determines the size of the queue for unaccepted connections. Generally, this setting is unimportant and will never be hit in production use. If the backlog is full, the connection will be refused by the operating system.
22
+ * This socket backlog is distinct from the `backlog` of work as reported by `Puma.stats` or the control server. The backlog as reported by Puma is the number of connections in the process' `todo` set waiting for a thread from the [`ThreadPool`](../lib/puma/thread_pool.rb).
23
+ * By default, a single, separate thread (created by the [`Reactor`](../lib/puma/reactor.rb) class) is used to read and buffer requests from the socket.
24
+ * When at least one worker thread is available for work, the reactor thread listens to the socket and accepts a request, if one is waiting.
25
+ * The reactor thread waits for the entire HTTP request to be received.
26
+ * The time spent waiting for the HTTP request body to be received is exposed to the Rack app as `env['puma.request_body_wait']` (milliseconds).
27
+ * Once fully buffered and received, the connection is pushed into the "todo" set.
28
+ * Worker threads pop work off the "todo" set for processing.
29
+ * The worker thread processes the request via `call`ing the configured Rack application. The Rack application generates the HTTP response.
30
+ * The worker thread writes the response to the connection. Note that while Puma buffers requests via a separate thread, it does not use a separate thread for responses.
31
+ * Once done, the thread become available to process another connection in the "todo" set.
32
+
33
+ ### `queue_requests`
31
34
 
32
35
  ![https://bit.ly/2zxCJ1Z](images/puma-connection-flow-no-reactor.png)
33
36
 
34
- The `queue_requests` option is `true` by default, enabling the separate thread used to buffer requests as described above.
37
+ The `queue_requests` option is `true` by default, enabling the separate reactor thread used to buffer requests as described above.
35
38
 
36
39
  If set to `false`, this buffer will not be used for connections while waiting for the request to arrive.
40
+
37
41
  In this mode, when a connection is accepted, it is added to the "todo" queue immediately, and a worker will synchronously do any waiting necessary to read the HTTP request from the socket.