Commit Graph

22 Commits

Author SHA1 Message Date
MSP-Greg 5d5bcb135b
[CI] test files - use unlink in ensure when appropriate (#2984) 2022-10-04 10:09:06 -05:00
Nate Berkopec 9a2c334c11
Refactor/move configuration defaults (#2928)
* Refactor/move configuration defaults

* Make wait_for_less_busy_worker default (#2940)

Co-authored-by: Shohei Umemoto <cafedomancer@gmail.com>
2022-09-10 13:31:51 +09:00
Johnny Shields 8a4ef0c16c
[WIP] Refactor: Split out LogWriter from Events (no logic change) (#2798)
* Split out LogWriter from Events

* Improve code comment

* Fix constructor interfaces

* Fix file includes

* Fix specs and requires

* Fix LogWriter

* More fixes

* Fix tests

* Fix specs

* Fix spec

* Fix more specs

* Refactor: Split out LogWriter from Events

* Improve comments

* Fix bundle pruner

Co-authored-by: shields <shields@tablecheck.com>
2022-02-05 10:06:22 -07:00
Johnny Shields d7cfe19eb3
Extract prune_bundler code into it's own class. (#2797)
Co-authored-by: shields <shields@tablecheck.com>
2022-02-01 12:07:38 -07:00
Olivier Bellone 1008c36a4a
Add worker_check_interval configuration option (#2759)
Co-authored-by: Olivier Bellone <olivier@bellone.fr>
2021-12-11 14:58:05 -07:00
MSP-Greg 51ea1b44ea
Update helper.rb TestSkips, add HAS_UNIX_SOCKET to puma.rb [changelog skip] (#2576)
* Update helper.rb TestSkips, add HAS_UNIX_SOCKET to puma.rb

* Tests - skip updates

* test_integration_cluster.rb - fix some test warnings & RuboCop
2021-03-15 08:10:43 -06:00
MSP-Greg d55cdae317
Fix Events#fire_on_stopped! double call, add test (#2497)
Launcher#graceful_stop calls Events#fire_on_stopped!, and graceful_stop is called in Launcher#run

Added TestLauncher#test_fire_on_stopped
2020-12-03 09:40:34 -07:00
MSP-Greg 7e8b29e4b9
Fix regex warnings in const.rb & test_launcher.rb (#2498)
Fix Puma::Const::ILLEGAL_HEADER_KEY_REGEX overlap

Add backslash as illegal character for header field-name

See https://github.com/puma/puma/pull/2495 and https://github.com/puma/puma/pull/2439

Update test_launcher.rb, use parenthesis with regex parameters
2020-11-30 08:57:08 -07:00
Carlos Castellanos Vera c1b6071ae3
Log puma config if the env variable LOG_CONFIG exists (#2472) 2020-11-02 08:32:37 -07:00
Chris LaRose 6502c5ba01
Fix Bundler::GemNotFound errors for nio4r gem (#2427)
* Update extra_runtime_dependencies test to test master proccess's gems

The `extra_runtime_dependencies` option allows one to activate gems in
the puma master process after "pruning" the master process with
`prune_bundler`. This is useful for activating gems that need to be
loaded in the master process, such as `puma_worker_killer`.

The integration test for `extra_runtime_dependencies` tested the
`$LOAD_PATH` of the worker process instead. Since workers are forked
from the master, it's normally fine to do this, but we might as well
test the master process's `$LOAD_PATH` directly if we can.

* Add test to refute that nio4r is loaded into puma master process

* Remove nio4r from puma master $LOAD_PATH

* Remove list of gems to activate from puma-wild

* Update History.md

Co-authored-by: Nate Berkopec <nate.berkopec@gmail.com>
2020-10-20 07:31:23 -06:00
MSP-Greg c71d149117
Updates for non MRI CI stablity [changelog skip] (#2434)
* Actions non MRI - use JDK11 on macOS, add Big Sur

* Actions MRI - add macOS Big Sur Ruby 2.7

* test/helper.rb - run setup in same Timeout block as test

* TestIntegrationSingle#test_int_refuse - skip on JRuby

Seems to intermittently lockup CI

* TestLauncher#test_puma_stats - fix intermittent non-MRI failure II

* test_out_of_band_server.rb - JRuby - add small sleep after server.run

* test_persistent.rb - JRuby - add small sleep after server.run

* test_puma_server.rb - JRuby - add small sleep after server.run
2020-10-19 09:22:28 -06:00
MSP-Greg 852f16a916
TestLauncher#test_puma_stats - fix intermittent non-MRI failure 2020-10-16 15:38:05 -05:00
Vyacheslav Alexeev a7455dff86 Add tmp_path manager module 2020-07-12 20:00:29 +03:00
Vyacheslav Alexeev 394c28f23f tmp_path 2020-07-06 15:10:55 +03:00
Richard Schneeman 095964879b
Revert api change from #2086 introduce Puma.stats_hash api (#2253)
* Revert api change from #2086 introduce Puma.stats_hash api

The change in #2086 is not backwards compatible with existing gems that parse the output of Puma.stats such as barnes.

Releasing a version of puma with this change would break anyone using the Barnes app and only in production. I'm proposing to keep the existing interface and instead add a new API. This buys us all the features of #2086 without causing any production facing downtime by customers due to API incompatibilities.

Unfortunately it requires that we serialize and the de-serialize the values. One prior benefit of returning json in a string was that it allowed an end user to de-serialize using a faster json algorithm such as `oj` via the "multi json" gem. But the performance penalty will be better than a stability break.
2020-05-11 10:20:19 +09:00
sthirugn 3060a75fcc
Add optional state file permissions (#2238)
Before this commit, it was possible that the puma.state file would be world readable which may not be desirable in production environments. This introduces a new optional configuration option to set desired state file permissions.
2020-05-07 12:13:35 +09:00
Will Jordan f47d6d139b
JSON parse cluster worker stats instead of regex (#2124)
* JSON parse cluster worker stats instead of regex

* Add tests for Puma.stats
2020-04-14 13:06:30 +09:00
Daniel Colson 39d16fadaf Add pumactl command to print thread backtraces (#2054)
* Add pumactl command to print thread backtraces

Completes 1 of 2 items from #1964

This commit adds an endpoint to the status app to print thread
backtraces, and control cli command to call that endpoint.

I tried this locally by starting a server with:

```sh
bundle exec bin/puma test/rackup/hello.ru \
  --control-url="unix://test.sock" \
  --control-token="token"
```

and then printing the backtraces with:

```sh
bundle exec bin/pumactl thread-backtraces \
  --control-url="unix://test.sock" \
  --control-token="token"
```

* Log threads as JSON in control app

With this commit the status app sends the thread backtraces as an array
of objects with `name` and `backtrace` keys, rather than as a string
matching the SIGINFO output.

While working on this I noticed that we logged the thread TID twice.
This commit simplifies that so we only log the thread TID once, with
both the label (I don't know when the label would get set) and name if
they are available.
2019-11-11 13:08:41 +08:00
Nate Berkopec a585772402
Launcher: privatize write_pid, use log 2019-09-20 11:51:57 +02:00
Nate Berkopec e864e28b13
Launcher test cleanup (#1966)
* Add no-bundler skip

* Remove unnecessary test requires

* Little bit of launcher test cleanup
2019-09-13 16:44:02 +00:00
Nate Berkopec e96e798068
SIGINFO prints thread backtraces (#1320) 2019-09-12 09:59:54 +00:00
Dave Allie 809a3f4c7b Allow extra runtime deps to be defined when using prune_bundler (#1105)
* Allow extra runtime deps to be defined when using prune_bundler

* Check extra_runtime_dependencies is set before iterating over them

* Load additional paths for extra runtime dep gems

* Don't load extra dependencies, just add their paths to $LOAD_PATH

* Fix typos and extraneous checks and rescues

* Use Gem::Specification#full_require_paths when available

* Prevent use of prune_bundler and extra_runtime_dependencies with early versions of RubyGems

* Ensure LOAD_PATH is modified by extra_runtime_dependencies

* Refactor prune_bundler in launcher.rb and write some unit tests
2019-09-02 16:10:33 +00:00