puma 5.2.1-java → 5.2.2-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
  SHA256:
3
- metadata.gz: 499a594786c4be683329a79dc8efe90b794c8bccf87863a9389e0bfea4cb647d
4
- data.tar.gz: 9e5cfe53997edadbabda41bc3e16299bf371f1e009bd8162a3685cb34d97f9fc
3
+ metadata.gz: 560d63fd273aee23f37110caf0011f49ba6bd024c076415d434f4d67ab018d0b
4
+ data.tar.gz: 31f20ebfd82a21afdce44c18352bfa08efe8b43589e86a307881ec7ba6617dcd
5
5
  SHA512:
6
- metadata.gz: f7000c30aae715931f59933c43e8cfe76aa86e8d35d9b76911e96da1ec30841546ed6c3fbe0d0aa50637f0355d2761896b1aa7df2b529acf0b61eb3eb30c30df
7
- data.tar.gz: 0e83d2d9e079bfed5217f27a0755b2e72ee51b08a1066b5c2b0abf94bf36ec0a94adf5fba9a691e84cab07588d72695129c0cbc6c22e486b2b0651e415544707
6
+ metadata.gz: 55dde02be1029df2192b5e09306d5a738e224f415f9ea288c278fa746c4103cecfd58d0d830ff9a026beb50d1a55ccd9c2e7875235e77e9a30a9df16f781484a
7
+ data.tar.gz: 69b8152d773645ffc452f60358cb4453aef2186f94e2075da0a73af57bd0d4b0373ec4b47861bd06b068efea339d4cd2cbd1a593a007e52322605235f402eed7
data/History.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 5.2.2 / 2021-02-22
2
+
3
+ * Bugfixes
4
+ * Add `#flush` and `#sync` methods to `Puma::NullIO` ([#2553])
5
+ * Restore `sync=true` on `STDOUT` and `STDERR` streams ([#2557])
6
+
1
7
  ## 5.2.1 / 2021-02-05
2
8
 
3
9
  * Bugfixes
@@ -1702,6 +1708,8 @@ be added back in a future date when a java Puma::MiniSSL is added.
1702
1708
  * Bugfixes
1703
1709
  * Your bugfix goes here <Most recent on the top, like GitHub> (#Github Number)
1704
1710
 
1711
+ [#2557]:https://github.com/puma/puma/pull/2557 "PR by @cjlarose, merged 2021-02-22"
1712
+ [#2553]:https://github.com/puma/puma/pull/2553 "PR by @olivierbellone, merged 02-10-22"
1705
1713
  [#2550]:https://github.com/puma/puma/pull/2550 "PR by @MSP-Greg, merged 2021-02-05"
1706
1714
  [#2547]:https://github.com/puma/puma/pull/2547 "PR by @wildmaples, merged 2021-02-03"
1707
1715
  [#2543]:https://github.com/puma/puma/pull/2543 "PR by @MSP-Greg, merged 2021-02-01"
data/docs/architecture.md CHANGED
@@ -4,34 +4,37 @@
4
4
 
5
5
  ![https://bit.ly/2iJuFky](images/puma-general-arch.png)
6
6
 
7
- Puma is a threaded web server, processing requests across a TCP or UNIX socket.
7
+ Puma is a threaded Ruby HTTP application server, processing requests across a TCP or UNIX socket.
8
8
 
9
- Workers accept connections from the socket and a thread in the worker's thread pool processes the client's request.
9
+ Puma processes (there can be one or many) accept connections from the socket via a thread (in the `Reactor` class). The connection, once fully buffered and read, moves in to the `todo` list, where it will be picked up by a free/waiting thread in the threadpool (the `ThreadPool` class).
10
10
 
11
- Clustered mode is shown/discussed here. Single mode is analogous to having a single worker process.
11
+ Puma works in two main modes: cluster and single. In single mode, only one Puma process is booted. In cluster mode, a `master` process is booted, which prepares (and may boot) the application, and then uses the `fork()` system call to create 1 or more `child` processes. These `child` processes all listen to the same socket. The `master` process does not listen to the socket or process requests - its purpose is mostly to manage and listen for UNIX signals and possibly kill or boot `child` processes.
12
12
 
13
- ## Connection pipeline
13
+ We sometimes call `child` processes (or Puma processes in `single` mode) _workers_, and we sometimes call the threads created by Puma's `ThreadPool` _worker threads_.
14
+
15
+ ## How Requests Work
14
16
 
15
17
  ![https://bit.ly/2zwzhEK](images/puma-connection-flow.png)
16
18
 
17
19
  * Upon startup, Puma listens on a TCP or UNIX socket.
18
- * The backlog of this socket is configured (with a default of 1024), determining how many established but unaccepted connections can exist concurrently.
19
- * This socket backlog is distinct from the "backlog" of work as reported by the control server stats. The latter is the number of connections in that worker's "todo" set waiting for a worker thread.
20
- * By default, a single, separate thread is used to receive HTTP requests across the socket.
21
- * When at least one worker thread is available for work, a connection is accepted and placed in this request buffer
22
- * This thread waits for entire HTTP requests to be received over the connection
23
- * The time spent waiting for the HTTP request body to be received is exposed to the Rack app as `env['puma.request_body_wait']` (milliseconds)
24
- * Once received, the connection is pushed into the "todo" set
25
- * Worker threads pop work off the "todo" set for processing
26
- * The thread processes the request via the rack application (which generates the HTTP response)
27
- * The thread writes the response to the connection
28
- * Finally, the thread become available to process another connection in the "todo" set
29
-
30
- ### Disabling `queue_requests`
20
+ * The backlog of this socket is configured (with a default of 1024). This determines the size of the queue for unaccepted connections. Generally, this setting is unimportant and will never be hit in production use. If the backlog is full, the connection will be refused by the operating system.
21
+ * This socket backlog is distinct from the `backlog` of work as reported by `Puma.stats` or the control server. The backlog as reported by Puma is the number of connections in the process' `todo` set waiting for a thread from the `ThreadPool`.
22
+ * By default, a single, separate thread (created by the `Reactor` class) is used to read and buffer requests from the socket.
23
+ * When at least one worker thread is available for work, the reactor thread listens to the socket and accepts a request, if one is waiting.
24
+ * The reactor thread waits for the entire HTTP request to be received.
25
+ * The time spent waiting for the HTTP request body to be received is exposed to the Rack app as `env['puma.request_body_wait']` (milliseconds).
26
+ * Once fully buffered and received, the connection is pushed into the "todo" set.
27
+ * Worker threads pop work off the "todo" set for processing.
28
+ * The worker thread processes the request via `call`ing the configured Rack application. The Rack application generates the HTTP response.
29
+ * The worker thread writes the response to the connection. Note that while Puma buffers requests via a separate thread, it does not use a separate thread for responses.
30
+ * Once done, the thread become available to process another connection in the "todo" set.
31
+
32
+ ### `queue_requests`
31
33
 
32
34
  ![https://bit.ly/2zxCJ1Z](images/puma-connection-flow-no-reactor.png)
33
35
 
34
- The `queue_requests` option is `true` by default, enabling the separate thread used to buffer requests as described above.
36
+ The `queue_requests` option is `true` by default, enabling the separate reactor thread used to buffer requests as described above.
35
37
 
36
38
  If set to `false`, this buffer will not be used for connections while waiting for the request to arrive.
39
+
37
40
  In this mode, when a connection is accepted, it is added to the "todo" queue immediately, and a worker will synchronously do any waiting necessary to read the HTTP request from the socket.
@@ -206,7 +206,8 @@ module Puma
206
206
  :first_data_timeout => Const::FIRST_DATA_TIMEOUT,
207
207
  :raise_exception_on_sigterm => true,
208
208
  :max_fast_inline => Const::MAX_FAST_INLINE,
209
- :io_selector_backend => :auto
209
+ :io_selector_backend => :auto,
210
+ :mutate_stdout_and_stderr_to_sync_on_write => true,
210
211
  }
211
212
  end
212
213
 
data/lib/puma/const.rb CHANGED
@@ -100,7 +100,7 @@ module Puma
100
100
  # too taxing on performance.
101
101
  module Const
102
102
 
103
- PUMA_VERSION = VERSION = "5.2.1".freeze
103
+ PUMA_VERSION = VERSION = "5.2.2".freeze
104
104
  CODE_NAME = "Fettisdagsbulle".freeze
105
105
 
106
106
  PUMA_SERVER_STRING = ['puma', PUMA_VERSION, CODE_NAME].join(' ').freeze
data/lib/puma/dsl.rb CHANGED
@@ -888,5 +888,9 @@ module Puma
888
888
  def io_selector_backend(backend)
889
889
  @options[:io_selector_backend] = backend.to_sym
890
890
  end
891
+
892
+ def mutate_stdout_and_stderr_to_sync_on_write(enabled=true)
893
+ @options[:mutate_stdout_and_stderr_to_sync_on_write] = enabled
894
+ end
891
895
  end
892
896
  end
data/lib/puma/null_io.rb CHANGED
@@ -36,6 +36,10 @@ module Puma
36
36
  true
37
37
  end
38
38
 
39
+ def sync
40
+ true
41
+ end
42
+
39
43
  def sync=(v)
40
44
  end
41
45
 
@@ -44,5 +48,9 @@ module Puma
44
48
 
45
49
  def write(*ary)
46
50
  end
51
+
52
+ def flush
53
+ self
54
+ end
47
55
  end
48
56
  end
data/lib/puma/runner.rb CHANGED
@@ -126,6 +126,11 @@ module Puma
126
126
  STDERR.puts "=== puma startup: #{Time.now} ==="
127
127
  STDERR.flush unless STDERR.sync
128
128
  end
129
+
130
+ if @options[:mutate_stdout_and_stderr_to_sync_on_write]
131
+ STDOUT.sync = true
132
+ STDERR.sync = true
133
+ end
129
134
  end
130
135
 
131
136
  def load_and_bind
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.2.1
4
+ version: 5.2.2
5
5
  platform: java
6
6
  authors:
7
7
  - Evan Phoenix
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-05 00:00:00.000000000 Z
11
+ date: 2021-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement