puma 5.0.2 → 5.0.3

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.

@@ -50,7 +50,7 @@ module Puma
50
50
  start_control
51
51
 
52
52
  @server = server = start_server
53
-
53
+ server_thread = server.run
54
54
 
55
55
  log "Use Ctrl-C to stop"
56
56
  redirect_io
@@ -58,7 +58,7 @@ module Puma
58
58
  @launcher.events.fire_on_booted!
59
59
 
60
60
  begin
61
- server.run.join
61
+ server_thread.join
62
62
  rescue Interrupt
63
63
  # Swallow it
64
64
  end
@@ -23,6 +23,17 @@ module Puma
23
23
  end
24
24
  module_function :unescape
25
25
 
26
+ # @version 5.0.0
27
+ def nakayoshi_gc(events)
28
+ events.log "! Promoting existing objects to old generation..."
29
+ 4.times { GC.start(full_mark: false) }
30
+ if GC.respond_to?(:compact)
31
+ events.log "! Compacting..."
32
+ GC.compact
33
+ end
34
+ events.log "! Friendly fork preparation complete."
35
+ end
36
+
26
37
  DEFAULT_SEP = /[&;] */n
27
38
 
28
39
  # Stolen from Mongrel, with some small modifications:
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.2
4
+ version: 5.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-28 00:00:00.000000000 Z
11
+ date: 2020-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nio4r
@@ -53,9 +53,6 @@ files:
53
53
  - docs/jungle/rc.d/README.md
54
54
  - docs/jungle/rc.d/puma
55
55
  - docs/jungle/rc.d/puma.conf
56
- - docs/jungle/upstart/README.md
57
- - docs/jungle/upstart/puma-manager.conf
58
- - docs/jungle/upstart/puma.conf
59
56
  - docs/nginx.md
60
57
  - docs/plugins.md
61
58
  - docs/restart.md
@@ -76,12 +73,13 @@ files:
76
73
  - ext/puma_http11/org/jruby/puma/MiniSSL.java
77
74
  - ext/puma_http11/puma_http11.c
78
75
  - lib/puma.rb
79
- - lib/puma/accept_nonblock.rb
80
76
  - lib/puma/app/status.rb
81
77
  - lib/puma/binder.rb
82
78
  - lib/puma/cli.rb
83
79
  - lib/puma/client.rb
84
80
  - lib/puma/cluster.rb
81
+ - lib/puma/cluster/worker.rb
82
+ - lib/puma/cluster/worker_handle.rb
85
83
  - lib/puma/commonlogger.rb
86
84
  - lib/puma/configuration.rb
87
85
  - lib/puma/const.rb
@@ -98,10 +96,12 @@ files:
98
96
  - lib/puma/null_io.rb
99
97
  - lib/puma/plugin.rb
100
98
  - lib/puma/plugin/tmp_restart.rb
99
+ - lib/puma/queue_close.rb
101
100
  - lib/puma/rack/builder.rb
102
101
  - lib/puma/rack/urlmap.rb
103
102
  - lib/puma/rack_default.rb
104
103
  - lib/puma/reactor.rb
104
+ - lib/puma/request.rb
105
105
  - lib/puma/runner.rb
106
106
  - lib/puma/server.rb
107
107
  - lib/puma/single.rb
