- Wait for threads to enter waiting loop on ThreadPool startup
- Simplify #spawn_thread inner threadpool loop
- Refactor TestThreadPool to make tests faster and more stable
Co-authored-by: Nate Berkopec <nate.berkopec@gmail.com>
* Skip TestThreadPool#test_trim_leaves_min on JRuby
* It fails frequently there too.
* Use Bundler 1 in CI
* Using Bundler 2 seems to cause several failures:
https://github.com/puma/puma/runs/553627446
* Support skip_on :truffleruby
* Remove unused variable declaration
* Properly skip tests which need fork
* Improve NO_FORK_MSG
* Keep the Tempfile instances alive in test_redirect_io.rb
* Otherwise they could GC in the middle of the test, and the files could
then be deleted.
* Use a better way to find a free port
* Read directly from the socket in #read_and_drop
* There is no point to decode the bytes since we are closing the socket
in Puma::MiniSSL::Socket#close.
* Also, calling #engine_read_all might cause further SSL errors, which
could hide the first SSL error. This notably happens in
TestPumaServerSSLClient#test_verify_fail_if_no_client_cert
if the server is faster than the client. The error in that case is
"System error: Success - 0 (Puma::MiniSSL::SSLError)" which is not
actually an error, but there is also nothing to read further from SSL.
* TruffleRuby should pass the CI now, remove from allowed failures
* Use a timeout of 120 for all non-MRI implementations
* 60 doesn't seem enough in CI for TestThreadPool#test_trim on TruffleRuby.
* Fix check for cluster mode in integration tests
* Improve integration tests to fail more clearly if the pid file does not exist
* Make integration tests more robust
* Add skips for unreliable or racy tests
* Add ChangeLog entry
* No need to run RuboCop on non-MRI implementations
* This should speed up CI a bit for those jobs.
These TODOs were added in 9f4edf4c while cleaning up the tests a bit.
For the first TODO, it looks like there was a point to those two lines:
this and the previous test call `Thread.current.kill` in the thread pool
block so the threads will die once some work is added. I tried to make
this more obvious by starting the `auto_reap!` earlier and checking that
it hasn't reaped any threads that are still alive.
For the other TODO I replaced `sleep 10` with the `Thread.pass until
finish` pattern we use in some other tests in this file. Now if
`pool.shutdown(0)` fails to raise an error we finish right away rather
than waiting for the 5 second ConditionVariable timeout. I also added an
assertion to ensure we rescue the `ForceShutdown` error.
running `rake` loads all files starting with `test_` which is not supposed to also load the helper,
since the helper should be loaded by each test and is not a test itself.
* Bump minitest version.
* Add basic test helper file.
* Use minitest for web server tests.
* Use Minitest for unix socket tests.
* Use Minitest for ThreadPool tests.
* Use Minitest for TCP-Rack tests
* Use Minitest for TCPLogger tests.
* Add missing helper to test helpers.
* Use Minitest for Rack server tests.
* Use Minitest for Rack handler tests.
* Use Minitest for Puma::Server tests.
* Use Minitest for Puma::Server with SSL tests.
* Use Minitest for persisten connections tests.
* Require puma in test_helper file.
* Use minitest for Puma::NullIO tests.
* Remove unnecessary requires on test files.
* Use Minitest for MiniSSL tests.
* Use Minitest for IOBuffer tests.
* Require bundler/setup in Rakefile.
* Use Minitest for HttpParser tests.
* Use Minitest for Puma::Configuration tests.
* Use Minitest for Puma::CLI tests.
* Bump Minitest version for Ruby 2.1 Gemfile.
* Use Minitest for integration tests.
* Use Minitest for Puma::App::Status tests.
* Remove test-unit from Gemfiles.
* Add timeout helper to Minitest::Test.
* Use Minitest for Puma::Binder tests.
* Remove testhelp file.
* Add missing require to Puma::Binder tests.
* Prefer require instead of require_relative.
* Move shutdown grace time constant to ThreadPool.
SHUTDOWN_GRACE_TIME is the only constant (from const.rb) used by
ThreadPool. It's better to move the constant than require all const.rb.
* Fix minor typo.
* Don't need to check if timeout is zero to immediately shutdown.
This removes the duplicated code and add test for forced shutdowns.
Using the work queue to communicate trimming doesn't work, it's far too
easy to starve the system doing that. Instead we now detect trimming and
work as seperate actions.