puma 3.4.0 → 3.5.0

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.

@@ -68,6 +68,8 @@ module Puma
68
68
  @spawned += 1
69
69
 
70
70
  th = Thread.new do
71
+ # Thread name is new in Ruby 2.3
72
+ Thread.current.name = 'puma %03i' % @spawned if Thread.current.respond_to?(:name=)
71
73
  todo = @todo
72
74
  block = @block
73
75
  mutex = @mutex
@@ -112,7 +114,8 @@ module Puma
112
114
 
113
115
  begin
114
116
  block.call(work, *extra)
115
- rescue Exception
117
+ rescue Exception => e
118
+ STDERR.puts "Error reached top of thread-pool: #{e.message} (#{e.class})"
116
119
  end
117
120
  end
118
121
 
@@ -137,15 +137,49 @@ do_restart_one() {
137
137
  PIDFILE=$1/tmp/puma/pid
138
138
  i=`grep $1 $CONFIG`
139
139
  dir=`echo $i | cut -d , -f 1`
140
-
140
+
141
141
  if [ -e $PIDFILE ]; then
142
142
  log_daemon_msg "--> About to restart puma $1"
143
- if [ "$USE_LOCAL_BUNDLE" -eq 1 ]; then
144
- cd $1 && bundle exec pumactl --state $dir/tmp/puma/state restart
145
- else
146
- pumactl --state $dir/tmp/puma/state restart
143
+ kill -s USR2 `cat $PIDFILE`
144
+ # TODO Check if process exist
145
+ else
146
+ log_daemon_msg "--> Your puma was never playing... Let's get it out there first"
147
+ user=`echo $i | cut -d , -f 2`
148
+ config_file=`echo $i | cut -d , -f 3`
149
+ if [ "$config_file" = "" ]; then
150
+ config_file="$dir/config/puma.rb"
147
151
  fi
148
- # kill -s USR2 `cat $PIDFILE`
152
+ log_file=`echo $i | cut -d , -f 4`
153
+ if [ "$log_file" = "" ]; then
154
+ log_file="$dir/log/puma.log"
155
+ fi
156
+ environment=`echo $i | cut -d , -f 5`
157
+ do_start_one $dir $user $config_file $log_file $environment
158
+ fi
159
+ return 0
160
+ }
161
+
162
+ #
163
+ # Function that phased restarts the jungle
164
+ #
165
+ do_phased_restart() {
166
+ for i in $JUNGLE; do
167
+ dir=`echo $i | cut -d , -f 1`
168
+ do_phased_restart_one $dir
169
+ done
170
+ }
171
+
172
+ #
173
+ # Function that sends a SIGUSR1 to the daemon/service
174
+ #
175
+ do_phased_restart_one() {
176
+ PIDFILE=$1/tmp/puma/pid
177
+ i=`grep $1 $CONFIG`
178
+ dir=`echo $i | cut -d , -f 1`
179
+
180
+ if [ -e $PIDFILE ]; then
181
+ log_daemon_msg "--> About to restart puma $1"
182
+ kill -s USR1 `cat $PIDFILE`
149
183
  # TODO Check if process exist
150
184
  else
151
185
  log_daemon_msg "--> Your puma was never playing... Let's get it out there first"
@@ -256,16 +290,25 @@ do_remove() {
256
290
 
257
291
  config_bundler() {
258
292
  HOME="$(eval echo ~$(id -un))"
259
- if [ -d "/usr/local/rbenv/bin" ]; then
293
+
294
+ if [ -d "$1/.rbenv/bin" ]; then
295
+ PATH="$1/.rbenv/bin:$1/.rbenv/shims:$1"
296
+ eval "$(rbenv init -)"
297
+ USE_LOCAL_BUNDLE=1
298
+ return 0
299
+
300
+ elif [ -d "/usr/local/rbenv/bin" ]; then
260
301
  PATH="/usr/local/rbenv/bin:/usr/local/rbenv/shims:$PATH"
261
302
  eval "$(rbenv init -)"
262
303
  USE_LOCAL_BUNDLE=1
263
304
  return 0
305
+
264
306
  elif [ -d "$HOME/.rbenv/bin" ]; then
265
307
  PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
266
308
  eval "$(rbenv init -)"
267
309
  USE_LOCAL_BUNDLE=1
268
310
  return 0
311
+
269
312
  # TODO: test rvm
270
313
  # elif [ -f /etc/profile.d/rvm.sh ]; then
271
314
  # source /etc/profile.d/rvm.sh
@@ -355,6 +398,20 @@ case "$1" in
355
398
  2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
356
399
  esac
357
400
  ;;
401
+ phased-restart)
402
+ log_daemon_msg "Restarting (phased) $DESC" "$NAME"
403
+ if [ "$#" -eq 1 ]; then
404
+ do_phased_restart
405
+ else
406
+ i=`grep $2 $CONFIG`
407
+ dir=`echo $i | cut -d , -f 1`
408
+ do_phased_restart_one $dir
409
+ fi
410
+ case "$?" in
411
+ 0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
412
+ 2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
413
+ esac
414
+ ;;
358
415
  add)
359
416
  if [ "$#" -lt 3 ]; then
360
417
  echo "Please, specify the app's directory and the user that will run it at least."
@@ -383,7 +440,7 @@ case "$1" in
383
440
  ;;
384
441
  *)