@@ -1,61 +0,0 @@
1
- # Puma as a service using Upstart
2
-
3
- Manage multiple Puma servers as services on the same box using Ubuntu upstart.
4
-
5
- ## Installation
6
-
7
- # Copy the scripts to services directory
8
- sudo cp puma.conf puma-manager.conf /etc/init
9
-
10
- # Create an empty configuration file
11
- sudo touch /etc/puma.conf
12
-
13
- ## Managing the jungle
14
-
15
- Puma apps are referenced in /etc/puma.conf by default. Add each app's path as a new line, e.g.:
16
-
17
- ```
18
- /home/apps/my-cool-ruby-app
19
- /home/apps/another-app/current
20
- ```
21
-
22
- Start the jungle running:
23
-
24
- `sudo start puma-manager`
25
-
26
- This script will run at boot time.
27
-
28
- Start a single puma like this:
29
-
30
- `sudo start puma app=/path/to/app`
31
-
32
- ## Logs
33
-
34
- Everything is logged by upstart, defaulting to `/var/log/upstart`.
35
-
36
- Each puma instance is named after its directory, so for an app called `/home/apps/my-app` the log file would be `/var/log/upstart/puma-_home_apps_my-app.log`.
37
-
38
- ## Conventions
39
-
40
- * The script expects:
41
- * a config file to exist under `config/puma.rb` in your app. E.g.: `/home/apps/my-app/config/puma.rb`.
42
- * a temporary folder to put the PID, socket and state files to exist called `tmp/puma`. E.g.: `/home/apps/my-app/tmp/puma`. Puma will take care of the files for you.
43
-
44
- You can always change those defaults by editing the scripts.
45
-
46
- ## Here's what a minimal app's config file should have
47
-
48
- ```
49
- pidfile "/path/to/app/tmp/puma/pid"
50
- state_path "/path/to/app/tmp/puma/state"
51
- activate_control_app
52
- ```
53
-
54
- ## Before starting...
55
-
56
- You need to customise `puma.conf` to:
57
-
58
- * Set the right user your app should be running on unless you want root to execute it!
59
- * Look for `setuid apps` and `setgid apps`, uncomment those lines and replace `apps` to whatever your deployment user is.
60
- * Replace `apps` on the paths (or set the right paths to your user's home) everywhere else.
61
- * Uncomment the source lines for `rbenv` or `rvm` support unless you use a system wide installation of Ruby.
@@ -1,31 +0,0 @@
1
- # /etc/init/puma-manager.conf - manage a set of Pumas
2
-
3
- # This example config should work with Ubuntu 12.04+. It
4
- # allows you to manage multiple Puma instances with
5
- # Upstart, Ubuntu's native service management tool.
6
- #
7
- # See puma.conf for how to manage a single Puma instance.
8
- #
9
- # Use "stop puma-manager" to stop all Puma instances.
10
- # Use "start puma-manager" to start all instances.
11
- # Use "restart puma-manager" to restart all instances.
12
- # Crazy, right?
13
- #
14
-
15
- description "Manages the set of puma processes"
16
-
17
- # This starts upon bootup and stops on shutdown
18
- start on runlevel [2345]
19
- stop on runlevel [06]
20
-
21
- # Set this to the number of Puma processes you want
22
- # to run on this machine
23
- env PUMA_CONF="/etc/puma.conf"
24
-
25
- pre-start script
26
- for i in `cat $PUMA_CONF`; do
27
- app=`echo $i | cut -d , -f 1`
28
- logger -t "puma-manager" "Starting $app"
29
- start puma app=$app
30
- done
31
- end script
@@ -1,69 +0,0 @@
1
- # /etc/init/puma.conf - Puma config
2
-
3
- # This example config should work with Ubuntu 12.04+. It
4
- # allows you to manage multiple Puma instances with
5
- # Upstart, Ubuntu's native service management tool.
6
- #
7
- # See puma-manager.conf for how to manage all Puma instances at once.
8
- #
9
- # Save this config as /etc/init/puma.conf then manage puma with:
10
- # sudo start puma app=PATH_TO_APP
11
- # sudo stop puma app=PATH_TO_APP
12
- # sudo status puma app=PATH_TO_APP
13
- #
14
- # or use the service command:
15
- # sudo service puma {start,stop,restart,status}
16
- #
17
-
18
- description "Puma Background Worker"
19
-
20
- # no "start on", we don't want to automatically start
21
- stop on (stopping puma-manager or runlevel [06])
22
-
23
- # change apps to match your deployment user if you want to use this as a less privileged user (recommended!)
24
- setuid apps
25
- setgid apps
26
-
27
- respawn
28
- respawn limit 3 30
29
-
30
- instance ${app}
31
-
32
- script
33
- # this script runs in /bin/sh by default
34
- # respawn as bash so we can source in rbenv/rvm
35
- # quoted heredoc to tell /bin/sh not to interpret
36
- # variables
37
-
38
- # source ENV variables manually as Upstart doesn't, eg:
39
- #. /etc/environment
40
-
41
- exec /bin/bash <<'EOT'
42
- # set HOME to the setuid user's home, there doesn't seem to be a better, portable way
43
- export HOME="$(eval echo ~$(id -un))"
44
-
45
- if [ -d "/usr/local/rbenv/bin" ]; then
46
- export PATH="/usr/local/rbenv/bin:/usr/local/rbenv/shims:$PATH"
47
- elif [ -d "$HOME/.rbenv/bin" ]; then
48
- export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
49
- elif [ -f /etc/profile.d/rvm.sh ]; then
50
- source /etc/profile.d/rvm.sh
51
- elif [ -f /usr/local/rvm/scripts/rvm ]; then
52
- source /etc/profile.d/rvm.sh
53
- elif [ -f "$HOME/.rvm/scripts/rvm" ]; then
54
- source "$HOME/.rvm/scripts/rvm"
55
- elif [ -f /usr/local/share/chruby/chruby.sh ]; then
56
- source /usr/local/share/chruby/chruby.sh
57
- if [ -f /usr/local/share/chruby/auto.sh ]; then
58
- source /usr/local/share/chruby/auto.sh
59
- fi
60
- # if you aren't using auto, set your version here
61
- # chruby 2.0.0
62
- fi
63
-
64
- cd $app
65
- logger -t puma "Starting server: $app"
66
-
67
- exec bundle exec puma -C config/puma.rb
68
- EOT
69
- end script
@@ -1,29 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'openssl'
4
-
5
- module OpenSSL
6
- module SSL
7
- class SSLServer
8
- unless public_method_defined? :accept_nonblock
9
- def accept_nonblock
10
- sock = @svr.accept_nonblock
11
-
12
- begin
13
- ssl = OpenSSL::SSL::SSLSocket.new(sock, @ctx)
14
- ssl.sync_close = true
15
- ssl.accept if @start_immediately
16
- ssl
17
- rescue SSLError => ex
18
- if ssl
19
- ssl.close
20
- else
21
- sock.close
22
- end
23
- raise ex
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end