puma 6.4.3 → 6.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/History.md +159 -7
- data/README.md +86 -26
- data/docs/fork_worker.md +11 -1
- data/docs/java_options.md +54 -0
- data/docs/plugins.md +4 -0
- data/docs/signals.md +2 -2
- data/docs/stats.md +8 -3
- data/docs/systemd.md +11 -2
- data/ext/puma_http11/extconf.rb +19 -16
- data/ext/puma_http11/mini_ssl.c +11 -1
- data/ext/puma_http11/org/jruby/puma/Http11.java +29 -8
- data/ext/puma_http11/puma_http11.c +4 -1
- data/lib/puma/app/status.rb +1 -1
- data/lib/puma/binder.rb +12 -4
- data/lib/puma/cli.rb +9 -5
- data/lib/puma/client.rb +78 -17
- data/lib/puma/cluster/worker.rb +9 -6
- data/lib/puma/cluster/worker_handle.rb +4 -5
- data/lib/puma/cluster.rb +55 -29
- data/lib/puma/configuration.rb +36 -18
- data/lib/puma/const.rb +14 -3
- data/lib/puma/control_cli.rb +4 -4
- data/lib/puma/dsl.rb +282 -50
- data/lib/puma/error_logger.rb +4 -4
- data/lib/puma/jruby_restart.rb +0 -16
- data/lib/puma/launcher.rb +21 -8
- data/lib/puma/log_writer.rb +9 -9
- data/lib/puma/minissl/context_builder.rb +1 -0
- data/lib/puma/minissl.rb +1 -0
- data/lib/puma/null_io.rb +26 -0
- data/lib/puma/request.rb +19 -11
- data/lib/puma/runner.rb +9 -2
- data/lib/puma/sd_notify.rb +1 -4
- data/lib/puma/server.rb +33 -22
- data/lib/puma/single.rb +1 -1
- data/lib/puma/thread_pool.rb +14 -2
- data/lib/puma/util.rb +1 -1
- data/lib/rack/handler/puma.rb +8 -5
- data/tools/Dockerfile +3 -1
- metadata +10 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 574e9afd59afd9a6d5b86bd74cc7e524e73982b61ca294884540cb54324771bf
|
4
|
+
data.tar.gz: 4702dc966028a0cb7c7f912ba6cdc33446071e8cd13ea63f14070f247f5d4504
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 89dccb7f7cde9cc70904c28cf6026022239eac61fe8c903d924f10e50a59d17876d181feb4c80c7b4315c46d166fdcca7743dca16a3c52e27827f2e2d39a8ec3
|
7
|
+
data.tar.gz: c30aa7e48f3b6c191351ebe5c9b407fec7b2523c679bc915c21aefb854b0b43e7b9d776fcc3fdef574da70df71225ae4dbb78ed7045f4b178ae8a8578ae48efd
|
data/History.md
CHANGED
@@ -1,3 +1,87 @@
|
|
1
|
+
## 6.6.1 / 2025-07-30
|
2
|
+
|
3
|
+
* Bugfixes
|
4
|
+
* Accept `to_path` to be `nil` on request bodies ([#3635])
|
5
|
+
* Fix single runner stats before the server start ([#3572])
|
6
|
+
* Fix incomplete worker boot state on refork ([#3601])
|
7
|
+
* Improve HttpParserError messages for better debugging ([#3586])
|
8
|
+
* Fix refork logs to distinguish from phased restarts ([#3598])
|
9
|
+
* Fix `rack.after_reply` so it doesn't interrupt chain on error ([#3680])
|
10
|
+
|
11
|
+
## 6.6.0 / 2025-01-29
|
12
|
+
|
13
|
+
* Features
|
14
|
+
* Option to turn off SIGUSR2 trapping ([#3570], [#3567])
|
15
|
+
* Shorten `ThreadPool` trimmer and reaper thread names ([#3383])
|
16
|
+
* Add after_refork hook ([#3386])
|
17
|
+
* Add busy threads stat ([#3517])
|
18
|
+
* Add a debug log before running each type of hook ([#3375])
|
19
|
+
* Allow alternative schemes in Binder ([#3348], [#3302])
|
20
|
+
* Avoid spawning `Threadpool#trim` thread if pool size is fixed ([#3384])
|
21
|
+
|
22
|
+
* Bugfixes
|
23
|
+
* Change `HttpParserError` to be subclass of `StandardError` ([#3590], [#3552])
|
24
|
+
* added test cases
|
25
|
+
* fix update phased restart symlink folder
|
26
|
+
|
27
|
+
* Performance
|
28
|
+
* Only ping worker 0 during phased restart if using fork worker ([#3568])
|
29
|
+
|
30
|
+
* Refactor
|
31
|
+
* Fix multi-delimiter split to get status app token ([#3505])
|
32
|
+
* Change ping to use const ([#3595])
|
33
|
+
* Fixup use of Puma::Const::PipeRequest constants ([#3565])
|
34
|
+
* Update DSL hook processing logic to be consistent ([#3376])
|
35
|
+
|
36
|
+
## 6.5.0 / 2024-11-23
|
37
|
+
|
38
|
+
* Features
|
39
|
+
* Print RUBY_DESCRIPTION when Puma starts ([#3407])
|
40
|
+
* Set the worker process count automatically when using WEB_CONCURRENCY=auto ([#3439], [#3437])
|
41
|
+
* Mark as ractor-safe ([#3486], [#3422])
|
42
|
+
* Add option `enable_keep_alive`. `true` mimics existing behavior, but now can use `false` to disable keepalive to reduce queue tail latency ([#3496])
|
43
|
+
* Add parameters to Puma methods to allow CI to change ENV in isolation ([#3485])
|
44
|
+
* Add `ssl_ciphersuites` option for TLSv1.3 ciphers ([#3359], [#3343])
|
45
|
+
* You can now use `--threads 5` or `threads 5` to config max/min threads with a single number (used to need to say `5:5`) ([#3309])
|
46
|
+
* Option to turn off systemd plugin ([#3425], [#3424])
|
47
|
+
* Add `on_stopped` hook ([#3411], [#3380])
|
48
|
+
|
49
|
+
* Bugfixes
|
50
|
+
* Handle blank environment variables when loading config ([#3539])
|
51
|
+
* lib/rack/handler/puma.rb - fix for rackup v1.0.1, adjust Gemfile ([#3532], [#3531])
|
52
|
+
* null_io.rb - add `external_encoding`, `set_encoding`, `binmode`, `binmode?` ([#3214])
|
53
|
+
* Implement NullIO#seek and #pos to mimic IO ([#3468])
|
54
|
+
* add support in rack handler & fix regression in binder for linux abstract namespace sockets ([#3508])
|
55
|
+
* Use actual thread local for `Puma::Server.current`. ([#3360])
|
56
|
+
* client.rb - fix request chunked body handling ([#3338], [#3337])
|
57
|
+
* Properly handle two requests seen in the initial buffer ([#3332])
|
58
|
+
* Fix response repeated status line when request is invalid or errors are raised ([#3308], [#3307])
|
59
|
+
* Fix child processes not being reaped when `Process.detach` used ([#3314], [#3313])
|
60
|
+
|
61
|
+
* JRuby
|
62
|
+
* Make HTTP length constants configurable ([#3518])
|
63
|
+
* Fixup jruby_restart.rb & launcher.rb to work with ARM64 macOS JRuby ([#3467])
|
64
|
+
|
65
|
+
* Performance
|
66
|
+
* Avoid checking if all workers reached timeout unless idle timeout is configured ([#3341])
|
67
|
+
* Request body - increase read size to 64 kB ([#3548])
|
68
|
+
* single mode skip wait_for_less_busy_worker ([#3325])
|
69
|
+
|
70
|
+
* Refactor
|
71
|
+
* A ton of CI/test improvements by @MSP-Greg, as usual.
|
72
|
+
* Add ThreadPool#stats and adjust Server#stats to use it ([#3527])
|
73
|
+
* normalize whitespace in worker stats string ([#3513])
|
74
|
+
* rack/handler/puma.rb - ssl - use `start_with?`, add test ([#3510])
|
75
|
+
* extconf.rb - add logging for OpenSSL versions ([#3370])
|
76
|
+
* Lazily require `Puma::Rack::Builder` ([#3340])
|
77
|
+
* Refactor: Constantize worker pipe request types ([#3318])
|
78
|
+
|
79
|
+
* Docs
|
80
|
+
* stats.md improvements ([#3514])
|
81
|
+
* control_cli.rb: Harmonize help message with bin/puma ([#3434])
|
82
|
+
* dsl.rb: Clarify a callback's argument ([#3435])
|
83
|
+
* lib/rack/handler/puma.rb - relocate and fixup module comment ([#3495])
|
84
|
+
|
1
85
|
## 6.4.3 / 2024-09-19
|
2
86
|
|
3
87
|
* Security
|
@@ -89,7 +173,7 @@
|
|
89
173
|
|
90
174
|
* Features
|
91
175
|
* Ability to supply a custom logger ([#2770], [#2511])
|
92
|
-
* Warn when
|
176
|
+
* Warn when cluster mode-only hooks are defined in single mode ([#3089])
|
93
177
|
* Adds the on_booted event ([#2709])
|
94
178
|
|
95
179
|
* Bugfixes
|
@@ -182,6 +266,9 @@
|
|
182
266
|
|
183
267
|
* Security
|
184
268
|
* Discards any headers using underscores if the non-underscore version also exists. Without this, an attacker could overwrite values set by intermediate proxies (e.g. X-Forwarded-For). ([CVE-2024-45614](https://github.com/puma/puma/security/advisories/GHSA-9hf4-67fc-4vf4)/GHSA-9hf4-67fc-4vf4)
|
269
|
+
* JRuby
|
270
|
+
* Must use at least Java >= 9 to compile. You can no longer build from source on Java 8.
|
271
|
+
|
185
272
|
|
186
273
|
## 5.6.8 / 2024-01-08
|
187
274
|
|
@@ -681,7 +768,7 @@ Each patchlevel release contains a separate security fix. We recommend simply up
|
|
681
768
|
* Fix Java 8 support ([#1773])
|
682
769
|
* Fix error `uninitialized constant Puma::Cluster` ([#1731])
|
683
770
|
* Fix `not_token` being able to be set to true ([#1803])
|
684
|
-
* Fix "Hang on SIGTERM with ruby 2.6 in
|
771
|
+
* Fix "Hang on SIGTERM with ruby 2.6 in cluster mode" (PR [#1741], [#1674], [#1720], [#1730], [#1755])
|
685
772
|
|
686
773
|
## 3.12.1 / 2019-03-19
|
687
774
|
|
@@ -1092,7 +1179,7 @@ Each patchlevel release contains a separate security fix. We recommend simply up
|
|
1092
1179
|
* 4 minor features:
|
1093
1180
|
|
1094
1181
|
* Listen to unix socket with provided backlog if any
|
1095
|
-
* Improves the
|
1182
|
+
* Improves the cluster mode stats to report worker stats
|
1096
1183
|
* Pass the env to the lowlevel_error handler. Fixes [#854]
|
1097
1184
|
* Treat path-like hosts as unix sockets. Fixes [#824]
|
1098
1185
|
|
@@ -1819,7 +1906,7 @@ The "clearly I don't have enough tests for the config" release.
|
|
1819
1906
|
|
1820
1907
|
* 3 doc changes:
|
1821
1908
|
* Add note about on_worker_boot hook
|
1822
|
-
* Add some documentation for
|
1909
|
+
* Add some documentation for Cluster mode
|
1823
1910
|
* Added quotes to /etc/puma.conf
|
1824
1911
|
|
1825
1912
|
## 2.0.1 / 2013-04-30
|
@@ -2073,6 +2160,71 @@ be added back in a future date when a java Puma::MiniSSL is added.
|
|
2073
2160
|
* Bugfixes
|
2074
2161
|
* Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
|
2075
2162
|
|
2163
|
+
[#3680]:https://github.com/puma/puma/pull/3680 "PR by @byroot, merged 2025-07-31"
|
2164
|
+
[#3572]:https://github.com/puma/puma/pull/3572 "PR by @barthez, merged 2025-02-06"
|
2165
|
+
[#3586]:https://github.com/puma/puma/pull/3586 "PR by @MSP-Greg, merged 2025-02-03"
|
2166
|
+
[#3598]:https://github.com/puma/puma/pull/3598 "PR by @joshuay03, merged 2025-01-31"
|
2167
|
+
[#3601]:https://github.com/puma/puma/pull/3601 "PR by @joshuay03, merged 2025-01-31"
|
2168
|
+
[#3635]:https://github.com/puma/puma/pull/3635 "PR by @LevitatingBusinessMan, merged 2025-05-08"
|
2169
|
+
[#3570]:https://github.com/puma/puma/pull/3570 "PR by @mohamedhafez, merged 2024-12-30"
|
2170
|
+
[#3567]:https://github.com/puma/puma/issues/3567 "Issue by @mohamedhafez, closed 2024-12-30"
|
2171
|
+
[#3383]:https://github.com/puma/puma/pull/3383 "PR by @joshuay03, merged 2024-11-29"
|
2172
|
+
[#3386]:https://github.com/puma/puma/pull/3386 "PR by @Drakula2k, merged 2024-11-27"
|
2173
|
+
[#3517]:https://github.com/puma/puma/pull/3517 "PR by @jjb, merged 2024-11-26"
|
2174
|
+
[#3375]:https://github.com/puma/puma/pull/3375 "PR by @joshuay03, merged 2024-11-23"
|
2175
|
+
[#3348]:https://github.com/puma/puma/pull/3348 "PR by @tomurb, merged 2024-11-23"
|
2176
|
+
[#3302]:https://github.com/puma/puma/issues/3302 "Issue by @benburkert, closed 2024-11-23"
|
2177
|
+
[#3384]:https://github.com/puma/puma/pull/3384 "PR by @joshuay03, merged 2024-11-23"
|
2178
|
+
[#3590]:https://github.com/puma/puma/pull/3590 "PR by @MSP-Greg, merged 2025-01-01"
|
2179
|
+
[#3552]:https://github.com/puma/puma/issues/3552 "Issue by @utay, closed 2025-01-01"
|
2180
|
+
[#3568]:https://github.com/puma/puma/pull/3568 "PR by @joshuay03, merged 2024-12-11"
|
2181
|
+
[#3505]:https://github.com/puma/puma/pull/3505 "PR by @AnthonyClark, merged 2025-01-27"
|
2182
|
+
[#3595]:https://github.com/puma/puma/pull/3595 "PR by @nateberkopec, merged 2025-01-07"
|
2183
|
+
[#3565]:https://github.com/puma/puma/pull/3565 "PR by @MSP-Greg, merged 2024-11-28"
|
2184
|
+
[#3376]:https://github.com/puma/puma/pull/3376 "PR by @joshuay03, merged 2024-11-23"
|
2185
|
+
[#3407]:https://github.com/puma/puma/pull/3407 "PR by @JacobEvelyn, merged 2024-11-05"
|
2186
|
+
[#3439]:https://github.com/puma/puma/pull/3439 "PR by @codergeek121, merged 2024-11-04"
|
2187
|
+
[#3437]:https://github.com/puma/puma/issues/3437 "Issue by @rafaelfranca, closed 2024-11-04"
|
2188
|
+
[#3486]:https://github.com/puma/puma/pull/3486 "PR by @mohamedhafez, merged 2024-09-26"
|
2189
|
+
[#3422]:https://github.com/puma/puma/issues/3422 "Issue by @mohamedhafez, closed 2024-09-26"
|
2190
|
+
[#3496]:https://github.com/puma/puma/pull/3496 "PR by @slizco, merged 2024-09-26"
|
2191
|
+
[#3485]:https://github.com/puma/puma/pull/3485 "PR by @MSP-Greg, merged 2024-09-21"
|
2192
|
+
[#3359]:https://github.com/puma/puma/pull/3359 "PR by @willayton, merged 2024-04-11"
|
2193
|
+
[#3343]:https://github.com/puma/puma/issues/3343 "Issue by @willayton, closed 2024-04-11"
|
2194
|
+
[#3309]:https://github.com/puma/puma/pull/3309 "PR by @byroot, merged 2024-01-09"
|
2195
|
+
[#3425]:https://github.com/puma/puma/pull/3425 "PR by @mohamedhafez, merged 2024-07-14"
|
2196
|
+
[#3424]:https://github.com/puma/puma/issues/3424 "Issue by @mohamedhafez, closed 2024-07-14"
|
2197
|
+
[#3411]:https://github.com/puma/puma/pull/3411 "PR by @OuYangJinTing, merged 2024-06-15"
|
2198
|
+
[#3380]:https://github.com/puma/puma/pull/3380 "PR by @emilyst, closed 2024-06-15"
|
2199
|
+
[#3539]:https://github.com/puma/puma/pull/3539 "PR by @caius, merged 2024-11-20"
|
2200
|
+
[#3532]:https://github.com/puma/puma/pull/3532 "PR by @MSP-Greg, merged 2024-10-24"
|
2201
|
+
[#3531]:https://github.com/puma/puma/issues/3531 "Issue by @tagliala, closed 2024-10-24"
|
2202
|
+
[#3214]:https://github.com/puma/puma/pull/3214 "PR by @MSP-Greg, merged 2024-10-15"
|
2203
|
+
[#3468]:https://github.com/puma/puma/pull/3468 "PR by @foca, merged 2024-10-04"
|
2204
|
+
[#3508]:https://github.com/puma/puma/pull/3508 "PR by @MayCXC, merged 2024-10-02"
|
2205
|
+
[#3360]:https://github.com/puma/puma/pull/3360 "PR by @ioquatix, merged 2024-04-24"
|
2206
|
+
[#3338]:https://github.com/puma/puma/pull/3338 "PR by @MSP-Greg, merged 2024-04-11"
|
2207
|
+
[#3337]:https://github.com/puma/puma/issues/3337 "Issue by @skliew, closed 2024-04-11"
|
2208
|
+
[#3332]:https://github.com/puma/puma/pull/3332 "PR by @evanphx, merged 2024-02-18"
|
2209
|
+
[#3308]:https://github.com/puma/puma/pull/3308 "PR by @MSP-Greg, merged 2024-01-31"
|
2210
|
+
[#3307]:https://github.com/puma/puma/issues/3307 "Issue by @nateberkopec, closed 2024-01-31"
|
2211
|
+
[#3314]:https://github.com/puma/puma/pull/3314 "PR by @stanhu, merged 2024-01-26"
|
2212
|
+
[#3313]:https://github.com/puma/puma/issues/3313 "Issue by @stanhu, closed 2024-01-26"
|
2213
|
+
[#3518]:https://github.com/puma/puma/pull/3518 "PR by @roque86, merged 2024-11-15"
|
2214
|
+
[#3467]:https://github.com/puma/puma/pull/3467 "PR by @MSP-Greg, merged 2024-09-21"
|
2215
|
+
[#3341]:https://github.com/puma/puma/pull/3341 "PR by @joshuay03, merged 2024-03-11"
|
2216
|
+
[#3548]:https://github.com/puma/puma/pull/3548 "PR by @MSP-Greg, merged 2024-11-21"
|
2217
|
+
[#3325]:https://github.com/puma/puma/pull/3325 "PR by @OuYangJinTing, merged 2024-10-22"
|
2218
|
+
[#3527]:https://github.com/puma/puma/pull/3527 "PR by @MSP-Greg, merged 2024-10-26"
|
2219
|
+
[#3513]:https://github.com/puma/puma/pull/3513 "PR by @jjb, merged 2024-10-11"
|
2220
|
+
[#3510]:https://github.com/puma/puma/pull/3510 "PR by @MSP-Greg, merged 2024-10-03"
|
2221
|
+
[#3370]:https://github.com/puma/puma/pull/3370 "PR by @MSP-Greg, merged 2024-04-15"
|
2222
|
+
[#3340]:https://github.com/puma/puma/pull/3340 "PR by @joshuay03, merged 2024-03-10"
|
2223
|
+
[#3318]:https://github.com/puma/puma/pull/3318 "PR by @joshuay03, merged 2024-01-15"
|
2224
|
+
[#3514]:https://github.com/puma/puma/pull/3514 "PR by @jjb, merged 2024-10-11"
|
2225
|
+
[#3434]:https://github.com/puma/puma/pull/3434 "PR by @olleolleolle, merged 2024-09-19"
|
2226
|
+
[#3435]:https://github.com/puma/puma/pull/3435 "PR by @olleolleolle, merged 2024-09-19"
|
2227
|
+
[#3495]:https://github.com/puma/puma/pull/3495 "PR by @MSP-Greg, merged 2024-09-19"
|
2076
2228
|
[#3256]:https://github.com/puma/puma/pull/3256 "PR by @MSP-Greg, merged 2023-10-16"
|
2077
2229
|
[#3235]:https://github.com/puma/puma/pull/3235 "PR by @joshuay03, merged 2023-10-03"
|
2078
2230
|
[#3228]:https://github.com/puma/puma/issues/3228 "Issue by @davidalejandroaguilar, closed 2023-10-03"
|
@@ -2614,14 +2766,14 @@ be added back in a future date when a java Puma::MiniSSL is added.
|
|
2614
2766
|
[#782]:https://github.com/puma/puma/issues/782 "Issue by @Tonkpils, closed 2016-07-19"
|
2615
2767
|
[#1010]:https://github.com/puma/puma/issues/1010 "Issue by @mneumark, closed 2016-07-19"
|
2616
2768
|
[#959]:https://github.com/puma/puma/issues/959 "Issue by @mwpastore, closed 2016-04-22"
|
2617
|
-
[#840]:https://github.com/puma/puma/issues/840 "Issue by @
|
2769
|
+
[#840]:https://github.com/puma/puma/issues/840 "Issue by @marisawallace, closed 2016-04-07"
|
2618
2770
|
[#1007]:https://github.com/puma/puma/pull/1007 "PR by @willnet, merged 2016-06-24"
|
2619
2771
|
[#1014]:https://github.com/puma/puma/pull/1014 "PR by @szymon-jez, merged 2016-07-11"
|
2620
2772
|
[#1015]:https://github.com/puma/puma/pull/1015 "PR by @bf4, merged 2016-07-19"
|
2621
2773
|
[#1017]:https://github.com/puma/puma/pull/1017 "PR by @jorihardman, merged 2016-07-19"
|
2622
2774
|
[#954]:https://github.com/puma/puma/pull/954 "PR by @jf, merged 2016-04-12"
|
2623
2775
|
[#955]:https://github.com/puma/puma/pull/955 "PR by @jf, merged 2016-04-22"
|
2624
|
-
[#956]:https://github.com/puma/puma/pull/956 "PR by @
|
2776
|
+
[#956]:https://github.com/puma/puma/pull/956 "PR by @marisawallace, merged 2016-04-12"
|
2625
2777
|
[#960]:https://github.com/puma/puma/pull/960 "PR by @kmayer, merged 2016-04-15"
|
2626
2778
|
[#969]:https://github.com/puma/puma/pull/969 "PR by @frankwong15, merged 2016-05-10"
|
2627
2779
|
[#970]:https://github.com/puma/puma/pull/970 "PR by @willnet, merged 2016-04-26"
|
@@ -2682,7 +2834,7 @@ be added back in a future date when a java Puma::MiniSSL is added.
|
|
2682
2834
|
[#845]:https://github.com/puma/puma/pull/845 "PR by @deepj, merged 2016-01-28"
|
2683
2835
|
[#846]:https://github.com/puma/puma/pull/846 "PR by @sriedel, merged 2016-01-15"
|
2684
2836
|
[#850]:https://github.com/puma/puma/pull/850 "PR by @deepj, merged 2016-01-15"
|
2685
|
-
[#853]:https://github.com/puma/puma/pull/853 "PR by @
|
2837
|
+
[#853]:https://github.com/puma/puma/pull/853 "PR by @xuqiyong666, merged 2016-01-28"
|
2686
2838
|
[#857]:https://github.com/puma/puma/pull/857 "PR by @osheroff, merged 2016-01-15"
|
2687
2839
|
[#858]:https://github.com/puma/puma/pull/858 "PR by @mlarraz, merged 2016-01-28"
|
2688
2840
|
[#860]:https://github.com/puma/puma/pull/860 "PR by @osheroff, merged 2016-01-15"
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
# Puma: A Ruby Web Server Built For Parallelism
|
6
6
|
|
7
|
-
[](https://github.com/puma/puma/actions/workflows/tests.yml?query=branch%3Amaster)
|
8
8
|
[](https://codeclimate.com/github/puma/puma)
|
9
9
|
[]( https://stackoverflow.com/questions/tagged/puma )
|
10
10
|
|
@@ -12,7 +12,7 @@ Puma is a **simple, fast, multi-threaded, and highly parallel HTTP 1.1 server fo
|
|
12
12
|
|
13
13
|
## Built For Speed & Parallelism
|
14
14
|
|
15
|
-
Puma is a server for [Rack](https://github.com/rack/rack)-powered HTTP applications written in Ruby. It is:
|
15
|
+
Puma is a server for [Rack](https://github.com/rack/rack)-powered HTTP applications written in Ruby. It is:
|
16
16
|
* **Multi-threaded**. Each request is served in a separate thread. This helps you serve more requests per second with less memory use.
|
17
17
|
* **Multi-process**. "Pre-forks" in cluster mode, using less memory per-process thanks to copy-on-write memory.
|
18
18
|
* **Standalone**. With SSL support, zero-downtime rolling restarts and a built-in request bufferer, you can deploy Puma without any reverse proxy.
|
@@ -102,9 +102,9 @@ Puma will automatically scale the number of threads, from the minimum until it c
|
|
102
102
|
|
103
103
|
Be aware that additionally Puma creates threads on its own for internal purposes (e.g. handling slow clients). So, even if you specify -t 1:1, expect around 7 threads created in your application.
|
104
104
|
|
105
|
-
###
|
105
|
+
### Cluster mode
|
106
106
|
|
107
|
-
Puma also offers "
|
107
|
+
Puma also offers "cluster mode". Cluster mode `fork`s workers from a master process. Each child process still has its own thread pool. You can tune the number of workers with the `-w` (or `--workers`) flag:
|
108
108
|
|
109
109
|
```
|
110
110
|
$ puma -t 8:32 -w 3
|
@@ -116,11 +116,13 @@ Or with the `WEB_CONCURRENCY` environment variable:
|
|
116
116
|
$ WEB_CONCURRENCY=3 puma -t 8:32
|
117
117
|
```
|
118
118
|
|
119
|
-
Note that threads are still used in
|
119
|
+
Note that threads are still used in cluster 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.
|
120
|
+
|
121
|
+
If the `WEB_CONCURRENCY` environment variable is set to `"auto"` and the `concurrent-ruby` gem is available in your application, Puma will set the worker process count to the result of [available processors](https://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent.html#available_processor_count-class_method).
|
120
122
|
|
121
123
|
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
124
|
|
123
|
-
In
|
125
|
+
In cluster 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).
|
124
126
|
|
125
127
|
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:
|
126
128
|
|
@@ -138,51 +140,101 @@ preload_app!
|
|
138
140
|
|
139
141
|
Preloading can’t be used with phased restart, since phased restart kills and restarts workers one-by-one, and preloading copies the code of master into the workers.
|
140
142
|
|
141
|
-
|
143
|
+
#### Cluster mode hooks
|
144
|
+
|
145
|
+
When using cluster mode, Puma's configuration DSL provides `before_fork` and `on_worker_boot`
|
146
|
+
hooks to run code when the master process forks and child workers are booted respectively.
|
147
|
+
|
148
|
+
It is recommended to use these hooks with `preload_app!`, otherwise constants loaded by your
|
149
|
+
application (such as `Rails`) will not be available inside the hooks.
|
142
150
|
|
143
151
|
```ruby
|
144
152
|
# config/puma.rb
|
153
|
+
before_fork do
|
154
|
+
# Add code to run inside the Puma master process before it forks a worker child.
|
155
|
+
end
|
156
|
+
|
145
157
|
on_worker_boot do
|
146
|
-
#
|
158
|
+
# Add code to run inside the Puma worker process after forking.
|
147
159
|
end
|
148
160
|
```
|
149
161
|
|
150
|
-
|
151
|
-
|
152
|
-
For instance, you could fire a log notification that a worker booted or send something to statsd. This can be called multiple times.
|
162
|
+
In addition, there is an `on_refork` and `after_refork` hooks which are used only in [`fork_worker` mode](docs/fork_worker.md),
|
163
|
+
when the worker 0 child process forks a grandchild worker:
|
153
164
|
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
165
|
+
```ruby
|
166
|
+
on_refork do
|
167
|
+
# Used only when fork_worker mode is enabled. Add code to run inside the Puma worker 0
|
168
|
+
# child process before it forks a grandchild worker.
|
169
|
+
end
|
170
|
+
```
|
158
171
|
|
159
172
|
```ruby
|
160
|
-
|
161
|
-
|
162
|
-
#
|
173
|
+
after_refork do
|
174
|
+
# Used only when fork_worker mode is enabled. Add code to run inside the Puma worker 0
|
175
|
+
# child process after it forks a grandchild worker.
|
163
176
|
end
|
164
177
|
```
|
165
178
|
|
166
|
-
|
179
|
+
Importantly, note the following considerations when Ruby forks a child process:
|
180
|
+
|
181
|
+
1. File descriptors such as network sockets **are** copied from the parent to the forked
|
182
|
+
child process. Dual-use of the same sockets by parent and child will result in I/O conflicts
|
183
|
+
such as `SocketError`, `Errno::EPIPE`, and `EOFError`.
|
184
|
+
2. Background Ruby threads, including threads used by various third-party gems for connection
|
185
|
+
monitoring, etc., are **not** copied to the child process. Often this does not cause
|
186
|
+
immediate problems until a third-party connection goes down, at which point there will
|
187
|
+
be no supervisor to reconnect it.
|
188
|
+
|
189
|
+
Therefore, we recommend the following:
|
190
|
+
|
191
|
+
1. If possible, do not establish any socket connections (HTTP, database connections, etc.)
|
192
|
+
inside Puma's master process when booting.
|
193
|
+
2. If (1) is not possible, use `before_fork` and `on_refork` to disconnect the parent's socket
|
194
|
+
connections when forking, so that they are not accidentally copied to the child process.
|
195
|
+
3. Use `on_worker_boot` to restart any background threads on the forked child.
|
196
|
+
4. Use `after_refork` to restart any background threads on the parent.
|
197
|
+
|
198
|
+
#### Master process lifecycle hooks
|
199
|
+
|
200
|
+
Puma's configuration DSL provides master process lifecycle hooks `on_booted`, `on_restart`, and `on_stopped`
|
201
|
+
which may be used to specify code blocks to run on each event:
|
167
202
|
|
168
203
|
```ruby
|
169
204
|
# config/puma.rb
|
170
205
|
on_booted do
|
171
|
-
#
|
206
|
+
# Add code to run in the Puma master process after it boots,
|
207
|
+
# and also after a phased restart completes.
|
208
|
+
end
|
209
|
+
|
210
|
+
on_restart do
|
211
|
+
# Add code to run in the Puma master process when it receives
|
212
|
+
# a restart command but before it restarts.
|
213
|
+
end
|
214
|
+
|
215
|
+
on_stopped do
|
216
|
+
# Add code to run in the Puma master process when it receives
|
217
|
+
# a stop command but before it shuts down.
|
172
218
|
end
|
173
219
|
```
|
174
220
|
|
175
221
|
### Error handling
|
176
222
|
|
177
|
-
If
|
223
|
+
If Puma encounters an error outside of the context of your application, it will respond with a 400/500 and a simple
|
178
224
|
textual error message (see `Puma::Server#lowlevel_error` or [server.rb](https://github.com/puma/puma/blob/master/lib/puma/server.rb)).
|
179
225
|
You can specify custom behavior for this scenario. For example, you can report the error to your third-party
|
180
226
|
error-tracking service (in this example, [rollbar](https://rollbar.com)):
|
181
227
|
|
182
228
|
```ruby
|
183
|
-
lowlevel_error_handler do |e|
|
184
|
-
|
185
|
-
|
229
|
+
lowlevel_error_handler do |e, env, status|
|
230
|
+
if status == 400
|
231
|
+
message = "The server could not process the request due to an error, such as an incorrectly typed URL, malformed syntax, or a URL that contains illegal characters.\n"
|
232
|
+
else
|
233
|
+
message = "An error has occurred, and engineers have been informed. Please reload the page. If you continue to have problems, contact support@example.com\n"
|
234
|
+
Rollbar.critical(e)
|
235
|
+
end
|
236
|
+
|
237
|
+
[status, {}, [message]]
|
186
238
|
end
|
187
239
|
```
|
188
240
|
|
@@ -249,7 +301,7 @@ $ puma -b ssl://localhost:9292 -b tcp://localhost:9393 -C config/use_local_host.
|
|
249
301
|
|
250
302
|
#### Controlling SSL Cipher Suites
|
251
303
|
|
252
|
-
To use or avoid specific SSL
|
304
|
+
To use or avoid specific SSL ciphers for TLSv1.2 and below, use `ssl_cipher_filter` or `ssl_cipher_list` options.
|
253
305
|
|
254
306
|
##### Ruby:
|
255
307
|
|
@@ -263,6 +315,14 @@ $ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ssl_cipher_fil
|
|
263
315
|
$ 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'
|
264
316
|
```
|
265
317
|
|
318
|
+
To configure the available TLSv1.3 ciphersuites, use `ssl_ciphersuites` option (not available for JRuby).
|
319
|
+
|
320
|
+
##### Ruby:
|
321
|
+
|
322
|
+
```
|
323
|
+
$ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&ssl_ciphersuites=TLS_AES_256_GCM_SHA384:TLS_AES_128_GCM_SHA256'
|
324
|
+
```
|
325
|
+
|
266
326
|
See https://www.openssl.org/docs/man1.1.1/man1/ciphers.html for cipher filter format and full list of cipher suites.
|
267
327
|
|
268
328
|
Disable TLS v1 with the `no_tlsv1` option:
|
@@ -279,7 +339,7 @@ To enable verification flags offered by OpenSSL, use `verification_flags` (not a
|
|
279
339
|
$ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN'
|
280
340
|
```
|
281
341
|
|
282
|
-
You can also set multiple verification flags (by separating them with
|
342
|
+
You can also set multiple verification flags (by separating them with a comma):
|
283
343
|
|
284
344
|
```
|
285
345
|
$ puma -b 'ssl://127.0.0.1:9292?key=path_to_key&cert=path_to_cert&verification_flags=PARTIAL_CHAIN,CRL_CHECK'
|
data/docs/fork_worker.md
CHANGED
@@ -22,10 +22,20 @@ The `fork_worker` option allows your application to be initialized only once for
|
|
22
22
|
|
23
23
|
You can trigger a refork by sending the cluster the `SIGURG` signal or running the `pumactl refork` command at any time. A refork will also automatically trigger once, after a certain number of requests have been processed by worker 0 (default 1000). To configure the number of requests before the auto-refork, pass a positive integer argument to `fork_worker` (e.g., `fork_worker 1000`), or `0` to disable.
|
24
24
|
|
25
|
+
### Usage Considerations
|
26
|
+
|
27
|
+
- `fork_worker` introduces new `on_refork` and `after_refork` configuration hooks. Note the following:
|
28
|
+
- When initially forking the parent process to the worker 0 child, `before_fork` will trigger on the parent process and `on_worker_boot` will trigger on the worker 0 child as normal.
|
29
|
+
- When forking the worker 0 child to grandchild workers, `on_refork` and `after_refork` will trigger on the worker 0 child, and `on_worker_boot` will trigger on each grandchild worker.
|
30
|
+
- For clarity, `before_fork` does not trigger on worker 0, and `after_refork` does not trigger on the grandchild.
|
31
|
+
- As a general migration guide:
|
32
|
+
- Copy any logic within your existing `before_fork` hook to the `on_refork` hook.
|
33
|
+
- Consider to copy logic from your `on_worker_boot` hook to the `after_refork` hook, if it is needed to reset the state of worker 0 after it forks.
|
34
|
+
|
25
35
|
### Limitations
|
26
36
|
|
27
37
|
- This mode is still very experimental so there may be bugs or edge-cases, particularly around expected behavior of existing hooks. Please open a [bug report](https://github.com/puma/puma/issues/new?template=bug_report.md) if you encounter any issues.
|
28
38
|
|
29
39
|
- In order to fork new workers cleanly, worker 0 shuts down its server and stops serving requests so there are no open file descriptors or other kinds of shared global state between processes, and to maximize copy-on-write efficiency across the newly-forked workers. This may temporarily reduce total capacity of the cluster during a phased restart / refork.
|
30
40
|
|
31
|
-
|
41
|
+
- In a cluster with `n` workers, a normal phased restart stops and restarts workers one by one while the application is loaded in each process, so `n-1` workers are available serving requests during the restart. In a phased restart in fork-worker mode, the application is first loaded in worker 0 while `n-1` workers are available, then worker 0 remains stopped while the rest of the workers are reloaded one by one, leaving only `n-2` workers to be available for a brief period of time. Reloading the rest of the workers should be quick because the application is preloaded at that point, but there may be situations where it can take longer (slow clients, long-running application code, slow worker-fork hooks, etc).
|
@@ -0,0 +1,54 @@
|
|
1
|
+
# Java Options
|
2
|
+
|
3
|
+
`System Properties` or `Environment Variables` can be used to change Puma's
|
4
|
+
default configuration for its Java extension. The provided values are evaluated
|
5
|
+
during initialization, and changes while running the app have no effect.
|
6
|
+
Moreover, default values may be used in case of invalid inputs.
|
7
|
+
|
8
|
+
## Supported Options
|
9
|
+
|
10
|
+
| ENV Name | Default Value | Validation |
|
11
|
+
|------------------------------|:-------------:|:------------------------:|
|
12
|
+
| PUMA_QUERY_STRING_MAX_LENGTH | 1024 * 10 | Positive natural number |
|
13
|
+
| PUMA_REQUEST_PATH_MAX_LENGTH | 8192 | Positive natural number |
|
14
|
+
| PUMA_REQUEST_URI_MAX_LENGTH | 1024 * 12 | Positive natural number |
|
15
|
+
| PUMA_SKIP_SIGUSR2 | nil | n/a |
|
16
|
+
|
17
|
+
## Examples
|
18
|
+
|
19
|
+
### Invalid inputs
|
20
|
+
|
21
|
+
An empty string will be handled as missing, and the default value will be used instead.
|
22
|
+
Puma will print an error message for other invalid values.
|
23
|
+
|
24
|
+
```
|
25
|
+
foo@bar:~/puma$ PUMA_QUERY_STRING_MAX_LENGTH=abc PUMA_REQUEST_PATH_MAX_LENGTH='' PUMA_REQUEST_URI_MAX_LENGTH=0 bundle exec bin/puma test/rackup/hello.ru
|
26
|
+
|
27
|
+
The value 0 for PUMA_REQUEST_URI_MAX_LENGTH is invalid. Using default value 12288 instead.
|
28
|
+
The value abc for PUMA_QUERY_STRING_MAX_LENGTH is invalid. Using default value 10240 instead.
|
29
|
+
Puma starting in single mode...
|
30
|
+
```
|
31
|
+
|
32
|
+
### Valid inputs
|
33
|
+
|
34
|
+
```
|
35
|
+
foo@bar:~/puma$ PUMA_REQUEST_PATH_MAX_LENGTH=9 bundle exec bin/puma test/rackup/hello.ru
|
36
|
+
|
37
|
+
Puma starting in single mode...
|
38
|
+
```
|
39
|
+
```
|
40
|
+
foo@bar:~ export path=/123456789 # 10 chars
|
41
|
+
foo@bar:~ curl "http://localhost:9292${path}"
|
42
|
+
|
43
|
+
Puma caught this error: HTTP element REQUEST_PATH is longer than the 9 allowed length. (Puma::HttpParserError)
|
44
|
+
|
45
|
+
foo@bar:~ export path=/12345678 # 9 chars
|
46
|
+
foo@bar:~ curl "http://localhost:9292${path}"
|
47
|
+
Hello World
|
48
|
+
```
|
49
|
+
|
50
|
+
### Java Flight Recorder Compatibility
|
51
|
+
|
52
|
+
Unfortunately Java Flight Recorder uses `SIGUSR2` internally. If you wish to
|
53
|
+
use JFR, turn off Puma's trapping of `SIGUSR2` by setting the environment variable
|
54
|
+
`PUMA_SKIP_SIGUSR2` to any value.
|
data/docs/plugins.md
CHANGED
@@ -36,3 +36,7 @@ object that is useful for additional configuration.
|
|
36
36
|
|
37
37
|
Public methods in [`Puma::Plugin`](../lib/puma/plugin.rb) are treated as a
|
38
38
|
public API for plugins.
|
39
|
+
|
40
|
+
## Binder hooks
|
41
|
+
|
42
|
+
There's `Puma::Binder#before_parse` method that allows to add proc to run before the body of `Puma::Binder#parse`. Example of usage can be found in [that repository](https://github.com/anchordotdev/puma-acme/blob/v0.1.3/lib/puma/acme/plugin.rb#L97-L118) (`before_parse_hook` could be renamed `before_parse`, making monkey patching of [binder.rb](https://github.com/anchordotdev/puma-acme/blob/v0.1.3/lib/puma/acme/binder.rb) is unnecessary).
|
data/docs/signals.md
CHANGED
@@ -17,13 +17,13 @@ $ ps aux | grep tail
|
|
17
17
|
schneems 87152 0.0 0.0 2432772 492 s032 S+ 12:46PM 0:00.00 tail -f my.log
|
18
18
|
```
|
19
19
|
|
20
|
-
You can send a signal in Ruby using the [Process module](https://
|
20
|
+
You can send a signal in Ruby using the [Process module](https://docs.ruby-lang.org/en/master/Process.html#method-c-kill):
|
21
21
|
|
22
22
|
```
|
23
23
|
$ irb
|
24
24
|
> puts pid
|
25
25
|
=> 87152
|
26
|
-
Process.detach(pid) # https://ruby-
|
26
|
+
Process.detach(pid) # https://docs.ruby-lang.org/en/master/Process.html#method-c-detach
|
27
27
|
Process.kill("TERM", pid)
|
28
28
|
```
|
29
29
|
|
data/docs/stats.md
CHANGED
@@ -55,9 +55,14 @@ end
|
|
55
55
|
|
56
56
|
When Puma runs in single mode, these stats are available at the top level. When Puma runs in cluster mode, these stats are available within the `worker_status` array in a hash labeled `last_status`, in an array of hashes where one hash represents each worker.
|
57
57
|
|
58
|
-
* backlog: requests that are waiting for an available thread to be available. if this is above 0, you need more capacity
|
59
|
-
* running: how many threads are
|
60
|
-
|
58
|
+
* backlog: requests that are waiting for an available thread to be available. if this is frequently above 0, you need more capacity.
|
59
|
+
* running: how many threads are spawned. A spawned thread may be busy processing a request or waiting for a new request. If `min_threads` and `max_threads` are set to the same number,
|
60
|
+
this will be a never-changing number (other than rare cases when a thread dies, etc).
|
61
|
+
* busy_threads: `running` - `how many threads are waiting to receive work` + `how many requests are waiting for a thread to pick them up`.
|
62
|
+
this is a "wholistic" stat reflecting the overall current state of work to be done and the capacity to do it.
|
63
|
+
* pool_capacity: `how many threads are waiting to receive work` + `max_threads` - `running`. In a typical configuration where `min_threads`
|
64
|
+
and `max_threads` are configured to the same number, this is simply `how many threads are waiting to receive work`. This number exists only as a stat
|
65
|
+
and is not used for any internal decisions, unlike `busy_theads`, which is usually a more useful stat.
|
61
66
|
* max_threads: the maximum number of threads Puma is configured to spool per worker
|
62
67
|
* requests_count: the number of requests this worker has served since starting
|
63
68
|
|
data/docs/systemd.md
CHANGED
@@ -72,7 +72,7 @@ systemd and Puma also support socket activation, where systemd opens the
|
|
72
72
|
listening socket(s) in advance and provides them to the Puma master process on
|
73
73
|
startup. Among other advantages, this keeps listening sockets open across puma
|
74
74
|
restarts and achieves graceful restarts, including when upgraded Puma, and is
|
75
|
-
compatible with both
|
75
|
+
compatible with both cluster mode and application preload.
|
76
76
|
|
77
77
|
**Note:** Any wrapper scripts which `exec`, or other indirections in `ExecStart`
|
78
78
|
may result in activated socket file descriptors being closed before reaching the
|
@@ -99,9 +99,11 @@ ListenStream=0.0.0.0:9293
|
|
99
99
|
# ListenStream=/run/puma.sock
|
100
100
|
|
101
101
|
# Socket options matching Puma defaults
|
102
|
-
NoDelay=true
|
103
102
|
ReusePort=true
|
104
103
|
Backlog=1024
|
104
|
+
# Enable this if you're using Puma with the "low_latency" option, read more in Puma DSL docs and systemd docs:
|
105
|
+
# https://www.freedesktop.org/software/systemd/man/latest/systemd.socket.html#NoDelay=
|
106
|
+
# NoDelay=true
|
105
107
|
|
106
108
|
[Install]
|
107
109
|
WantedBy=sockets.target
|
@@ -239,6 +241,13 @@ cap $stage puma:start --dry-run
|
|
239
241
|
cap $stage puma:stop --dry-run
|
240
242
|
~~~~
|
241
243
|
|
244
|
+
### Disabling Puma Systemd Integration
|
245
|
+
|
246
|
+
If you would like to disable Puma's systemd integration, for example if you handle it elsewhere
|
247
|
+
in your code yourself, simply set the the environment variable `PUMA_SKIP_SYSTEMD` to any value.
|
248
|
+
|
249
|
+
|
250
|
+
|
242
251
|
[Restart]: https://www.freedesktop.org/software/systemd/man/systemd.service.html#Restart=
|
243
252
|
[#1367]: https://github.com/puma/puma/issues/1367
|
244
253
|
[#1499]: https://github.com/puma/puma/issues/1499
|