puma 6.0.2 → 6.4.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (84) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +213 -7
  3. data/LICENSE +0 -0
  4. data/README.md +59 -13
  5. data/bin/puma-wild +0 -0
  6. data/docs/architecture.md +0 -0
  7. data/docs/compile_options.md +0 -0
  8. data/docs/deployment.md +0 -0
  9. data/docs/fork_worker.md +0 -0
  10. data/docs/images/puma-connection-flow-no-reactor.png +0 -0
  11. data/docs/images/puma-connection-flow.png +0 -0
  12. data/docs/images/puma-general-arch.png +0 -0
  13. data/docs/jungle/README.md +0 -0
  14. data/docs/jungle/rc.d/README.md +0 -0
  15. data/docs/jungle/rc.d/puma.conf +0 -0
  16. data/docs/kubernetes.md +12 -0
  17. data/docs/nginx.md +0 -0
  18. data/docs/plugins.md +0 -0
  19. data/docs/rails_dev_mode.md +0 -0
  20. data/docs/restart.md +1 -0
  21. data/docs/signals.md +0 -0
  22. data/docs/stats.md +0 -0
  23. data/docs/systemd.md +3 -6
  24. data/docs/testing_benchmarks_local_files.md +0 -0
  25. data/docs/testing_test_rackup_ci_files.md +0 -0
  26. data/ext/puma_http11/PumaHttp11Service.java +0 -0
  27. data/ext/puma_http11/ext_help.h +0 -0
  28. data/ext/puma_http11/extconf.rb +5 -1
  29. data/ext/puma_http11/http11_parser.c +0 -0
  30. data/ext/puma_http11/http11_parser.h +0 -0
  31. data/ext/puma_http11/http11_parser.java.rl +0 -0
  32. data/ext/puma_http11/http11_parser.rl +0 -0
  33. data/ext/puma_http11/http11_parser_common.rl +0 -0
  34. data/ext/puma_http11/mini_ssl.c +96 -9
  35. data/ext/puma_http11/no_ssl/PumaHttp11Service.java +0 -0
  36. data/ext/puma_http11/org/jruby/puma/Http11.java +0 -0
  37. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +0 -0
  38. data/ext/puma_http11/org/jruby/puma/MiniSSL.java +2 -1
  39. data/ext/puma_http11/puma_http11.c +0 -0
  40. data/lib/puma/app/status.rb +1 -1
  41. data/lib/puma/binder.rb +14 -11
  42. data/lib/puma/cli.rb +5 -1
  43. data/lib/puma/client.rb +77 -16
  44. data/lib/puma/cluster/worker.rb +5 -0
  45. data/lib/puma/cluster/worker_handle.rb +0 -0
  46. data/lib/puma/cluster.rb +71 -10
  47. data/lib/puma/commonlogger.rb +21 -14
  48. data/lib/puma/configuration.rb +6 -4
  49. data/lib/puma/const.rb +58 -9
  50. data/lib/puma/control_cli.rb +12 -5
  51. data/lib/puma/detect.rb +5 -4
  52. data/lib/puma/dsl.rb +157 -7
  53. data/lib/puma/error_logger.rb +2 -1
  54. data/lib/puma/events.rb +0 -0
  55. data/lib/puma/io_buffer.rb +0 -0
  56. data/lib/puma/jruby_restart.rb +0 -0
  57. data/lib/puma/json_serialization.rb +0 -0
  58. data/lib/puma/launcher/bundle_pruner.rb +0 -0
  59. data/lib/puma/launcher.rb +9 -22
  60. data/lib/puma/log_writer.rb +14 -4
  61. data/lib/puma/minissl/context_builder.rb +3 -0
  62. data/lib/puma/minissl.rb +22 -0
  63. data/lib/puma/null_io.rb +16 -2
  64. data/lib/puma/plugin/systemd.rb +90 -0
  65. data/lib/puma/plugin/tmp_restart.rb +0 -0
  66. data/lib/puma/plugin.rb +0 -0
  67. data/lib/puma/rack/builder.rb +2 -2
  68. data/lib/puma/rack/urlmap.rb +1 -1
  69. data/lib/puma/rack_default.rb +18 -3
  70. data/lib/puma/reactor.rb +16 -7
  71. data/lib/puma/request.rb +91 -64
  72. data/lib/puma/runner.rb +13 -2
  73. data/lib/puma/sd_notify.rb +149 -0
  74. data/lib/puma/server.rb +91 -27
  75. data/lib/puma/single.rb +2 -0
  76. data/lib/puma/state_file.rb +2 -2
  77. data/lib/puma/thread_pool.rb +41 -3
  78. data/lib/puma/util.rb +0 -0
  79. data/lib/puma.rb +0 -0
  80. data/lib/rack/handler/puma.rb +113 -86
  81. data/tools/Dockerfile +2 -2
  82. data/tools/trickletest.rb +0 -0
  83. metadata +5 -4
  84. data/lib/puma/systemd.rb +0 -47
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 83bb232727e7777f406dcacc150db80426972c1e65635f1d81d771fee3585060
4
- data.tar.gz: 16453cd88384851586d3ff6bc274393b44a6a078eaec9932cac795009fc342fb
3
+ metadata.gz: d4eec1c88853ffbaadba238d829879c8a47f6a553ed6ce97fcfdc20f70e9cb16
4
+ data.tar.gz: 4ecd30023954ae7bc18d89e28875371687b54c41a3bd3e62b396039614089e38
5
5
  SHA512:
