1
0
Fork 0
mirror of https://github.com/puma/puma.git synced 2022-11-09 13:48:40 -05:00
Commit graph

28 commits

Author SHA1 Message Date
Will Jordan
ec2cda3faa
Fix ThreadPool#shutdown timeout accuracy (#2221) 2020-04-17 10:38:30 +09:00
Will Jordan
b16d8cb963
ThreadPool concurrency refactoring (#2220)
- 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>
2020-04-15 08:43:59 +09:00
Benoit Daloze
b1c27eebd5
Fix the CI [changelog skip] (#2214)
* 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
2020-04-03 06:24:14 +09:00
Benoit Daloze
0b737cce42
Run tests on TruffleRuby, all tests pass now (#2198)
* 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.
2020-03-25 06:13:31 +09:00
Nate Berkopec
b877368263
JRuby not allowed to fail. Closes #2005 2020-03-14 13:56:32 -06:00
Nate Berkopec
a4b8857c04
More Jruby test skips 2020-03-14 09:52:52 -06:00
Nate Berkopec
d75e1573ed
I've gotta stop editing code on github
Github plz add whitespace eliminating option on your web editor
2020-03-14 08:22:51 -06:00
Nate Berkopec
73397c646e
Fix test failure for JRuby 2020-03-14 08:01:36 -06:00
Daniel Colson
b4009d113f
Address threadpool test TODOs
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.
2019-10-16 21:17:19 -04:00
Nate Berkopec
efb1dbfd71
All Puma threads are named (#1968) 2019-09-15 10:52:34 +02:00
Nate Berkopec
9f4edf4c66
Cleanup tests, parallelize a few (#1850)
+ Some tests getting frozen_string_literal
+ Remove unneccessary bundler setup
+ Fewer/tighter sleeps
2019-07-27 09:47:19 -07:00
Michael Grosser
9d93a0f62f make test_helper no longer be loaded as a test (#1283)
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.
2017-05-12 12:16:55 -07:00
Michael Grosser
d25ef26465 warn when bundler fails and avoid having to use -I to run tests (#1270) 2017-04-11 14:48:11 -07:00
Francesco Rodriguez
b638dd1948 Use Minitest instead of Test::Unit (#1152)
* 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.
2016-11-22 08:05:49 -07:00
Francesco Rodriguez
64f930dfb7 Minor refactor on Thread pool (#1088)
* 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.
2016-11-20 11:36:47 -07:00
Reid Morrison
452feb791b Set worker thread name.
Supports multithreaded logging and problem diagnosis.
2016-04-28 10:28:44 -04:00
Ole Michaelis
5e95791cca Add thread reaping to thread pool 2015-05-20 14:57:40 +02:00
Evan Phoenix
858e73c4f4 Fix test 2014-11-26 23:05:12 -08:00
Daniel Neighman
a3aac917f6 Clean out a threads local data before doing work 2014-10-30 17:52:37 -07:00
Larry Marburger
26c961f1db Convert thread pool sizes to integers 2013-07-16 20:07:59 -04:00
Clint Shryock
26a1ab2e14 Standardize "block" usage
This commit standardizes on the use of `block` over `blk`. I found the usage of
both in the code.
2013-07-03 09:25:48 -05:00
Evan Phoenix
6a90d64889 Fix bad test 2012-07-30 17:37:43 -06:00
Evan Phoenix
256970e048 Rearch how trimming takes place to not starve. Fixes #39
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.
2012-02-07 09:49:23 -08:00
Evan Phoenix
f11cd81470 Add automatic pool trimming 2011-12-05 10:07:01 -08:00
Evan Phoenix
eba4c745a5 Fix 1.9 lambda arity bug and improve timing 2011-10-03 14:52:23 -07:00
Evan Phoenix
70c444d2c5 quick fix for thread pool timing 2011-09-23 20:49:45 -07:00
Evan Phoenix
190a81c55a Name change: Mongrel => Puma 2011-09-22 19:24:43 -07:00
Evan Phoenix
fdd5d7df78 Add thread pooling 2011-09-19 22:16:31 -07:00