-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bump puma from 6.3.1 to 6.4.0 #531
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Bumps [puma](https://github.com/puma/puma) from 6.3.1 to 6.4.0. - [Release notes](https://github.com/puma/puma/releases) - [Changelog](https://github.com/puma/puma/blob/master/History.md) - [Commits](puma/puma@v6.3.1...v6.4.0) --- updated-dependencies: - dependency-name: puma dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]>
gem compare puma 6.3.1 6.4.0 Compared versions: ["6.3.1", "6.4.0"]
DIFFERENT require_paths:
6.3.1: ["/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/puma-6.3.1", "lib"]
6.4.0: ["/opt/hostedtoolcache/Ruby/3.2.2/x64/lib/ruby/gems/3.2.0/extensions/x86_64-linux/3.2.0/puma-6.4.0", "lib"]
DIFFERENT version:
6.3.1: 6.3.1
6.4.0: 6.4.0
DIFFERENT files:
6.3.1->6.4.0:
* Changed:
History.md +42/-2
README.md +18/-9
docs/kubernetes.md +12/-0
ext/puma_http11/mini_ssl.c +61/-6
lib/puma/binder.rb +2/-2
lib/puma/cli.rb +4/-0
lib/puma/client.rb +4/-3
lib/puma/configuration.rb +3/-1
lib/puma/const.rb +2/-2
lib/puma/control_cli.rb +12/-5
lib/puma/dsl.rb +51/-4
lib/puma/rack/urlmap.rb +1/-1
lib/puma/runner.rb +5/-1
lib/puma/server.rb +52/-23
lib/puma/thread_pool.rb +34/-0 |
gem compare --diff puma 6.3.1 6.4.0 Compared versions: ["6.3.1", "6.4.0"]
DIFFERENT files:
6.3.1->6.4.0:
* Changed:
History.md
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/History.md 2023-09-22 02:33:53.163502601 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/History.md 2023-09-22 02:33:53.191502897 +0000
@@ -0,0 +1,18 @@
+## 6.4.0 / 2023-09-21
+
+* Features
+ * on_thread_exit hook ([#2920])
+ * on_thread_start_hook ([#3195])
+ * Shutdown on idle ([#3209], [#2580])
+ * New error message when control server port taken ([#3204])
+
+* Refactor
+ * Remove `Forwardable` dependency ([#3191], #3190)
+ * Update URLMap Regexp usage for Ruby v3.3 ([#3165])
+
+* Bugfixes
+ * Bring the cert_pem: parameter into parity with the cert: parameter to ssl_bind. ([#3174])
+ * Fix using control server with IPv6 host ([#3181])
+ * control_cli.rb - add require_relative 'log_writer' ([#3187])
+ * Fix cases where fallback Rack response wasn't sent to the client ([#3094])
+
@@ -18 +36 @@
- * Restore rack 1.6 compatibility Restore rack 1.6 compatibility ([#3156])
+ * Restore rack 1.6 compatibility ([#3156])
@@ -128,0 +147,10 @@
+## 5.6.7 / 2023-08-18
+
+* Security
+ * 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))
+
+## 5.6.6 / 2023-06-21
+
+* Bugfix
+ * Prevent loading with rack 3 ([#3166])
+
@@ -2003,0 +2032,11 @@
+[#2920]:https://github.com/puma/puma/pull/2920 "PR by @biinari, merged 2023-07-11"
+[#3195]:https://github.com/puma/puma/pull/3195 "PR by @binarygit, merged 2023-08-15"
+[#3209]:https://github.com/puma/puma/pull/3209 "PR by @joshuay03, merged 2023-09-04"
+[#2580]:https://github.com/puma/puma/issues/2580 "Issue by @schuetzm, closed 2023-09-04"
+[#3204]:https://github.com/puma/puma/pull/3204 "PR by @dhavalsingh, merged 2023-08-25"
+[#3191]:https://github.com/puma/puma/pull/3191 "PR by @MSP-Greg, merged 2023-08-31"
+[#3165]:https://github.com/puma/puma/pull/3165 "PR by @fallwith, merged 2023-06-06"
+[#3174]:https://github.com/puma/puma/pull/3174 "PR by @copiousfreetime, merged 2023-06-11"
+[#3181]:https://github.com/puma/puma/pull/3181 "PR by @MSP-Greg, merged 2023-06-23"
+[#3187]:https://github.com/puma/puma/pull/3187 "PR by @MSP-Greg, merged 2023-06-30"
+[#3094]:https://github.com/puma/puma/pull/3094 "PR by @Vuta, merged 2023-07-23"
@@ -2101,0 +2141 @@
+[#3166]:https://github.com/puma/puma/pull/3166 "PR by @JoeDupuis, merged 2023-06-08"
@@ -2128 +2168 @@
-[#2341]:https://github.com/puma/puma/issues/2341 "Issue by @cjlarose, opened 2020-08-18"
+[#2341]:https://github.com/puma/puma/issues/2341 "Issue by @cjlarose, closed 2023-07-23"
README.md
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/README.md 2023-09-22 02:33:53.167502643 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/README.md 2023-09-22 02:33:53.191502897 +0000
@@ -15 +15,5 @@
-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.
+Puma is a server for [Rack](https://github.com/rack/rack)-powered HTTP applications written in Ruby. It is:
+* **Multi-threaded**. Each request is served in a separate thread. This helps you serve more requests per second with less memory use.
+* **Multi-process**. "Pre-forks" in cluster mode, using less memory per-process thanks to copy-on-write memory.
+* **Standalone**. With SSL support, zero-downtime rolling restarts and a built-in request bufferer, you can deploy Puma without any reverse proxy.
+* **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.
@@ -19 +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.
+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.
@@ -116,0 +121,2 @@
+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).
+
@@ -213,0 +220 @@
+Add the gem to your Gemfile:
@@ -215 +221,0 @@
-# Add the gem to your Gemfile
@@ -218,0 +225 @@
+```
@@ -220 +227,2 @@
-# And require it implicitly using bundler
+And require it implicitly using bundler:
+```ruby
@@ -222,0 +231 @@
+```
@@ -224,2 +233,2 @@
-# Alternatively, you can require the gem in config.ru:
-require './app'
+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:
+```ruby
@@ -227 +236 @@
-run Sinatra::Application
+# configuration methods (from Puma::DSL) as needed
@@ -233 +242 @@
-$ puma -b 'ssl://localhost:9292' config.ru
+$ puma -b 'ssl://localhost:9292' -C config/use_local_host.rb
@@ -236 +245 @@
-$ puma -b ssl://localhost:9292 -b tcp://localhost:9393 config.ru
+$ puma -b ssl://localhost:9292 -b tcp://localhost:9393 -C config/use_local_host.rb
docs/kubernetes.md
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/docs/kubernetes.md 2023-09-22 02:33:53.171502685 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/docs/kubernetes.md 2023-09-22 02:33:53.195502939 +0000
@@ -66,0 +67,12 @@
+
+## Workers Per Pod, and Other Config Issues
+
+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.
+
+* 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.
+* 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.
+* 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.
+* 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.
+* 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.
+* 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).
+
ext/puma_http11/mini_ssl.c
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/ext/puma_http11/mini_ssl.c 2023-09-22 02:33:53.175502728 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/ext/puma_http11/mini_ssl.c 2023-09-22 02:33:53.203503023 +0000
@@ -38,0 +39,6 @@
+NORETURN(void raise_param_error(const char* caller, const char *param));
+
+void raise_param_error(const char* caller, const char *param) {
+ rb_raise(eError, "%s: error with parameter '%s': %s", caller, param, ERR_error_string(ERR_get_error(), NULL));
+}
+
@@ -229 +235 @@
- X509 *x509;
+ X509 *x509 = NULL;
@@ -300,0 +307,3 @@
+ X509 *ca = NULL;
+ unsigned long err;
+
@@ -302,0 +312,7 @@
+
+ /**
+ * Much of this pulled as a simplified version of the `use_certificate_chain_file` method
+ * from openssl's `ssl_rsa.c` file.
+ */
+
+ /* first read the cert as the first item in the pem file */
@@ -303,0 +320,40 @@
+ if (NULL == x509) {
+ BIO_free_all(bio);
+ raise_param_error("PEM_read_bio_X509", "cert_pem");
+ }
+
+ /* Add the cert to the context */
+ /* 1 is success - otherwise check the error codes */
+ if (1 != SSL_CTX_use_certificate(ctx, x509)) {
+ BIO_free_all(bio);
+ raise_param_error("SSL_CTX_use_certificate", "cert_pem");
+ }
+
+ X509_free(x509); /* no longer need our reference */
+
+ /* Now lets load up the rest of the certificate chain */
+ /* 1 is success 0 is error */
+ if (0 == SSL_CTX_clear_chain_certs(ctx)) {
+ BIO_free_all(bio);
+ raise_param_error("SSL_CTX_clear_chain_certs","cert_pem");
+ }
+
+ while (1) {
+ ca = PEM_read_bio_X509(bio, NULL, NULL, NULL);
+
+ if (NULL == ca) {
+ break;
+ }
+
+ if (0 == SSL_CTX_add0_chain_cert(ctx, ca)) {
+ BIO_free_all(bio);
+ raise_param_error("SSL_CTX_add0_chain_cert","cert_pem");
+ }
+ /* don't free ca - its now owned by the context */
+ }
+
+ /* ca is NULL - so its either the end of the file or an error */
+ err = ERR_peek_last_error();
+
+ /* If its the end of the file - then we are done, in any case free the bio */
+ BIO_free_all(bio);
@@ -305,3 +361,4 @@
- if (SSL_CTX_use_certificate(ctx, x509) != 1) {
- BIO_free(bio);
- raise_file_error("SSL_CTX_use_certificate", RSTRING_PTR(cert_pem));
+ if ((ERR_GET_LIB(err) == ERR_LIB_PEM) && (ERR_GET_REASON(err) == PEM_R_NO_START_LINE)) {
+ ERR_clear_error();
+ } else {
+ raise_param_error("PEM_read_bio_X509","cert_pem");
@@ -309,2 +365,0 @@
- X509_free(x509);
- BIO_free(bio);
lib/puma/binder.rb
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/lib/puma/binder.rb 2023-09-22 02:33:53.179502770 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/lib/puma/binder.rb 2023-09-22 02:33:53.203503023 +0000
@@ -333 +333 @@
- host = host[1..-2] if host and host[0..0] == '['
+ host = host[1..-2] if host&.start_with? '['
@@ -367 +367 @@
- host = host[1..-2] if host[0..0] == '['
+ host = host[1..-2] if host&.start_with? '['
lib/puma/cli.rb
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/lib/puma/cli.rb 2023-09-22 02:33:53.179502770 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/lib/puma/cli.rb 2023-09-22 02:33:53.207503065 +0000
@@ -146,0 +147,4 @@
+ o.on "--idle-timeout SECONDS", "Number of seconds until the next request before automatic shutdown" do |arg|
+ user_config.idle_timeout arg
+ end
+
lib/puma/client.rb
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/lib/puma/client.rb 2023-09-22 02:33:53.179502770 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/lib/puma/client.rb 2023-09-22 02:33:53.207503065 +0000
@@ -14 +13,0 @@
-require 'forwardable'
@@ -65 +63,0 @@
- extend Forwardable
@@ -114 +112,4 @@
- def_delegators :@io, :closed?
+ # Remove in Puma 7?
+ def closed?
+ @to_io.closed?
+ end
lib/puma/configuration.rb
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/lib/puma/configuration.rb 2023-09-22 02:33:53.179502770 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/lib/puma/configuration.rb 2023-09-22 02:33:53.207503065 +0000
@@ -136 +136 @@
- # Number of seconds to wait until we get the first data for the request
+ # Number of seconds to wait until we get the first data for the request.
@@ -137,0 +138,2 @@
+ # Number of seconds to wait until the next request before shutting down.
+ idle_timeout: nil,
lib/puma/const.rb
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/lib/puma/const.rb 2023-09-22 02:33:53.179502770 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/lib/puma/const.rb 2023-09-22 02:33:53.207503065 +0000
@@ -103,2 +103,2 @@
- PUMA_VERSION = VERSION = "6.3.1"
- CODE_NAME = "Mugi No Toki Itaru"
+ PUMA_VERSION = VERSION = "6.4.0"
+ CODE_NAME = "The Eagle of Durango"
lib/puma/control_cli.rb
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/lib/puma/control_cli.rb 2023-09-22 02:33:53.179502770 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/lib/puma/control_cli.rb 2023-09-22 02:33:53.207503065 +0000
@@ -4 +3,0 @@
-require_relative 'state_file'
@@ -7 +5,0 @@
-require_relative 'configuration'
@@ -128,0 +127,3 @@
+ require_relative 'configuration'
+ require_relative 'log_writer'
+
@@ -151,0 +153,2 @@
+ require_relative 'state_file'
+
@@ -166,0 +170,2 @@
+ host = uri.host
+
@@ -171,0 +177 @@
+ host = host[1..-2] if host&.start_with? '['
@@ -173 +179 @@
- TCPSocket.new(uri.host, uri.port),
+ TCPSocket.new(host, uri.port),
@@ -178 +184,2 @@
- TCPSocket.new uri.host, uri.port
+ host = host[1..-2] if host&.start_with? '['
+ TCPSocket.new host, uri.port
@@ -182 +189 @@
- "\0#{uri.host}#{uri.path}" : "#{uri.host}#{uri.path}")
+ "\0#{host}#{uri.path}" : "#{host}#{uri.path}")
lib/puma/dsl.rb
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/lib/puma/dsl.rb 2023-09-22 02:33:53.183502812 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/lib/puma/dsl.rb 2023-09-22 02:33:53.207503065 +0000
@@ -317,0 +318,6 @@
+ # Define how long the tcp socket stays open, if no data has been received.
+ # @see Puma::Server.new
+ def first_data_timeout(seconds)
+ @options[:first_data_timeout] = Integer(seconds)
+ end
+
@@ -324 +330 @@
- # Define how long the tcp socket stays open, if no data has been received.
+ # If a new request is not received within this number of seconds, begin shutting down.
@@ -326,2 +332,2 @@
- def first_data_timeout(seconds)
- @options[:first_data_timeout] = Integer(seconds)
+ def idle_timeout(seconds)
+ @options[:idle_timeout] = Integer(seconds)
@@ -512,0 +519,6 @@
+ # The `cert:` options hash parameter can be the path to a certificate
+ # file including all intermediate certificates in PEM format.
+ #
+ # The `cert_pem:` options hash parameter can be String containing the
+ # cerificate and all intermediate certificates in PEM format.
+ #
@@ -719,0 +732,34 @@
+ # Code to run immediately before a thread starts. The worker does not
+ # start new threads until this code finishes.
+ #
+ # This hook is useful for doing something when a thread
+ # starts.
+ #
+ # This can be called multiple times to add several hooks.
+ #
+ # @example
+ # on_thread_start do
+ # puts 'On thread start...'
+ # end
+ def on_thread_start(&block)
+ @options[:before_thread_start] ||= []
+ @options[:before_thread_start] << block
+ end
+
+ # Code to run immediately before a thread exits. The worker does not
+ # accept new requests until this code finishes.
+ #
+ # This hook is useful for cleaning up thread local resources when a thread
+ # is trimmed.
+ #
+ # This can be called multiple times to add several hooks.
+ #
+ # @example
+ # on_thread_exit do
+ # puts 'On thread exit...'
+ # end
+ def on_thread_exit(&block)
+ @options[:before_thread_exit] ||= []
+ @options[:before_thread_exit] << block
+ end
+
@@ -851 +897,2 @@
- # The minimum value is 6 seconds, the default value is 60 seconds.
+ # This value must be greater than worker_check_interval.
+ # The default value is 60 seconds.
lib/puma/rack/urlmap.rb
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/lib/puma/rack/urlmap.rb 2023-09-22 02:33:53.187502854 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/lib/puma/rack/urlmap.rb 2023-09-22 02:33:53.211503108 +0000
@@ -37 +37 @@
- match = Regexp.new("^#{Regexp.quote(location).gsub('/', '/+')}(.*)", nil, 'n')
+ match = Regexp.new("^#{Regexp.quote(location).gsub('/', '/+')}(.*)", Regexp::NOENCODING)
lib/puma/runner.rb
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/lib/puma/runner.rb 2023-09-22 02:33:53.187502854 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/lib/puma/runner.rb 2023-09-22 02:33:53.211503108 +0000
@@ -78 +78,5 @@
- control.binder.parse [str], nil, 'Starting control server'
+ begin
+ control.binder.parse [str], nil, 'Starting control server'
+ rescue Errno::EADDRINUSE, Errno::EACCES => e
+ raise e, "Error: Control server address '#{str}' is already in use. Original error: #{e.message}"
+ end
lib/puma/server.rb
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/lib/puma/server.rb 2023-09-22 02:33:53.187502854 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/lib/puma/server.rb 2023-09-22 02:33:53.215503150 +0000
@@ -18 +17,0 @@
-require 'forwardable'
@@ -35 +33,0 @@
- extend Forwardable
@@ -51,3 +48,0 @@
- def_delegators :@binder, :add_tcp_listener, :add_ssl_listener,
- :add_unix_listener, :connected_ports
-
@@ -89,9 +84,10 @@
- @log_writer = @options.fetch :log_writer, LogWriter.stdio
- @early_hints = @options[:early_hints]
- @first_data_timeout = @options[:first_data_timeout]
- @min_threads = @options[:min_threads]
- @max_threads = @options[:max_threads]
- @persistent_timeout = @options[:persistent_timeout]
- @queue_requests = @options[:queue_requests]
- @max_fast_inline = @options[:max_fast_inline]
- @io_selector_backend = @options[:io_selector_backend]
+ @log_writer = @options.fetch :log_writer, LogWriter.stdio
+ @early_hints = @options[:early_hints]
+ @first_data_timeout = @options[:first_data_timeout]
+ @persistent_timeout = @options[:persistent_timeout]
+ @idle_timeout = @options[:idle_timeout]
+ @min_threads = @options[:min_threads]
+ @max_threads = @options[:max_threads]
+ @queue_requests = @options[:queue_requests]
+ @max_fast_inline = @options[:max_fast_inline]
+ @io_selector_backend = @options[:io_selector_backend]
@@ -333,2 +329,6 @@
- ios = IO.select sockets, nil, nil, (shutting_down? ? 0 : nil)
- break unless ios
+ ios = IO.select sockets, nil, nil, (shutting_down? ? 0 : @idle_timeout)
+ unless ios
+ @status = :stop unless shutting_down?
+ break
+ end
+
@@ -479 +479 @@
- client_error(e, client)
+ client_error(e, client, requests)
@@ -507 +507 @@
- def client_error(e, client)
+ def client_error(e, client, requests = 1)
@@ -511 +510,0 @@
- lowlevel_error(e, client.env)
@@ -513,0 +513 @@
+ lowlevel_error(e, client.env)
@@ -516 +516 @@
- client.write_error(400)
+ response_to_error(client, requests, e, 400)
@@ -519 +519 @@
- client.write_error(501)
+ response_to_error(client, requests, e, 501)
@@ -522 +522 @@
- client.write_error(500)
+ response_to_error(client, requests, e, 500)
@@ -544 +544 @@
- [status, {}, ["An unhandled lowlevel error occurred. The application logs may have details.\n"]]
+ [status, {}, [""]]
@@ -547,0 +548,7 @@
+ def response_to_error(client, requests, err, status_code)
+ status, headers, res_body = lowlevel_error(err, client.env, status_code)
+ prepare_response(status, headers, res_body, requests, client)
+ client.write_error(status_code)
+ end
+ private :response_to_error
+
@@ -624,0 +632,22 @@
+ end
+
+ # below are 'delegations' to binder
+ # remove in Puma 7?
+
+
+ def add_tcp_listener(host, port, optimize_for_latency = true, backlog = 1024)
+ @binder.add_tcp_listener host, port, optimize_for_latency, backlog
+ end
+
+ def add_ssl_listener(host, port, ctx, optimize_for_latency = true,
+ backlog = 1024)
+ @binder.add_ssl_listener host, port, ctx, optimize_for_latency, backlog
+ end
+
+ def add_unix_listener(path, umask = nil, mode = nil, backlog = 1024)
+ @binder.add_unix_listener path, umask, mode, backlog
+ end
+
+ # @!attribute [r] connected_ports
+ def connected_ports
+ @binder.connected_ports
lib/puma/thread_pool.rb
--- /tmp/d20230922-1908-39tgub/puma-6.3.1/lib/puma/thread_pool.rb 2023-09-22 02:33:53.187502854 +0000
+++ /tmp/d20230922-1908-39tgub/puma-6.4.0/lib/puma/thread_pool.rb 2023-09-22 02:33:53.215503150 +0000
@@ -53,0 +54,2 @@
+ @before_thread_start = options[:before_thread_start]
+ @before_thread_exit = options[:before_thread_exit]
@@ -109,0 +112 @@
+ trigger_before_thread_start_hooks
@@ -127,0 +131 @@
+ trigger_before_thread_exit_hooks
@@ -163,0 +168,30 @@
+
+ def trigger_before_thread_start_hooks
+ return unless @before_thread_start&.any?
+
+ @before_thread_start.each do |b|
+ begin
+ b.call
+ rescue Exception => e
+ STDERR.puts "WARNING before_thread_start hook failed with exception (#{e.class}) #{e.message}"
+ end
+ end
+ nil
+ end
+
+ private :trigger_before_thread_start_hooks
+
+ def trigger_before_thread_exit_hooks
+ return unless @before_thread_exit&.any?
+
+ @before_thread_exit.each do |b|
+ begin
+ b.call
+ rescue Exception => e
+ STDERR.puts "WARNING before_thread_exit hook failed with exception (#{e.class}) #{e.message}"
+ end
+ end
+ nil
+ end
+
+ private :trigger_before_thread_exit_hooks |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bumps puma from 6.3.1 to 6.4.0.
Release notes
Sourced from puma's releases.
Changelog
Sourced from puma's changelog.
Commits
52eff8d
6.4.0 [ci skip] (#3224)68d9b97
[ci skip] | Docs | Clarifyworker_timeout
minimum value (#3226)04b8b09
Use the correct name for TruffleRuby (#3223)b09665b
Update README.md [ci skip]8259230
Update README.md9282a8e
Update kubernetes.md [ci skip]c4c26df
[CI] Bump actions/checkout from 3 to 4 (#3220)0b696a2
Feature | Shutdown on idle (#3209)2563396
RemoveForwardable
dependency (#3191)c2f7330
Added a Meaningful error msg for control server port taken (#3204)Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting
@dependabot rebase
.Dependabot commands and options
You can trigger Dependabot actions by commenting on this PR:
@dependabot rebase
will rebase this PR@dependabot recreate
will recreate this PR, overwriting any edits that have been made to it@dependabot merge
will merge this PR after your CI passes on it@dependabot squash and merge
will squash and merge this PR after your CI passes on it@dependabot cancel merge
will cancel a previously requested merge and block automerging@dependabot reopen
will reopen this PR if it is closed@dependabot close
will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually@dependabot show <dependency name> ignore conditions
will show all of the ignore conditions of the specified dependency@dependabot ignore this major version
will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this minor version
will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)@dependabot ignore this dependency
will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)