6
- metadata.gz: ce357b7686a54c2d0e820d70f24bb427803ba9e7aa24a8b0511624dc4ef850e937b9261575462d6a20a0c69f73d1fefa939a242d8e3e5e9577fdd4e45a862af2
7
- data.tar.gz: 3d9fda444a65d5917872261ff4dff8f3e156aec8a1d06d72cc19201da8f820b0262baac73665bb062355966a8d9415ed5b92d01f4c8ad6e312737141c657e823
6
+ metadata.gz: 98451682f4e6bc79dc1336f7ee4d7b702b13b0c9cd0f99e4a3aeca37c96ea096401c43cda5402ec9a4af25fc4f5d7d15da8d6157ad957f3128586e022cabc263
7
+ data.tar.gz: c5e6aaf5d405e57a6b47df3be3c52c5b006c1160b5c90d2a549d25e731ea44b6ad1828ceffb1e4791ceea66eef0f07718dbee76b17a1db272a4ed79a6ff3ff53
data/History.md CHANGED
@@ -1,3 +1,119 @@
1
+ ## 6.4.2 / 2024-01-08
2
+
3
+ * Security
4
+ * Limit the size of chunk extensions. Without this limit, an attacker could cause unbounded resource (CPU, network bandwidth) consumption. ([GHSA-c2f4-cvqm-65w2](https://github.com/puma/puma/security/advisories/GHSA-c2f4-cvqm-65w2))
5
+
6
+ ## 6.4.1 / 2024-01-03
7
+
8
+ * Bugfixes
9
+ * DSL#warn_if_in_single_mode - fixup when workers set via CLI ([#3256])
10
+ * Fix `idle-timeout` not working in cluster mode ([#3235], [#3228], [#3282], [#3283])
11
+ * Fix worker 0 timing out during phased restart ([#3225], [#2786])
12
+ * context_builder.rb - require openssl if verify_mode != 'none' ([#3179])
13
+ * Make puma cluster process suitable as PID 1 ([#3255])
14
+ * Improve Puma::NullIO consistency with real IO ([#3276])
15
+ * extconf.rb - fixup to detect openssl info in Ruby build ([#3271], [#3266])
16
+ * MiniSSL.java - set serialVersionUID, fix RaiseException deprecation ([#3270])
17
+ * dsl.rb - fix warn_if_in_single_mode when WEB_CONCURRENCY is set ([#3265], [#3264])
18
+
19
+ * Maintenance
20
+ * LOTS of test refactoring to make tests more stable and easier to write - thanks to @MSP-Greg!
21
+ * Fix bug in tests re: TestPuma::HOST4 ([#3254])
22
+ * Dockerfile for minimal repros: use Ruby 3.2, expect bundler installed ([#3245])
23
+ * fix define_method calls, use Symbol parameter instead of String ([#3293])
24
+
25
+ * Docs
26
+ * README.md - add the puma-acme plugin ([#3301])
27
+ * Remove `--keep-file-descriptors` flag from systemd docs ([#3248])
28
+ * Note symlink mechanism in restart documentation for hot restart ([#3298])
29
+
30
+ ## 6.4.0 / 2023-09-21
31
+
32
+ * Features
33
+ * on_thread_exit hook ([#2920])
34
+ * on_thread_start_hook ([#3195])
35
+ * Shutdown on idle ([#3209], [#2580])
36
+ * New error message when control server port taken ([#3204])
37
+
38
+ * Refactor
39
+ * Remove `Forwardable` dependency ([#3191], #3190)
40
+ * Update URLMap Regexp usage for Ruby v3.3 ([#3165])
41
+
42
+ * Bugfixes
43
+ * Bring the cert_pem: parameter into parity with the cert: parameter to ssl_bind. ([#3174])
44
+ * Fix using control server with IPv6 host ([#3181])
45
+ * control_cli.rb - add require_relative 'log_writer' ([#3187])
46
+ * Fix cases where fallback Rack response wasn't sent to the client ([#3094])
47
+
48
+ ## 6.3.1 / 2023-08-18
49
+
50
+ * Security
51
+ * Address HTTP request smuggling vulnerabilities with zero-length Content Length header and trailer fields ([GHSA-68xg-gqqm-vgj8](https://github.com/puma/puma/security/advisories/GHSA-68xg-gqqm-vgj8))
52
+
53
+ ## 6.3.0 / 2023-05-31
54
+
55
+ * Features
56
+ * Add dsl method `supported_http_methods` ([#3106], [#3014])
57
+ * Puma error responses no longer have any fingerprints to indicate Puma ([#3161], [#3037])
58
+ * Support decryption of SSL key ([#3133], [#3132])
59
+
60
+ * Bugfixes
61
+ * Don't send 103 early hints response when only invalid headers are used ([#3163])
62
+ * Handle malformed request path ([#3155], [#3148])
63
+ * Misc lib file fixes - trapping additional errors, CI helper ([#3129])
64
+ * Fixup req form data file upload with "r\n" line endings ([#3137])
65
+ * Restore rack 1.6 compatibility ([#3156])
66
+
67
+ * Refactor
68
+ * const.rb - Update Puma::HTTP_STATUS_CODES ([#3162])
69
+ * Clarify Reactor#initialize ([#3151])
70
+
71
+ ## 6.2.2 / 2023-04-17
72
+
73
+ * Bugfixes
74
+ * Fix Rack-related NameError by adding :: operator ([#3118], [#3117])
75
+
76
+ ## 6.2.1 / 2023-03-31
77
+
78
+ * Bugfixes
79
+ * Fix java 8 compatibility ([#3109], [#3108])
80
+ * Always write io_buffer when in "enum bodies" branch. ([#3113], [#3112])
81
+ * Fix warn_if_in_single_mode incorrect message ([#3111])
82
+
83
+ ## 6.2.0 / 2023-03-29
84
+
85
+ * Features
86
+ * Ability to supply a custom logger ([#2770], [#2511])
87
+ * Warn when clustered-only hooks are defined in single mode ([#3089])
88
+ * Adds the on_booted event ([#2709])
89
+
90
+ * Bugfixes
91
+ * Loggers - internal_write - catch Errno::EINVAL ([#3091])
92
+ * commonlogger.rb - fix HIJACK time format, use constants, not strings ([#3074])
93
+ * Fixed some edge cases regarding request hijacking ([#3072])
94
+
95
+ ## 6.1.1 / 2023-02-28
96
+
97
+ * Bugfixes
98
+ * We no longer try to use the systemd plugin for JRuby ([#3079])
99
+ * Allow ::Rack::Handler::Puma.run to work regardless of whether Rack/Rackup are loaded ([#3080])
100
+
101
+ ## 6.1.0 / 2023-02-12
102
+
103
+ * Features
104
+ * WebSocket support via partial hijack ([#3058], [#3007])
105
+ * Add built-in systemd notify support ([#3011])
106
+ * Periodically send status to systemd ([#3006], [#2604])
107
+ * Introduce the ability to return 413: payload too large for requests ([#3040])
108
+ * Log loaded extensions when `PUMA_DEBUG` is set ([#3036], [#3020])
109
+
110
+ * Bugfixes
111
+ * Fix issue with rack 3 compatibility re: rackup ([#3061], [#3057])
112
+ * Allow setting TCP low_latency with SSL listener ([#3065])
113
+
114
+ * Performance
115
+ * Reduce memory usage for large file uploads ([#3062])
116
+
1
117
  ## 6.0.2 / 2023-01-01
2
118
 
3
119
  * Refactor
@@ -5,12 +121,12 @@
5
121
  * Refactor const.rb - freeze ([#3016])
6
122
 
7
123
  ## 6.0.1 / 2022-12-20
8
-
124
+
9
125
  * Bugfixes
10
126
  * Handle waking up a closed selector in Reactor#add ([#3005])
11
127
  * Fixup response processing, enumerable bodies ([#3004], [#3000])
12
128
  * Correctly close app body for all code paths ([#3002], [#2999])
13
- * Refactor
129
+ * Refactor
14
130
  * Add IOBuffer to Client, remove from ThreadPool thread instances ([#3013])
15
131
 
16
132
  ## 6.0.0 / 2022-10-14
@@ -39,12 +155,12 @@
39
155
  * Allow header values to be arrays (Rack 3) ([#2936], [#2931])
40
156
  * Export Puma/Ruby versions in /stats ([#2875])
41
157
  * Allow configuring request uri max length & request path max length ([#2840])
42
- * Add a couple of public accessors ([#2774])
158
+ * Add a couple of public accessors ([#2774])
43
159
  * Log entire backtrace when worker start fails ([#2891])
44
160
  * [jruby] Enable TLSv1.3 support ([#2886])
45
161
  * [jruby] support setting TLS protocols + rename ssl_cipher_list ([#2899])
46
162
  * [jruby] Support a truststore option ([#2849], [#2904], [#2884])
47
-
163
+
48
164
  * Bugfixes
49
165
  * Load the configuration before passing it to the binder ([#2897])
50
166
  * Do not raise error raised on HTTP methods we don't recognize or support, like CONNECT ([#2932], [#1441])
@@ -57,6 +173,21 @@
57
173
  * Ruby 3.2 will have native IO#wait_* methods, don't require io/wait ([#2903])
58
174
  * Various internal API refactorings ([#2942], [#2921], [#2922], [#2955])
59
175
 
176
+ ## 5.6.8 / 2024-01-08
177
+
178
+ * Security
179
+ * Limit the size of chunk extensions. Without this limit, an attacker could cause unbounded resource (CPU, network bandwidth) consumption. ([GHSA-c2f4-cvqm-65w2](https://github.com/puma/puma/security/advisories/GHSA-c2f4-cvqm-65w2))
180
+
181
+ ## 5.6.7 / 2023-08-18
182
+
183
+ * Security
184
+ * Address HTTP request smuggling vulnerabilities with zero-length Content Length header and trailer fields ([GHSA-68xg-gqqm-vgj8](https://github.com/puma/puma/security/advisories/GHSA-68xg-gqqm-vgj8))
185
+
186
+ ## 5.6.6 / 2023-06-21
187
+
188
+ * Bugfix
189
+ * Prevent loading with rack 3 ([#3166])
190
+
60
191
  ## 5.6.5 / 2022-08-23
61
192
 
62
193
  * Feature
@@ -1932,6 +2063,80 @@ be added back in a future date when a java Puma::MiniSSL is added.
1932
2063
  * Bugfixes
1933
2064
  * Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
1934
2065
 
2066
+ [#3256]:https://github.com/puma/puma/pull/3256 "PR by @MSP-Greg, merged 2023-10-16"
2067
+ [#3235]:https://github.com/puma/puma/pull/3235 "PR by @joshuay03, merged 2023-10-03"
2068
+ [#3228]:https://github.com/puma/puma/issues/3228 "Issue by @davidalejandroaguilar, closed 2023-10-03"
2069
+ [#3282]:https://github.com/puma/puma/issues/3282 "Issue by @bensheldon, closed 2024-01-02"
2070
+ [#3283]:https://github.com/puma/puma/pull/3283 "PR by @joshuay03, merged 2024-01-02"
2071
+ [#3225]:https://github.com/puma/puma/pull/3225 "PR by @joshuay03, merged 2023-09-27"
2072
+ [#2786]:https://github.com/puma/puma/issues/2786 "Issue by @vitiokss, closed 2023-09-27"
2073
+ [#3179]:https://github.com/puma/puma/pull/3179 "PR by @MSP-Greg, merged 2023-09-26"
2074
+ [#3255]:https://github.com/puma/puma/pull/3255 "PR by @casperisfine, merged 2023-10-19"
2075
+ [#3276]:https://github.com/puma/puma/pull/3276 "PR by @casperisfine, merged 2023-11-16"
2076
+ [#3271]:https://github.com/puma/puma/pull/3271 "PR by @MSP-Greg, merged 2023-10-30"
2077
+ [#3266]:https://github.com/puma/puma/issues/3266 "Issue by @Dragonicity, closed 2023-10-30"
2078
+ [#3270]:https://github.com/puma/puma/pull/3270 "PR by @MSP-Greg, merged 2023-10-30"
2079
+ [#3265]:https://github.com/puma/puma/pull/3265 "PR by @MSP-Greg, merged 2023-10-25"
2080
+ [#3264]:https://github.com/puma/puma/issues/3264 "Issue by @dentarg, closed 2023-10-25"
2081
+ [#3254]:https://github.com/puma/puma/pull/3254 "PR by @casperisfine, merged 2023-10-11"
2082
+ [#3245]:https://github.com/puma/puma/pull/3245 "PR by @olleolleolle, merged 2023-10-02"
2083
+ [#3293]:https://github.com/puma/puma/pull/3293 "PR by @MSP-Greg, merged 2023-12-21"
2084
+ [#3301]:https://github.com/puma/puma/pull/3301 "PR by @benburkert, merged 2023-12-29"
2085
+ [#3248]:https://github.com/puma/puma/pull/3248 "PR by @dentarg, merged 2023-10-04"
2086
+ [#3298]:https://github.com/puma/puma/pull/3298 "PR by @til, merged 2023-12-26"
2087
+ [#2920]:https://github.com/puma/puma/pull/2920 "PR by @biinari, merged 2023-07-11"
2088
+ [#3195]:https://github.com/puma/puma/pull/3195 "PR by @binarygit, merged 2023-08-15"
2089
+ [#3209]:https://github.com/puma/puma/pull/3209 "PR by @joshuay03, merged 2023-09-04"
2090
+ [#2580]:https://github.com/puma/puma/issues/2580 "Issue by @schuetzm, closed 2023-09-04"
2091
+ [#3204]:https://github.com/puma/puma/pull/3204 "PR by @dhavalsingh, merged 2023-08-25"
2092
+ [#3191]:https://github.com/puma/puma/pull/3191 "PR by @MSP-Greg, merged 2023-08-31"
2093
+ [#3165]:https://github.com/puma/puma/pull/3165 "PR by @fallwith, merged 2023-06-06"
2094
+ [#3174]:https://github.com/puma/puma/pull/3174 "PR by @copiousfreetime, merged 2023-06-11"
2095
+ [#3181]:https://github.com/puma/puma/pull/3181 "PR by @MSP-Greg, merged 2023-06-23"
2096
+ [#3187]:https://github.com/puma/puma/pull/3187 "PR by @MSP-Greg, merged 2023-06-30"
2097
+ [#3094]:https://github.com/puma/puma/pull/3094 "PR by @Vuta, merged 2023-07-23"
2098
+ [#3106]:https://github.com/puma/puma/pull/3106 "PR by @MSP-Greg, merged 2023-05-29"
2099
+ [#3014]:https://github.com/puma/puma/issues/3014 "Issue by @kyledrake, closed 2023-05-29"
2100
+ [#3161]:https://github.com/puma/puma/pull/3161 "PR by @MSP-Greg, merged 2023-05-27"
2101
+ [#3037]:https://github.com/puma/puma/issues/3037 "Issue by @daisy1754, closed 2023-05-27"
2102
+ [#3133]:https://github.com/puma/puma/pull/3133 "PR by @stanhu, merged 2023-04-30"
2103
+ [#3132]:https://github.com/puma/puma/issues/3132 "Issue by @stanhu, closed 2023-04-30"
2104
+ [#3163]:https://github.com/puma/puma/pull/3163 "PR by @MSP-Greg, merged 2023-05-27"
2105
+ [#3155]:https://github.com/puma/puma/pull/3155 "PR by @dentarg, merged 2023-05-14"
2106
+ [#3148]:https://github.com/puma/puma/issues/3148 "Issue by @dentarg, closed 2023-05-14"
2107
+ [#3129]:https://github.com/puma/puma/pull/3129 "PR by @MSP-Greg, merged 2023-05-02"
2108
+ [#3137]:https://github.com/puma/puma/pull/3137 "PR by @MSP-Greg, merged 2023-04-30"
2109
+ [#3156]:https://github.com/puma/puma/pull/3156 "PR by @severin, merged 2023-05-16"
2110
+ [#3162]:https://github.com/puma/puma/pull/3162 "PR by @MSP-Greg, merged 2023-05-23"
2111
+ [#3151]:https://github.com/puma/puma/pull/3151 "PR by @nateberkopec, merged 2023-05-12"
2112
+ [#3118]:https://github.com/puma/puma/pull/3118 "PR by @ninoseki, merged 2023-04-01"
2113
+ [#3117]:https://github.com/puma/puma/issues/3117 "Issue by @ninoseki, closed 2023-04-01"
2114
+ [#3109]:https://github.com/puma/puma/pull/3109 "PR by @ahorek, merged 2023-03-31"
2115
+ [#3108]:https://github.com/puma/puma/issues/3108 "Issue by @treviateo, closed 2023-03-31"
2116
+ [#3113]:https://github.com/puma/puma/pull/3113 "PR by @collinsauve, merged 2023-03-31"
2117
+ [#3112]:https://github.com/puma/puma/issues/3112 "Issue by @dmke, closed 2023-03-31"
2118
+ [#3111]:https://github.com/puma/puma/pull/3111 "PR by @adzap, merged 2023-03-30"
2119
+ [#2770]:https://github.com/puma/puma/pull/2770 "PR by @vzajkov, merged 2023-03-29"
2120
+ [#2511]:https://github.com/puma/puma/issues/2511 "Issue by @jchristie55332, closed 2021-12-12"
2121
+ [#3089]:https://github.com/puma/puma/pull/3089 "PR by @Vuta, merged 2023-03-06"
2122
+ [#2709]:https://github.com/puma/puma/pull/2709 "PR by @rodzyn, merged 2023-02-20"
2123
+ [#3091]:https://github.com/puma/puma/pull/3091 "PR by @MSP-Greg, merged 2023-03-28"
2124
+ [#3074]:https://github.com/puma/puma/pull/3074 "PR by @MSP-Greg, merged 2023-03-14"
2125
+ [#3072]:https://github.com/puma/puma/pull/3072 "PR by @MSP-Greg, merged 2023-02-17"
2126
+ [#3079]:https://github.com/puma/puma/pull/3079 "PR by @mohamedhafez, merged 2023-02-24"
2127
+ [#3080]:https://github.com/puma/puma/pull/3080 "PR by @MSP-Greg, merged 2023-02-16"
2128
+ [#3058]:https://github.com/puma/puma/pull/3058 "PR by @dentarg, merged 2023-01-29"
2129
+ [#3007]:https://github.com/puma/puma/issues/3007 "Issue by @MSP-Greg, closed 2023-01-29"
2130
+ [#3011]:https://github.com/puma/puma/pull/3011 "PR by @joaomarcos96, merged 2023-01-03"
2131
+ [#3006]:https://github.com/puma/puma/pull/3006 "PR by @QWYNG, merged 2023-02-09"
2132
+ [#2604]:https://github.com/puma/puma/issues/2604 "Issue by @dgoetz, closed 2023-02-09"
2133
+ [#3040]:https://github.com/puma/puma/pull/3040 "PR by @shayonj, merged 2023-01-02"
2134
+ [#3036]:https://github.com/puma/puma/pull/3036 "PR by @MSP-Greg, merged 2023-01-13"
2135
+ [#3020]:https://github.com/puma/puma/issues/3020 "Issue by @dentarg, closed 2023-01-13"
2136
+ [#3061]:https://github.com/puma/puma/pull/3061 "PR by @MSP-Greg, merged 2023-02-12"
2137
+ [#3057]:https://github.com/puma/puma/issues/3057 "Issue by @mmarvb8h, closed 2023-02-12"
2138
+ [#3065]:https://github.com/puma/puma/pull/3065 "PR by @MSP-Greg, merged 2023-02-11"
2139
+ [#3062]:https://github.com/puma/puma/pull/3062 "PR by @willkoehler, merged 2023-01-29"
1935
2140
  [#3035]:https://github.com/puma/puma/pull/3035 "PR by @MSP-Greg, merged 2022-12-24"
1936
2141
  [#3033]:https://github.com/puma/puma/issues/3033 "Issue by @jules-w2, closed 2022-12-24"
1937
2142
  [#3016]:https://github.com/puma/puma/pull/3016 "PR by @MSP-Greg, merged 2022-12-24"
@@ -1988,6 +2193,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
1988
2193
  [#2921]:https://github.com/puma/puma/issues/2921 "Issue by @MSP-Greg, closed 2022-09-15"
1989
2194
  [#2922]:https://github.com/puma/puma/issues/2922 "Issue by @MSP-Greg, closed 2022-09-10"
1990
2195
  [#2955]:https://github.com/puma/puma/pull/2955 "PR by @cafedomancer, merged 2022-09-15"
2196
+ [#3166]:https://github.com/puma/puma/pull/3166 "PR by @JoeDupuis, merged 2023-06-08"
1991
2197
  [#2868]:https://github.com/puma/puma/pull/2868 "PR by @MSP-Greg, merged 2022-06-02"
1992
2198
  [#2866]:https://github.com/puma/puma/issues/2866 "Issue by @slondr, closed 2022-06-02"
1993
2199
  [#2883]:https://github.com/puma/puma/pull/2883 "PR by @MSP-Greg, merged 2022-06-02"
@@ -2014,7 +2220,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
2014
2220
  [#2794]:https://github.com/puma/puma/pull/2794 "PR by @johnnyshields, merged 2022-01-10"
2015
2221
  [#2759]:https://github.com/puma/puma/pull/2759 "PR by @ob-stripe, merged 2021-12-11"
2016
2222
  [#2731]:https://github.com/puma/puma/pull/2731 "PR by @baelter, merged 2021-11-02"
2017
- [#2341]:https://github.com/puma/puma/issues/2341 "Issue by @cjlarose, closed 2021-11-02"
2223
+ [#2341]:https://github.com/puma/puma/issues/2341 "Issue by @cjlarose, closed 2023-07-23"
2018
2224
  [#2728]:https://github.com/puma/puma/pull/2728 "PR by @dalibor, merged 2021-10-31"
2019
2225
  [#2733]:https://github.com/puma/puma/pull/2733 "PR by @ob-stripe, merged 2021-12-12"
2020
2226
  [#2807]:https://github.com/puma/puma/pull/2807 "PR by @MSP-Greg, merged 2022-01-25"
@@ -2062,7 +2268,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
2062
2268
  [#2563]:https://github.com/puma/puma/pull/2563 "PR by @MSP-Greg, merged 2021-03-06"
2063
2269
  [#2504]:https://github.com/puma/puma/issues/2504 "Issue by @fsateler, closed 2021-03-06"
2064
2270
  [#2591]:https://github.com/puma/puma/pull/2591 "PR by @MSP-Greg, merged 2021-05-05"
2065
- [#2572]:https://github.com/puma/puma/issues/2572 "Issue by @josefbilendo, closed 2021-05-05"
2271
+ [#2572]:https://github.com/puma/puma/issues/2572 "Issue by @josef-krabath, closed 2021-05-05"
2066
2272
  [#2613]:https://github.com/puma/puma/pull/2613 "PR by @smcgivern, merged 2021-04-27"
2067
2273
  [#2605]:https://github.com/puma/puma/pull/2605 "PR by @pascalbetz, merged 2021-04-26"
2068
2274
  [#2584]:https://github.com/puma/puma/issues/2584 "Issue by @kaorihinata, closed 2021-04-26"
@@ -2378,7 +2584,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
2378
2584
  [#1110]:https://github.com/puma/puma/pull/1110 "PR by @montdidier, merged 2016-12-12"
2379
2585
  [#1135]:https://github.com/puma/puma/pull/1135 "PR by @jkraemer, merged 2016-11-19"
2380
2586
  [#1081]:https://github.com/puma/puma/pull/1081 "PR by @frodsan, merged 2016-09-08"
2381
- [#1138]:https://github.com/puma/puma/pull/1138 "PR by @steakknife, merged 2016-12-13"
2587
+ [#1138]:https://github.com/puma/puma/pull/1138 "PR by @skull-squadron, merged 2016-12-13"
2382
2588
  [#1118]:https://github.com/puma/puma/pull/1118 "PR by @hiroara, merged 2016-11-20"
2383
2589
  [#1075]:https://github.com/puma/puma/issues/1075 "Issue by @pvalena, closed 2016-09-06"
2384
2590
  [#932]:https://github.com/puma/puma/issues/932 "Issue by @everplays, closed 2016-07-24"
data/LICENSE CHANGED
File without changes
data/README.md CHANGED
@@ -12,11 +12,15 @@ Puma is a **simple, fast, multi-threaded, and highly parallel HTTP 1.1 server fo
12
12
 
13
13
  ## Built For Speed &amp; Parallelism
14
14
 
15
- 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 parallel Ruby implementations (JRuby, Rubinius) will use all available CPU cores.
15
+ Puma is a server for [Rack](https://github.com/rack/rack)-powered HTTP applications written in Ruby. It is:
16
+ * **Multi-threaded**. Each request is served in a separate thread. This helps you serve more requests per second with less memory use.
17
+ * **Multi-process**. "Pre-forks" in cluster mode, using less memory per-process thanks to copy-on-write memory.
18
+ * **Standalone**. With SSL support, zero-downtime rolling restarts and a built-in request bufferer, you can deploy Puma without any reverse proxy.
19
+ * **Battle-tested**. Our HTTP parser is inherited from Mongrel and has over 15 years of production use. Puma is currently the most popular Ruby webserver, and is the default server for Ruby on Rails.
16
20
 
17
21
  Originally designed as a server for [Rubinius](https://github.com/rubinius/rubinius), Puma also works well with Ruby (MRI) and JRuby.
18
22
 
19
- 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.
23
+ 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. Truly parallel Ruby implementations (TruffleRuby, JRuby) don't have this limitation.
20
24
 
21
25
  ## Quick Start
22
26
 
@@ -114,6 +118,8 @@ $ WEB_CONCURRENCY=3 puma -t 8:32
114
118
 
115
119
  Note that threads are still used in clustered mode, and the `-t` thread flag setting is per worker, so `-w 2 -t 16:16` will spawn 32 threads in total, with 16 in each worker process.
116
120
 
121
+ For an in-depth discussion of the tradeoffs of thread and process count settings, [see our docs](https://github.com/puma/puma/blob/9282a8efa5a0c48e39c60d22ca70051a25df9f55/docs/kubernetes.md#workers-per-pod-and-other-config-issues).
122
+
117
123
  In clustered mode, Puma can "preload" your application. This loads all the application code *prior* to forking. Preloading reduces total memory usage of your application via an operating system feature called [copy-on-write](https://en.wikipedia.org/wiki/Copy-on-write).
118
124
 
119
125
  If the `WEB_CONCURRENCY` environment variable is set to a value > 1 (and `--prune-bundler` has not been specified), preloading will be enabled by default. Otherwise, you can use the `--preload` flag from the command line:
@@ -157,6 +163,15 @@ before_fork do
157
163
  end
158
164
  ```
159
165
 
166
+ You can also specify a block to be run after puma is booted using `on_booted`:
167
+
168
+ ```ruby
169
+ # config/puma.rb
170
+ on_booted do
171
+ # configuration here
172
+ end
173
+ ```
174
+
160
175
  ### Error handling
161
176
 
162
177
  If puma encounters an error outside of the context of your application, it will respond with a 500 and a simple
@@ -202,29 +217,32 @@ Puma supports the [`localhost`] gem for self-signed certificates. This is partic
202
217
 
203
218
  Puma automatically configures SSL when the [`localhost`] gem is loaded in a `development` environment:
204
219
 
220
+ Add the gem to your Gemfile:
205
221
  ```ruby
206
- # Add the gem to your Gemfile
207
222
  group(:development) do
208
223
  gem 'localhost'
209
224
  end
225
+ ```
210
226
 
211
- # And require it implicitly using bundler
227
+ And require it implicitly using bundler:
228
+ ```ruby
212
229
  require "bundler"
213
230
  Bundler.require(:default, ENV["RACK_ENV"].to_sym)
231
+ ```
214
232
 
215
- # Alternatively, you can require the gem in config.ru:
216
- require './app'
233
+ Alternatively, you can require the gem in your configuration file, either `config/puma/development.rb`, `config/puma.rb`, or set via the `-C` cli option:
234
+ ```ruby
217
235
  require 'localhost'
218
- run Sinatra::Application
236
+ # configuration methods (from Puma::DSL) as needed
219
237
  ```
220
238
 
221
239
  Additionally, Puma must be listening to an SSL socket:
222
240
 
223
241
  ```shell
224
- $ puma -b 'ssl://localhost:9292' config.ru
242
+ $ puma -b 'ssl://localhost:9292' -C config/use_local_host.rb
225
243
 
226
244
  # The following options allow you to reach Puma over HTTP as well:
227
- $ puma -b ssl://localhost:9292 -b tcp://localhost:9393 config.ru
245
+ $ puma -b ssl://localhost:9292 -b tcp://localhost:9393 -C config/use_local_host.rb
228
246
  ```
229
247
 
230
248
  [`localhost`]: https://github.com/socketry/localhost
@@ -270,6 +288,30 @@ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_f
270
288
  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`
271
289
  (see https://www.openssl.org/docs/manmaster/man3/X509_VERIFY_PARAM_set_hostflags.html#VERIFICATION-FLAGS).
272
290
 
291
+ #### Controlling OpenSSL Password Decryption
292
+
293
+ To enable runtime decryption of an encrypted SSL key (not available for JRuby), use `key_password_command`:
294
+
295
+ ```
296
+ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&key_password_command=/path/to/command.sh'
297
+ ```
298
+
299
+ `key_password_command` must:
300
+
301
+ 1. Be executable by Puma.
302
+ 2. Print the decryption password to stdout.
303
+
304
+ For example:
305
+
306
+ ```shell
307
+ #!/bin/sh
308
+
309
+ echo "this is my password"
310
+ ```
311
+
312
+ `key_password_command` can be used with `key` or `key_pem`. If the key
313
+ is not encrypted, the executable will not be called.
314
+
273
315
  ### Control/Status Server
274
316
 
275
317
  Puma has a built-in status and control app that can be used to query and control Puma.
@@ -345,11 +387,13 @@ end
345
387
 
346
388
  ## Deployment
347
389
 
348
- Puma has support for Capistrano with an [external gem](https://github.com/seuros/capistrano-puma).
390
+ * Puma has support for Capistrano with an [external gem](https://github.com/seuros/capistrano-puma).
391
+
392
+ * Additionally, Puma has support for built-in daemonization via the [puma-daemon](https://github.com/kigster/puma-daemon) ruby gem. The gem restores the `daemonize` option that was removed from Puma starting version 5, but only for MRI Ruby.
393
+
349
394
 
350
395
  It is common to use process monitors with Puma. Modern process monitors like systemd or rc.d
351
- provide continuous monitoring and restarts for increased
352
- reliability in production environments:
396
+ provide continuous monitoring and restarts for increased reliability in production environments:
353
397
 
354
398
  * [rc.d](docs/jungle/rc.d/README.md)
355
399
  * [systemd](docs/systemd.md)
@@ -364,7 +408,9 @@ Community guides:
364
408
 
365
409
  * [puma-metrics](https://github.com/harmjanblok/puma-metrics) — export Puma metrics to Prometheus
366
410
  * [puma-plugin-statsd](https://github.com/yob/puma-plugin-statsd) — send Puma metrics to statsd
367
- * [puma-plugin-systemd](https://github.com/sj26/puma-plugin-systemd) — deeper integration with systemd for notify, status and watchdog
411
+ * [puma-plugin-systemd](https://github.com/sj26/puma-plugin-systemd) — deeper integration with systemd for notify, status and watchdog. Puma 5.1.0 integrated notify and watchdog, which probably conflicts with this plugin. Puma 6.1.0 added status support which obsoletes the plugin entirely.
412
+ * [puma-plugin-telemetry](https://github.com/babbel/puma-plugin-telemetry) - telemetry plugin for Puma offering various targets to publish
413
+ * [puma-acme](https://github.com/anchordotdev/puma-acme) - automatic SSL/HTTPS certificate provisioning and setup
368
414
 
369
415
  ### Monitoring
370
416
 
data/bin/puma-wild CHANGED
File without changes
data/docs/architecture.md CHANGED
File without changes
File without changes
data/docs/deployment.md CHANGED
File without changes
data/docs/fork_worker.md CHANGED
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
data/docs/kubernetes.md CHANGED
@@ -64,3 +64,15 @@ There is a subtle race condition between step 2 and 3: The replication controlle
64
64
  The way Kubernetes works this way, rather than handling step 2 synchronously, is due to the CAP theorem: in a distributed system there is no way to guarantee that any message will arrive promptly. In particular, waiting for all Service controllers to report back might get stuck for an indefinite time if one of them has already been terminated or if there has been a net split. A way to work around this is to add a sleep to the pre-stop hook of the same time as the `terminationGracePeriodSeconds` time. This will allow the Puma process to keep serving new requests during the entire grace period, although it will no longer receive new requests after all Service controllers have propagated the removal of the pod from their endpoint lists. Then, after `terminationGracePeriodSeconds`, the pod receives `SIGKILL` and closes down. If your process can't handle SIGKILL properly, for example because it needs to release locks in different services, you can also sleep for a shorter period (and/or increase `terminationGracePeriodSeconds`) as long as the time slept is longer than the time that your Service controllers take to propagate the pod removal. The downside of this workaround is that all pods will take at minimum the amount of time slept to shut down and this will increase the time required for your rolling deploy.
65
65
 
66
66
  More discussions and links to relevant articles can be found in https://github.com/puma/puma/issues/2343.
67
+
68
+ ## Workers Per Pod, and Other Config Issues
69
+
70
+ With containerization, you will have to make a decision about how "big" to make each pod. Should you run 2 pods with 50 workers each? 25 pods, each with 4 workers? 100 pods, with each Puma running in single mode? Each scenario represents the same total amount of capacity (100 Puma processes that can respond to requests), but there are tradeoffs to make.
71
+
72
+ * Worker counts should be somewhere between 4 and 32 in most cases. You want more than 4 in order to minimize time spent in request queueing for a free Puma worker, but probably less than ~32 because otherwise autoscaling is working in too large of an increment or they probably won't fit very well into your nodes. In any queueing system, queue time is proportional to 1/n, where n is the number of things pulling from the queue. Each pod will have its own request queue (i.e., the socket backlog). If you have 4 pods with 1 worker each (4 request queues), wait times are, proportionally, about 4 times higher than if you had 1 pod with 4 workers (1 request queue).
73
+ * Unless you have a very I/O-heavy application (50%+ time spent waiting on IO), use the default thread count (5 for MRI). Using higher numbers of threads with low I/O wait (<50%) will lead to additional request queueing time (latency!) and additional memory usage.
74
+ * More processes per pod reduces memory usage per process, because of copy-on-write memory and because the cost of the single master process is "amortized" over more child processes.
75
+ * Don't run less than 4 processes per pod if you can. Low numbers of processes per pod will lead to high request queueing, which means you will have to run more pods.
76
+ * If multithreaded, allocate 1 CPU per worker. If single threaded, allocate 0.75 cpus per worker. Most web applications spend about 25% of their time in I/O - but when you're running multi-threaded, your Puma process will have higher CPU usage and should be able to fully saturate a CPU core.
77
+ * Most Puma processes will use about ~512MB-1GB per worker, and about 1GB for the master process. However, you probably shouldn't bother with setting memory limits lower than around 2GB per process, because most places you are deploying will have 2GB of RAM per CPU. A sensible memory limit for a Puma configuration of 4 child workers might be something like 8 GB (1 GB for the master, 7GB for the 4 children).
78
+
data/docs/nginx.md CHANGED
File without changes
data/docs/plugins.md CHANGED
File without changes
File without changes
data/docs/restart.md CHANGED
@@ -27,6 +27,7 @@ Any of the following will cause a Puma server to perform a hot restart:
27
27
 
28
28
  ### Additional notes
29
29
 
30
+ * The newly started Puma process changes its current working directory to the directory specified by the `directory` option. If `directory` is set to symlink, this is automatically re-evaluated, so this mechanism can be used to upgrade the application.
30
31
  * Only one version of the application is running at a time.
31
32
  * `on_restart` is invoked just before the server shuts down. This can be used to clean up resources (like long-lived database connections) gracefully. Since Ruby 2.0, it is not typically necessary to explicitly close file descriptors on restart. This is because any file descriptor opened by Ruby will have the `FD_CLOEXEC` flag set, meaning that file descriptors are closed on `exec`. `on_restart` is useful, though, if your application needs to perform any more graceful protocol-specific shutdown procedures before closing connections.
32
33
 
data/docs/signals.md CHANGED
File without changes
data/docs/stats.md CHANGED
File without changes
data/docs/systemd.md CHANGED
@@ -24,8 +24,7 @@ After=network.target
24
24
 
25
25
  [Service]
26
26
  # Puma supports systemd's `Type=notify` and watchdog service
27
- # monitoring, if the [sd_notify](https://github.com/agis/ruby-sdnotify) gem is installed,
28
- # as of Puma 5.1 or later.
27
+ # monitoring, as of Puma 5.1 or later.
29
28
  # On earlier versions of Puma or JRuby, change this to `Type=simple` and remove
30
29
  # the `WatchdogSec` line.
31
30
  Type=notify
@@ -52,7 +51,7 @@ ExecStart=/<FULLPATH>/bin/puma -C <YOUR_APP_PATH>/puma.rb
52
51
  # Variant: Rails start.
53
52
  # ExecStart=/<FULLPATH>/bin/puma -C <YOUR_APP_PATH>/config/puma.rb ../config.ru
54
53
 
55
- # Variant: Use `bundle exec --keep-file-descriptors puma` instead of binstub
54
+ # Variant: Use `bundle exec puma` instead of binstub
56
55
  # Variant: Specify directives inline.
57
56
  # ExecStart=/<FULLPATH>/puma -b tcp://0.0.0.0:9292 -b ssl://0.0.0.0:9293?key=key.pem&cert=cert.pem
58
57
 
@@ -77,9 +76,7 @@ compatible with both clustered mode and application preload.
77
76
 
78
77
  **Note:** Any wrapper scripts which `exec`, or other indirections in `ExecStart`
79
78
  may result in activated socket file descriptors being closed before reaching the
80
- puma master process. For example, if using `bundle exec`, pass the
81
- `--keep-file-descriptors` flag. `bundle exec` can be avoided by using a `puma`
82
- executable generated by `bundle binstubs puma`. This is tracked in [#1499].
79
+ puma master process.
83
80
 
84
81
  **Note:** Socket activation doesn't currently work on JRuby. This is tracked in
85
82
  [#1367].
File without changes
File without changes
File without changes
File without changes
@@ -10,7 +10,11 @@ end
10
10
 
11
11
  unless ENV["PUMA_DISABLE_SSL"]
12
12
  # don't use pkg_config('openssl') if '--with-openssl-dir' is used
13
- has_openssl_dir = dir_config('openssl').any?
13
+ # also looks within the Ruby build for directory info
14
+ has_openssl_dir = dir_config('openssl').any? ||
15
+ RbConfig::CONFIG['configure_args']&.include?('openssl') ||
16
+ Dir.exist?("#{RbConfig::TOPDIR}/src/main/c/openssl") # TruffleRuby
17
+
14
18
  found_pkg_config = !has_openssl_dir && pkg_config('openssl')
15
19
 
16
20
  found_ssl = if !$mingw && found_pkg_config
File without changes
File without changes
File without changes
File without changes
File without changes