puma 5.0.3 → 5.2.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of puma might be problematic. Click here for more details.

Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/History.md +110 -40
  3. data/README.md +48 -18
  4. data/docs/compile_options.md +19 -0
  5. data/docs/deployment.md +1 -1
  6. data/docs/fork_worker.md +2 -0
  7. data/docs/kubernetes.md +66 -0
  8. data/docs/plugins.md +1 -1
  9. data/docs/rails_dev_mode.md +29 -0
  10. data/docs/stats.md +142 -0
  11. data/docs/systemd.md +24 -2
  12. data/ext/puma_http11/extconf.rb +18 -5
  13. data/ext/puma_http11/http11_parser.c +45 -47
  14. data/ext/puma_http11/http11_parser.java.rl +1 -1
  15. data/ext/puma_http11/http11_parser.rl +1 -1
  16. data/ext/puma_http11/mini_ssl.c +162 -84
  17. data/ext/puma_http11/org/jruby/puma/Http11Parser.java +5 -7
  18. data/ext/puma_http11/puma_http11.c +8 -2
  19. data/lib/puma.rb +20 -10
  20. data/lib/puma/app/status.rb +4 -7
  21. data/lib/puma/binder.rb +60 -24
  22. data/lib/puma/cli.rb +4 -0
  23. data/lib/puma/client.rb +4 -9
  24. data/lib/puma/cluster.rb +13 -7
  25. data/lib/puma/cluster/worker.rb +8 -2
  26. data/lib/puma/cluster/worker_handle.rb +5 -2
  27. data/lib/puma/configuration.rb +13 -1
  28. data/lib/puma/const.rb +11 -3
  29. data/lib/puma/control_cli.rb +73 -70
  30. data/lib/puma/detect.rb +14 -10
  31. data/lib/puma/dsl.rb +100 -22
  32. data/lib/puma/error_logger.rb +10 -3
  33. data/lib/puma/events.rb +18 -3
  34. data/lib/puma/json.rb +96 -0
  35. data/lib/puma/launcher.rb +52 -6
  36. data/lib/puma/minissl.rb +48 -17
  37. data/lib/puma/minissl/context_builder.rb +6 -0
  38. data/lib/puma/null_io.rb +4 -0
  39. data/lib/puma/reactor.rb +19 -12
  40. data/lib/puma/request.rb +20 -7
  41. data/lib/puma/runner.rb +14 -7
  42. data/lib/puma/server.rb +20 -75
  43. data/lib/puma/state_file.rb +5 -3
  44. data/lib/puma/systemd.rb +46 -0
  45. data/lib/rack/handler/puma.rb +1 -0
  46. metadata +12 -6
@@ -9,9 +9,11 @@ module Puma
9
9
  end
10
10
 
11
11
  def save(path, permission = nil)
12
- File.open(path, "w") do |file|
13
- file.chmod(permission) if permission
14
- file.write(YAML.dump(@options))
12
+ contents =YAML.dump @options
13
+ if permission
14
+ File.write path, contents, mode: 'wb:UTF-8'
15
+ else
16
+ File.write path, contents, mode: 'wb:UTF-8', perm: permission
15
17
  end
16
18
  end
17
19
 
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'sd_notify'
4
+
5
+ module Puma
6
+ class Systemd
7
+ def initialize(events)
8
+ @events = events
9
+ end
10
+
11
+ def hook_events
12
+ @events.on_booted { SdNotify.ready }
13
+ @events.on_stopped { SdNotify.stopping }
14
+ @events.on_restart { SdNotify.reloading }
15
+ end
16
+
17
+ def start_watchdog
18
+ return unless SdNotify.watchdog?
19
+
20
+ ping_f = watchdog_sleep_time
21
+
22
+ log "Pinging systemd watchdog every #{ping_f.round(1)} sec"
23
+ Thread.new do
24
+ loop do
25
+ sleep ping_f
26
+ SdNotify.watchdog
27
+ end
28
+ end
29
+ end
30
+
31
+ private
32
+
33
+ def watchdog_sleep_time
34
+ usec = Integer(ENV["WATCHDOG_USEC"])
35
+
36
+ sec_f = usec / 1_000_000.0
37
+ # "It is recommended that a daemon sends a keep-alive notification message
38
+ # to the service manager every half of the time returned here."
39
+ sec_f / 2
40
+ end
41
+
42
+ def log(str)
43
+ @events.log str
44
+ end
45
+ end
46
+ end
@@ -31,6 +31,7 @@ module Rack
31
31
 
32
32
  conf = ::Puma::Configuration.new(options, default_options) do |user_config, file_config, default_config|
33
33
  if options.delete(:Verbose)
34
+ require 'rack/common_logger'
34
35
  app = Rack::CommonLogger.new(app, STDOUT)
35
36
  end
36
37
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puma
3
3
  version: !ruby/object:Gem::Version
4
- version: 5.0.3
4
+ version: 5.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-26 00:00:00.000000000 Z
11
+ date: 2021-02-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nio4r
@@ -44,6 +44,7 @@ files:
44
44
  - bin/puma-wild
45
45
  - bin/pumactl
46
46
  - docs/architecture.md
47
+ - docs/compile_options.md
47
48
  - docs/deployment.md
48
49
  - docs/fork_worker.md
49
50
  - docs/images/puma-connection-flow-no-reactor.png
@@ -53,10 +54,13 @@ files:
53
54
  - docs/jungle/rc.d/README.md
54
55
  - docs/jungle/rc.d/puma
55
56
  - docs/jungle/rc.d/puma.conf
57
+ - docs/kubernetes.md
56
58
  - docs/nginx.md
57
59
  - docs/plugins.md
60
+ - docs/rails_dev_mode.md
58
61
  - docs/restart.md
59
62
  - docs/signals.md
63
+ - docs/stats.md
60
64
  - docs/systemd.md
61
65
  - ext/puma_http11/PumaHttp11Service.java
62
66
  - ext/puma_http11/ext_help.h
@@ -90,6 +94,7 @@ files:
90
94
  - lib/puma/events.rb
91
95
  - lib/puma/io_buffer.rb
92
96
  - lib/puma/jruby_restart.rb
97
+ - lib/puma/json.rb
93
98
  - lib/puma/launcher.rb
94
99
  - lib/puma/minissl.rb
95
100
  - lib/puma/minissl/context_builder.rb
@@ -106,6 +111,7 @@ files:
106
111
  - lib/puma/server.rb
107
112
  - lib/puma/single.rb
108
113
  - lib/puma/state_file.rb
114
+ - lib/puma/systemd.rb
109
115
  - lib/puma/thread_pool.rb
110
116
  - lib/puma/util.rb
111
117
  - lib/rack/handler/puma.rb
@@ -119,7 +125,7 @@ metadata:
119
125
  changelog_uri: https://github.com/puma/puma/blob/master/History.md
120
126
  homepage_uri: https://puma.io
121
127
  source_code_uri: https://github.com/puma/puma
122
- post_install_message:
128
+ post_install_message:
123
129
  rdoc_options: []
124
130
  require_paths:
125
131
  - lib
@@ -134,8 +140,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
134
140
  - !ruby/object:Gem::Version
135
141
  version: '0'
136
142
  requirements: []
137
- rubygems_version: 3.0.3
138
- signing_key:
143
+ rubygems_version: 3.2.1
144
+ signing_key:
139
145
  specification_version: 4
140
146
  summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for
141
147
  Ruby/Rack applications