This feature commit was erroneously included because it was marked as both a bugfix and a feature. We generally try not to include new features in patch releases but this one slipped through. Sorry about that!
When you're trying to access a thread-local variable on Ruby < 2.7, and you call `thread_variable_get` on a `Process::Waiter` (a subclass of `Thread`), it will segfault. This adds a check for which Ruby version you're on to make it safe for Ruby 2.6.
Fixes#2566.
* Print warning when running one-worker cluster
Running Puma in cluster-mode is likely a misconfiguration in most
scenarios.
Cluster mode has some overhead of running an addtional 'control' process
in order to manage the cluster. If only running a single worker it is
likely not worth paying that overhead vs running in single mode with
additional threads instead.
There are some scenarios where running cluster mode with a single worker
may still be warranted and valid under certain deployment scenarios, see
the linked issue for details.
From experience at work, we were able to migrate our Rails applications
from single worker cluster to single-mode and saw a reduction of RAM
usage of around ~15%.
Closes#2534
* Remove link to issue
* Add #silence_single_worker_warning option
* Test single_worker_warning
* Restore sync=true on STDOUT/STDERR streams
* Move mutation of STDOUT and STDERR streams to `redirect_io`
This isn't technically related to redirecting the STDOUT and STDERR
streams, but moving it here keeps all of the STDOUT/STDERR logic
together. It seems like a more natural place to put it.
* Add a test to ensure that STDOUT is flushed by default
* Set @env[CONTENT_LENGTH] value as string.
* Update tests.
Update tests to reflect that CONTENT_LENGTH is now a string.
Add change to History.md.
* Update History.md
Co-authored-by: Patrik Ragnarsson <patrik@starkast.net>
Co-authored-by: Patrik Ragnarsson <patrik@starkast.net>
Contexts are currently created for every accepted ssl client. That isn't needed, but more importantly, Contexts read two files.
For a busy server, this results in slow clients.
Update to create the Context in MinSSL::Server.new, and pass it to MinSSL::Engine.server.
Only affects MRI builds.
* Allow specifying the desired IO selector backend
nio4r will soon have experimental support for io_uring via libev. The brave
might want to try it out :) regardless of that, allowing users to explicitly
set the IO selector backend seems like a good idea to me.
* Change History.md
* Add PR number
* Fix History.md
Oops!
* Update docs based on PR feedback
* Add test serving requests using a custom IO selector
* Document the NIO4R_PURE environment variable
* Raise clearer error when the requested backend is unsupported
* Simply boot the server and check the backend