puma 3.6.0-java → 3.6.1-java

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.

checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 69d7cfd48187f55a4d8441677fa65cb719a9e13c
4
- data.tar.gz: f59dedcc834c6a362e15412e1c7895be6c9f6047
3
+ metadata.gz: 2e1ca182fb2748c3cb6bb8862957e9eb376ee0e2
4
+ data.tar.gz: cbd8e721f4410b35894da1d870eefbdabc73b060
5
5
  SHA512:
6
- metadata.gz: 68b8d50366e7b4f995f1def7133a978b1ad21b14a7a2fa9b2ed8ab69e286fc2ea2e10f55a5f311e792e967574cfa5e96207cde99f15dc68a2c39601967ff7b5b
7
- data.tar.gz: 314f66c4717357b191a7ef59b47efb2dda12d8280ab3e913436fa39021c92c74f67204e78fcb795673ebd7157fad9bfc7772cb4c1e2abe8301fdde4659e1e09e
6
+ metadata.gz: a82b46134ea2faabc61a317a0c186a373b031567de7b3b2ecd5beaa113b2153d15415c293370fe8137952ae111295144994bda38cf24cdc09b3124c2a23541b6
7
+ data.tar.gz: 2e3af9e63034515f1c80bf4757746b25a6ea7756aefdd0e377f774fe317f941925c84da8852526c9059e0d1a452ccc9a4b215349acc34734be750438bff3fbc0
data/History.txt CHANGED
@@ -1,3 +1,21 @@
1
+ === 3.6.1 / 2016-11-21
2
+
3
+ * 8 bug fixes:
4
+
5
+ * Fix Puma start in init.d script.
6
+ * Fix default SSL mode back to none. Fixes #1036
7
+ * Fixed the issue of @listeners getting nil io, fix rails restart (#1120)
8
+ * More gracefully deal with SSL sessions. Fixes #1002
9
+ * Prevent short term thread churn.
10
+ * Provide write as <<. Fixes #1089
11
+ * Fix access priorities of each level in LeveledOptions - fixes TTIN.
12
+ * Stub description files updated for init.d.
13
+
14
+ * 2 new project committers:
15
+
16
+ * Nate Berkopec (@nateberkopec)
17
+ * Richard Schneeman (@schneems)
18
+
1
19
  === 3.6.0 / 2016-07-24
2
20
 
3
21
  * 12 bug fixes:
@@ -3,6 +3,8 @@ require 'mkmf'
3
3
  dir_config("puma_http11")
4
4
 
5
5
  unless ENV["DISABLE_SSL"]
6
+ dir_config("openssl")
7
+
6
8
  if %w'crypto libeay32'.find {|crypto| have_library(crypto, 'BIO_read')} and
7
9
  %w'ssl ssleay32'.find {|ssl| have_library(ssl, 'SSL_CTX_new')}
8
10
 
@@ -327,6 +327,33 @@ VALUE engine_extract(VALUE self) {
327
327
  return Qnil;
328
328
  }
329
329
 
330
+ VALUE engine_shutdown(VALUE self) {
331
+ ms_conn* conn;
332
+ int ok, err;
333
+ char buf[512];
334
+
335
+ Data_Get_Struct(self, ms_conn, conn);
336
+
337
+ ERR_clear_error();
338
+
339
+ ok = SSL_shutdown(conn->ssl);
340
+ if (ok == 0) {
341
+ return Qfalse;
342
+ }
343
+
344
+ return Qtrue;
345
+ }
346
+
347
+ VALUE engine_init(VALUE self) {
348
+ ms_conn* conn;
349
+ int ok, err;
350
+ char buf[512];
351
+
352
+ Data_Get_Struct(self, ms_conn, conn);
353
+
354
+ return SSL_in_init(conn->ssl) ? Qtrue : Qfalse;
355
+ }
356
+
330
357
  VALUE engine_peercert(VALUE self) {
331
358
  ms_conn* conn;
332
359
  X509* cert;
@@ -394,6 +421,10 @@ void Init_mini_ssl(VALUE puma) {
394
421
  rb_define_method(eng, "write", engine_write, 1);
395
422
  rb_define_method(eng, "extract", engine_extract, 0);
396
423
 
424
+ rb_define_method(eng, "shutdown", engine_shutdown, 0);
425
+
426
+ rb_define_method(eng, "init?", engine_init, 0);
427
+
397
428
  rb_define_method(eng, "peercert", engine_peercert, 0);
398
429
  }
399
430
 
data/lib/puma/binder.rb CHANGED
@@ -102,7 +102,7 @@ module Puma
102
102
  io = add_tcp_listener uri.host, uri.port, opt, bak
103
103
  end
104
104
 
105
- @listeners << [str, io]
105
+ @listeners << [str, io] if io
106
106
  when "unix"
107
107
  path = "#{uri.host}#{uri.path}".gsub("%20", " ")
108
108
 
@@ -206,7 +206,7 @@ module Puma
206
206
  io = add_ssl_listener uri.host, uri.port, ctx
207
207
  end
208
208
 
209
- @listeners << [str, io]
209
+ @listeners << [str, io] if io
210
210
  else
211
211
  logger.error "Invalid URI: #{str}"
212
212
  end
@@ -30,7 +30,7 @@ module Puma
30
30
  end
31
31
 
32
32
  def [](key)
33
- @set.each do |o|
33
+ @set.reverse_each do |o|
34
34
  if o.key? key
35
35
  return o[key]
36
36
  end
data/lib/puma/const.rb CHANGED
@@ -100,10 +100,10 @@ module Puma
100
100
  # too taxing on performance.
101
101
  module Const
102
102
 
103
- PUMA_VERSION = VERSION = "3.6.0".freeze
103
+ PUMA_VERSION = VERSION = "3.6.1".freeze
104
104
  CODE_NAME = "Sleepy Sunday Serenity".freeze
105
105
  PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
106
-
106
+
107
107
  FAST_TRACK_KA_TIMEOUT = 0.2
108
108
 
109
109
  # The default number of seconds for another request within a persistent
data/lib/puma/dsl.rb CHANGED
@@ -264,11 +264,13 @@ module Puma
264
264
  end
265
265
 
266
266
  def ssl_bind(host, port, opts)
267
+ verify = opts.fetch(:verify_mode, 'none')
268
+
267
269
  if defined?(JRUBY_VERSION)
268
270
  keystore_additions = "keystore=#{opts[:keystore]}&keystore-pass=#{opts[:keystore_pass]}"
269
- bind "ssl://#{host}:#{port}?cert=#{opts[:cert]}&key=#{opts[:key]}&#{keystore_additions}&verify_mode=#{opts[:verify_mode] || 'peer'}"
271
+ bind "ssl://#{host}:#{port}?cert=#{opts[:cert]}&key=#{opts[:key]}&#{keystore_additions}&verify_mode=#{verify}"
270
272
  else
271
- bind "ssl://#{host}:#{port}?cert=#{opts[:cert]}&key=#{opts[:key]}&verify_mode=#{opts[:verify_mode] || 'peer'}"
273
+ bind "ssl://#{host}:#{port}?cert=#{opts[:cert]}&key=#{opts[:key]}&verify_mode=#{verify}"
272
274
  end
273
275
  end
274
276
 
data/lib/puma/minissl.rb CHANGED
@@ -75,13 +75,45 @@ module Puma
75
75
  end
76
76
 
77
77
  alias_method :syswrite, :write
78
+ alias_method :<<, :write
78
79
 
79
80
  def flush
80
81
  @socket.flush
81
82
  end
82
83
 
83
84
  def close
84
- @socket.close
85
+ begin
86
+ # Try to setup (so that we can then close them) any
87
+ # partially initialized sockets.
88
+ while @engine.init?
89
+ # Don't let this socket hold this loop forever.
90
+ # If it can't send more packets within 1s, then
91
+ # give up.
92
+ return unless IO.select([@socket], nil, nil, 1)
93
+ begin
94
+ read_nonblock(1024)
95
+ rescue Errno::EAGAIN
96
+ end
97
+ end
98
+
99
+ done = @engine.shutdown
100
+
101
+ while true
102
+ enc = @engine.extract
103
+ @socket.write enc
104
+
105
+ notify = @socket.sysread(1024)
106
+
107
+ @engine.inject notify
108
+ done = @engine.shutdown
109
+
110
+ break if done
111
+ end
112
+ rescue IOError, SystemCallError
113
+ # nothing
114
+ ensure
115
+ @socket.close
116
+ end
85
117
  end
86
118
 
87
119
  def peeraddr
Binary file
data/lib/puma/server.rb CHANGED
@@ -57,7 +57,7 @@ module Puma
57
57
 
58
58
  @min_threads = 0
59
59
  @max_threads = 16
60
- @auto_trim_time = 1
60
+ @auto_trim_time = 30
61
61
  @reaping_time = 1
62
62
 
63
63
  @thread = nil
@@ -358,7 +358,7 @@ module Puma
358
358
 
359
359
  graceful_shutdown if @status == :stop || @status == :restart
360
360
  if queue_requests
361
- @reactor.clear! if @status == :restart
361
+ @reactor.clear!
362
362
  @reactor.shutdown
363
363
  end
364
364
  rescue Exception => e
@@ -209,7 +209,7 @@ module Puma
209
209
  end
210
210
  end
211
211
 
212
- def auto_trim!(timeout=5)
212
+ def auto_trim!(timeout=30)
213
213
  @auto_trim = AutoTrim.new(self, timeout)
214
214
  @auto_trim.start!
215
215
  end
@@ -5,9 +5,9 @@
5
5
  # Required-Stop: $remote_fs $syslog
6
6
  # Default-Start: 2 3 4 5
7
7
  # Default-Stop: 0 1 6
8
- # Short-Description: Example initscript
9
- # Description: This file should be used to construct scripts to be
10
- # placed in /etc/init.d.
8
+ # Short-Description: Puma web server
9
+ # Description: A ruby web server built for concurrency http://puma.io
10
+ # initscript to be placed in /etc/init.d.
11
11
  ### END INIT INFO
12
12
 
13
13
  # Author: Darío Javier Cravero <dario@exordo.com>
@@ -39,17 +39,7 @@ do_start() {
39
39
  log_daemon_msg "=> Running the jungle..."
40
40
  for i in $JUNGLE; do
41
41
  dir=`echo $i | cut -d , -f 1`
42
- user=`echo $i | cut -d , -f 2`
43
- config_file=`echo $i | cut -d , -f 3`
44
- if [ "$config_file" = "" ]; then
45
- config_file="$dir/config/puma.rb"
46
- fi
47
- log_file=`echo $i | cut -d , -f 4`
48
- if [ "$log_file" = "" ]; then
49
- log_file="$dir/log/puma.log"
50
- fi
51
- environment=`echo $i | cut -d , -f 5`
52
- do_start_one $dir $user $config_file $log_file $environment
42
+ do_start_one $dir
53
43
  done
54
44
  }
55
45
 
@@ -59,28 +49,41 @@ do_start_one() {
59
49
  PID=`cat $PIDFILE`
60
50
  # If the puma isn't running, run it, otherwise restart it.
61
51
  if [ "`ps -A -o pid= | grep -c $PID`" -eq 0 ]; then
62
- do_start_one_do $1 $2 $3 $4 $5
52
+ do_start_one_do $1
63
53
  else
64
54
  do_restart_one $1
65
55
  fi
66
56
  else
67
- do_start_one_do $1 $2 $3 $4 $5
57
+ do_start_one_do $1
68
58
  fi
69
59
  }
70
60
 
71
61
  do_start_one_do() {
72
- log_daemon_msg "--> Woke up puma $1"
73
- log_daemon_msg "user $2"
74
- log_daemon_msg "log to $4"
62
+ i=`grep $1 $CONFIG`
63
+ dir=`echo $i | cut -d , -f 1`
64
+ user=`echo $i | cut -d , -f 2`
65
+ config_file=`echo $i | cut -d , -f 3`
66
+ if [ "$config_file" = "" ]; then
67
+ config_file="$dir/config/puma.rb"
68
+ fi
69
+ log_file=`echo $i | cut -d , -f 4`
70
+ if [ "$log_file" = "" ]; then
71
+ log_file="$dir/log/puma.log"
72
+ fi
73
+ environment=`echo $i | cut -d , -f 5`
74
+
75
+ log_daemon_msg "--> Woke up puma $dir"
76
+ log_daemon_msg "user $user"
77
+ log_daemon_msg "log to $log_file"
75
78
 
76
- if [ ! -z "$5" ]; then
77
- for e in $(echo "$5" | tr ';' '\n'); do
79
+ if [ ! -z "$environment" ]; then
80
+ for e in $(echo "$environment" | tr ';' '\n'); do
78
81
  log_daemon_msg "environment $e"
79
82
  v=${e%%\=*} ; eval "$e" ; export $v
80
83
  done
81
84
  fi
82
85
 
83
- start-stop-daemon --verbose --start --chdir $1 --chuid $2 --background --exec $RUNPUMA -- $1 $3 $4
86
+ start-stop-daemon --verbose --start --chdir $dir --chuid $user --background --exec $RUNPUMA -- $dir $config_file $log_file
84
87
  }
85
88
 
86
89
  #
@@ -135,8 +138,6 @@ do_restart() {
135
138
  #
136
139
  do_restart_one() {
137
140
  PIDFILE=$1/tmp/puma/pid
138
- i=`grep $1 $CONFIG`
139
- dir=`echo $i | cut -d , -f 1`
140
141
 
141
142
  if [ -e $PIDFILE ]; then
142
143
  log_daemon_msg "--> About to restart puma $1"
@@ -144,17 +145,7 @@ do_restart_one() {
144
145
  # TODO Check if process exist
145
146
  else
146
147
  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"
151
- fi
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
148
+ do_start_one $1
158
149
  fi
159
150
  return 0
160
151
  }
@@ -174,26 +165,14 @@ do_phased_restart() {
174
165
  #
175
166
  do_phased_restart_one() {
176
167
  PIDFILE=$1/tmp/puma/pid
177
- i=`grep $1 $CONFIG`
178
- dir=`echo $i | cut -d , -f 1`
179
168
 
180
169
  if [ -e $PIDFILE ]; then
181
170
  log_daemon_msg "--> About to restart puma $1"
182
171
  kill -s USR1 `cat $PIDFILE`
183
172
  # TODO Check if process exist
184
173
  else
185
- log_daemon_msg "--> Your puma was never playing... Let's get it out there first"
186
- user=`echo $i | cut -d , -f 2`
187
- config_file=`echo $i | cut -d , -f 3`
188
- if [ "$config_file" = "" ]; then
189
- config_file="$dir/config/puma.rb"
190
- fi
191
- log_file=`echo $i | cut -d , -f 4`
192
- if [ "$log_file" = "" ]; then
193
- log_file="$dir/log/puma.log"
194
- fi
195
- environment=`echo $i | cut -d , -f 5`
196
- do_start_one $dir $user $config_file $log_file $environment
174
+ log_daemon_msg "--> Your puma was never playing... Let's get it out there first"
175
+ do_start_one $1
197
176
  fi
198
177
  return 0
199
178
  }
@@ -339,16 +318,7 @@ case "$1" in
339
318
  else
340
319
  i=`grep $2 $CONFIG`
341
320
  dir=`echo $i | cut -d , -f 1`
342
- user=`echo $i | cut -d , -f 2`
343
- config_file=`echo $i | cut -d , -f 3`
344
- if [ "$config_file" = "" ]; then
345
- config_file="$dir/config/puma.rb"
346
- fi
347
- log_file=`echo $i | cut -d , -f 4`
348
- if [ "$log_file" = "" ]; then
349
- log_file="$dir/log/puma.log"
350
- fi
351
- do_start_one $dir $user $config_file $log_file
321
+ do_start_one $dir
352
322
  fi
353
323
  case "$?" in
354
324
  0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
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.6.0
4
+ version: 3.6.1
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-25 00:00:00.000000000 Z
11
+ date: 2016-11-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -63,7 +63,7 @@ dependencies:
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '3.15'
66
+ version: '3.14'
67
67
  name: hoe
68
68
  prerelease: false
69
69
  type: :development
@@ -71,7 +71,7 @@ dependencies:
71
71
  requirements:
72
72
  - - "~>"
73
73
  - !ruby/object:Gem::Version
74
- version: '3.15'
74
+ version: '3.14'
75
75
  description: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications. Puma is intended for use in both development and production environments. In order to get the best throughput, it is highly recommended that you use a Ruby implementation with real threads like Rubinius or JRuby.
76
76
  email:
77
77
  - evan@phx.io
@@ -191,7 +191,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
191
191
  version: '0'
192
192
  requirements: []
193
193
  rubyforge_project:
194
- rubygems_version: 2.6.4
194
+ rubygems_version: 2.6.8
195
195
  signing_key:
196
196
  specification_version: 4
197
197
  summary: Puma is a simple, fast, threaded, and highly concurrent HTTP 1.1 server for Ruby/Rack applications