385
442
  echo "Usage:" >&2
386
- echo " Run the jungle: $SCRIPTNAME {start|stop|status|restart}" >&2
443
+ echo " Run the jungle: $SCRIPTNAME {start|stop|status|restart|phased-restart}" >&2
387
444
  echo " Add a Puma: $SCRIPTNAME add /path/to/app user /path/to/app/config/puma.rb /path/to/app/config/log/puma.log"
388
445
  echo " config and log are optionals."
389
446
  echo " Remove a Puma: $SCRIPTNAME remove /path/to/app"
@@ -1,3 +1,14 @@
1
1
  #!/bin/bash
2
+
3
+ # on system boot, and root have no rbenv installed,
4
+ # after start-stop-daemon switched to current user, we have to init rbenv
5
+ if [ -d "$HOME/.rbenv/bin" ]; then
6
+ PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"
7
+ eval "$(rbenv init -)"
8
+ elif [ -d "/usr/local/rbenv/bin" ]; then
9
+ PATH="/usr/local/rbenv/bin:/usr/local/rbenv/shims:$PATH"
10
+ eval "$(rbenv init -)"
11
+ fi
12
+
2
13
  app=$1; config=$2; log=$3;
3
14
  cd $app && exec bundle exec puma -C $config 2>&1 >> $log
@@ -4,7 +4,7 @@
4
4
  # allows you to manage multiple Puma instances with
5
5
  # Upstart, Ubuntu's native service management tool.
6
6
  #
7
- # See workers.conf for how to manage all Puma instances at once.
7
+ # See puma-manager.conf for how to manage all Puma instances at once.
8
8
  #
9
9
  # Save this config as /etc/init/puma.conf then manage puma with:
10
10
  # sudo start puma app=PATH_TO_APP
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: 3.4.0
4
+ version: 3.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-04-07 00:00:00.000000000 Z
11
+ date: 2016-07-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rdoc
@@ -88,7 +88,6 @@ extra_rdoc_files:
88
88
  - History.txt
89
89
  - Manifest.txt
90
90
  - README.md
91
- - docs/config.md
92
91
  - docs/nginx.md
93
92
  - docs/signals.md
94
93
  - docs/systemd.md
@@ -106,7 +105,6 @@ files:
106
105
  - bin/puma
107
106
  - bin/puma-wild
108
107
  - bin/pumactl
109
- - docs/config.md
110
108
  - docs/nginx.md
111
109
  - docs/signals.md
112
110
  - docs/systemd.md
File without changes