kino 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +5 -0
- data/CHANGELOG.md +286 -0
- data/Cargo.lock +209 -132
- data/README.md +269 -438
- data/doc/README.md +27 -2
- data/doc/architecture.md +862 -43
- data/doc/benchmarks.md +444 -214
- data/doc/configuration.md +215 -0
- data/doc/operations.md +258 -0
- data/doc/rails-on-ractors.md +161 -49
- data/doc/streaming.md +52 -0
- data/doc/websockets.md +469 -0
- data/doc/why-kino.md +6 -6
- data/doc/worker-loop.md +462 -0
- data/ext/kino/Cargo.toml +19 -3
- data/ext/kino/build.rs +32 -1
- data/ext/kino/clippy.toml +10 -0
- data/ext/kino/src/access_log.rs +70 -92
- data/ext/kino/src/control.rs +26 -685
- data/ext/kino/src/counters.rs +132 -0
- data/ext/kino/src/cpus.rs +1 -18
- data/ext/kino/src/dispatch/tests.rs +731 -0
- data/ext/kino/src/dispatch.rs +276 -0
- data/ext/kino/src/doorbell.rs +108 -0
- data/ext/kino/src/env_strings.rs +26 -30
- data/ext/kino/src/framing.rs +110 -0
- data/ext/kino/src/gvl.rs +292 -66
- data/ext/kino/src/hijack/tests.rs +416 -0
- data/ext/kino/src/hijack.rs +471 -0
- data/ext/kino/src/inline/answer.rs +488 -0
- data/ext/kino/src/inline/conn.rs +1124 -0
- data/ext/kino/src/inline/deadline.rs +421 -0
- data/ext/kino/src/inline/encode.rs +119 -0
- data/ext/kino/src/inline/io.rs +487 -0
- data/ext/kino/src/inline/mod.rs +766 -0
- data/ext/kino/src/inline/parity.rs +862 -0
- data/ext/kino/src/inline/parse.rs +131 -0
- data/ext/kino/src/inline/spin.rs +428 -0
- data/ext/kino/src/inline/testing.rs +628 -0
- data/ext/kino/src/io_shards.rs +240 -192
- data/ext/kino/src/lane_room.rs +99 -0
- data/ext/kino/src/lib.rs +139 -77
- data/ext/kino/src/listen.rs +180 -12
- data/ext/kino/src/log.rs +12 -47
- data/ext/kino/src/logsink.rs +3 -9
- data/ext/kino/src/mono.rs +12 -17
- data/ext/kino/src/pin.rs +3 -3
- data/ext/kino/src/queue/mod.rs +54 -0
- data/ext/kino/src/queue/take.rs +503 -0
- data/ext/kino/src/queue/testing.rs +107 -0
- data/ext/kino/src/queue/tests.rs +581 -0
- data/ext/kino/src/queue/worker.rs +501 -0
- data/ext/kino/src/registry.rs +168 -379
- data/ext/kino/src/request.rs +834 -235
- data/ext/kino/src/response.rs +532 -94
- data/ext/kino/src/server/accept.rs +322 -0
- data/ext/kino/src/server/config.rs +138 -0
- data/ext/kino/src/server/handle.rs +247 -0
- data/ext/kino/src/server/intake.rs +217 -0
- data/ext/kino/src/server/mod.rs +157 -0
- data/ext/kino/src/server/natives.rs +223 -0
- data/ext/kino/src/server/serve/intake_tests.rs +458 -0
- data/ext/kino/src/server/serve.rs +436 -0
- data/ext/kino/src/server/tests.rs +532 -0
- data/ext/kino/src/shared_gvl.rs +50 -0
- data/ext/kino/src/slot/lane.rs +138 -0
- data/ext/kino/src/slot/life.rs +111 -0
- data/ext/kino/src/slot/load.rs +193 -0
- data/ext/kino/src/slot/mod.rs +494 -0
- data/ext/kino/src/slot/park.rs +82 -0
- data/ext/kino/src/stats.rs +936 -0
- data/ext/kino/src/symbols.rs +66 -0
- data/ext/kino/src/test_support.rs +24 -14
- data/ext/kino/src/testing.rs +409 -0
- data/ext/kino/src/ticker.rs +87 -0
- data/ext/kino/src/timer.rs +4 -7
- data/ext/kino/src/tls.rs +101 -131
- data/ext/kino/src/typed_data.rs +131 -0
- data/ext/kino/src/upgrade.rs +77 -0
- data/ext/kino/src/ws/codec.rs +470 -0
- data/ext/kino/src/ws/drive.rs +600 -0
- data/ext/kino/src/ws/handshake.rs +267 -0
- data/ext/kino/src/ws/mod.rs +317 -0
- data/ext/kino/src/ws/server_tests.rs +759 -0
- data/ext/kino/src/ws/socket.rs +279 -0
- data/ext/kino/src/ws/stats.rs +88 -0
- data/ext/kino/src/ws/testing.rs +156 -0
- data/ext/kino/src/ws/topics.rs +550 -0
- data/lib/kino/cli.rb +100 -9
- data/lib/kino/configuration.rb +32 -10
- data/lib/kino/crash_backoff.rb +56 -0
- data/lib/kino/input.rb +36 -17
- data/lib/kino/log.rb +8 -1
- data/lib/kino/monitor.rb +1 -1
- data/lib/kino/pool.rb +169 -0
- data/lib/kino/pool_scaler.rb +12 -13
- data/lib/kino/quarantine_monitor.rb +3 -3
- data/lib/kino/ractor_supervisor.rb +201 -161
- data/lib/kino/server.rb +291 -185
- data/lib/kino/slot_bank.rb +21 -9
- data/lib/kino/stream.rb +2 -2
- data/lib/kino/teardown.rb +33 -0
- data/lib/kino/templates/kino.rb.tt +41 -6
- data/lib/kino/threaded_pool.rb +87 -102
- data/lib/kino/version.rb +1 -1
- data/lib/kino/web_socket.rb +125 -0
- data/lib/kino/worker/loop.rb +319 -0
- data/lib/kino/worker.rb +345 -79
- data/lib/kino/worker_hooks.rb +7 -1
- data/lib/kino/worker_row.rb +15 -0
- data/lib/kino.rb +27 -3
- data/lib/rackup/handler/kino.rb +1 -1
- data/sig/kino.rbs +93 -10
- metadata +66 -3
- data/ext/kino/src/queue.rs +0 -333
- data/ext/kino/src/server.rs +0 -1785
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d8a750f40079e9423e47ee307b6ffc75d6cf33a329acb8ab35c6d92617e0d436
|
|
4
|
+
data.tar.gz: 6896387128c6a6aecca57c74830e8f73470649bf91ccb952cf80c5d18782e7bc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bfe91f88fba23a1ce732fec8c7f97a94dd0fb455d3b5df5d994f29303b50f8e56996eff82377e841ca2881e9b589f2ed82c8ca9e3955c142fa66cb9fcb768136
|
|
7
|
+
data.tar.gz: 41d453a59aabaf5c19fb6cc89f17ad0fda7eabe99e41c0cb5e837e90e50238de30c0d67c31393ae685b4992a5653fb6548543f170fe0ac172796e9ce65bde935
|
data/.yardopts
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,289 @@
|
|
|
1
|
+
## [0.8.0] - 2026-11-23
|
|
2
|
+
|
|
3
|
+
### WebSockets
|
|
4
|
+
|
|
5
|
+
- Experimental native WebSockets. With `lanes true`, an app accepts a
|
|
6
|
+
WebSocket handshake by setting `env["rack.upgrade"]` to a handler
|
|
7
|
+
when `env["rack.upgrade?"]` is `:websocket`, the convention iodine
|
|
8
|
+
and Agoo use. Kino runs the protocol in Rust, and the handler's
|
|
9
|
+
`on_open`, `on_message`, `on_drained`, `on_shutdown` and `on_close`
|
|
10
|
+
run on the worker that accepted the socket, one event at a time and
|
|
11
|
+
between its requests; an idle socket costs Ruby nothing. With it come
|
|
12
|
+
topics (`ws.subscribe`, and `Kino::WebSocket.publish` from any thread
|
|
13
|
+
or Ractor), frozen, shareable socket handles (`Kino::WebSocket[id]`),
|
|
14
|
+
a per-worker wake hook (`Kino::Worker.on_wake`), flow control
|
|
15
|
+
(`ws.pending`, `on_drained`), bounded messages, queues and socket
|
|
16
|
+
counts (`websocket_max_message`, `websocket_max`), keepalive pings
|
|
17
|
+
(`websocket_ping_interval`), and a graceful drain that runs
|
|
18
|
+
`on_shutdown` and closes each socket with 1001. A callback that
|
|
19
|
+
raises drops only its own socket and goes to `on_error`. The Rails
|
|
20
|
+
example app streams new posts to WebSocket clients in ractor mode.
|
|
21
|
+
- `rack.hijack`, full and partial, is offered on HTTP/1.1 requests that
|
|
22
|
+
ask to upgrade, in both modes and with or without lanes, over TLS too,
|
|
23
|
+
so Action Cable runs unmodified in threaded mode. A full hijack
|
|
24
|
+
answers with a 101, or with a response that carries a Content-Length
|
|
25
|
+
or has no body (a 204, a 304, the answer to a HEAD); any other
|
|
26
|
+
response gets a 502. A drain does not wait for hijacked
|
|
27
|
+
connections. Each holds three file descriptors, so many open at once
|
|
28
|
+
can run the process out of them below `max_connections`.
|
|
29
|
+
|
|
30
|
+
### `worker_loop` and inline serving
|
|
31
|
+
|
|
32
|
+
- Experimental `worker_loop`: an app can run its own fiber scheduler,
|
|
33
|
+
such as Async's, on every Kino worker thread, in both modes. Kino
|
|
34
|
+
hands the scheduler each request as a job, so a request that waits
|
|
35
|
+
suspends only its fiber while the worker takes the next one. Kino
|
|
36
|
+
still owns the Ractors, threads, dispatch and HTTP, and ships no
|
|
37
|
+
scheduler: the app's `worker_loop` proc starts one and calls
|
|
38
|
+
`worker.serve(concurrency: 32) { |job| task.async { job.call } }`.
|
|
39
|
+
At most `concurrency` requests run at once on a worker, WebSocket
|
|
40
|
+
callbacks and the wake hook run alongside them, and `rack.input`
|
|
41
|
+
reads and streamed writes wait by readiness under any fiber
|
|
42
|
+
scheduler. Dispatch spreads requests by what each worker has open,
|
|
43
|
+
and with every worker full a request waits its turn, in the order
|
|
44
|
+
requests came (counted in `queued`), up to `queue_timeout`.
|
|
45
|
+
Quarantine and `busy_ms` judge such a worker by how long its thread
|
|
46
|
+
stays away from its loop. `worker_loop` turns lanes on, refuses
|
|
47
|
+
`lanes false` and ignores `batch`; apps without it keep Kino's own
|
|
48
|
+
loop as it was.
|
|
49
|
+
- Inline connections: a `worker_loop` server serves plain HTTP/1.1
|
|
50
|
+
connections, over TCP or a unix socket, on its worker threads, with
|
|
51
|
+
nothing to configure. Each goes to a worker with room for it, whose
|
|
52
|
+
loop runs it as a job: Kino reads, parses and answers each request on
|
|
53
|
+
the worker's thread, with no hand-off between threads, no wake-up and
|
|
54
|
+
no task per request. Anything outside a strict subset of HTTP/1.1
|
|
55
|
+
(HTTP/1.0, a chunked or larger body, `Expect`, an upgrade) goes back
|
|
56
|
+
to hyper before the app sees it, with the bytes already read, and
|
|
57
|
+
TLS and HTTP/2 stay with hyper. Behind nginx, connections stay inline
|
|
58
|
+
while nginx speaks HTTP/1.1 with keep-alive, as it does by default
|
|
59
|
+
since 1.29.7. With it:
|
|
60
|
+
- A worker takes at most `concurrency` connections and serves them in
|
|
61
|
+
turn, so a slow request delays the other connections on its worker.
|
|
62
|
+
- A connection's requests run on one fiber, so fiber-local state one
|
|
63
|
+
sets is still there for the next, which behind a proxy can be
|
|
64
|
+
another client's: reset per request what you set.
|
|
65
|
+
- Inline connections keep hyper's deadlines, drain and answers, with a
|
|
66
|
+
few recorded differences: a stricter deadline for the first head,
|
|
67
|
+
headers an app should not set, and four at the drain, one of which
|
|
68
|
+
drops a kept-alive request whose head is over 16 KiB. A retiring
|
|
69
|
+
worker hands its connections to hyper, and a crashing one those
|
|
70
|
+
waiting for a request.
|
|
71
|
+
- A connection alone on an otherwise idle worker spins for up to
|
|
72
|
+
100 µs for its client's next request, with the GVL released, backing
|
|
73
|
+
off to a spin in 32 requests for a client that mostly comes later.
|
|
74
|
+
- `stats[:inline]` (nil, and null in `/stats`, on a server that serves
|
|
75
|
+
nothing inline) and `kino_inline_*` in `/metrics` count connections,
|
|
76
|
+
requests, hand-backs, cuts and spins; each `worker_status`
|
|
77
|
+
row counts its inline connections.
|
|
78
|
+
|
|
79
|
+
### Performance
|
|
80
|
+
|
|
81
|
+
- With `lanes true`, a request that arrives while every worker is idle
|
|
82
|
+
now goes to the worker that finished most recently, whose caches are
|
|
83
|
+
still warm, instead of rotating through all of them. A lightly loaded
|
|
84
|
+
server keeps one client's requests on one worker; a burst still
|
|
85
|
+
spreads across idle workers. On the heavier server-rendered pages of
|
|
86
|
+
a database-backed Rails chat app, together with `io_shards true`,
|
|
87
|
+
this turned a 13-15% single-client deficit against a fiber-based
|
|
88
|
+
server into parity or better. A request also no longer queues behind
|
|
89
|
+
a worker that is 100 µs or more into its current request while
|
|
90
|
+
another worker sits idle: a fast request next to a one-second one used
|
|
91
|
+
to wait up to 50 ms and is now answered as quickly as without lanes,
|
|
92
|
+
while handlers faster than 100 µs keep their hot lane. In threaded
|
|
93
|
+
mode, where every worker shares one GVL, a CPU-bound app keeps its
|
|
94
|
+
throughput and mean latency, but with four clients on a 0.6 ms
|
|
95
|
+
endpoint the median rose from 1.2 to 2.4 ms while the 99th percentile
|
|
96
|
+
fell from 56 to 3 ms.
|
|
97
|
+
- Built for a Ruby that supports it (4.1 and later), Kino's own native
|
|
98
|
+
objects are freed in each Ractor's own garbage collection, and no
|
|
99
|
+
longer wait for the batch frees that stop every Ractor. On a Ruby 4.1
|
|
100
|
+
development build this raised throughput and cut tail latency under
|
|
101
|
+
load.
|
|
102
|
+
- `rack.input` reads cost less: each read takes its bytes from an
|
|
103
|
+
offset into what Kino pulled from the client, sharing them or filling
|
|
104
|
+
the caller's buffer, where it used to cut and copy them. A 500 KiB
|
|
105
|
+
upload read 4 KiB at a time spends about a sixth of the time it did.
|
|
106
|
+
|
|
107
|
+
### Reliability
|
|
108
|
+
|
|
109
|
+
- Every listener and every worker is hardened. Changes that may need
|
|
110
|
+
action: a `queue_depth` below 1 fails at boot; `on_worker_exit` gets
|
|
111
|
+
a `Kino::Error` for a killed worker thread, where it got nil; over
|
|
112
|
+
TLS, a client that speaks other than what it chose by ALPN is no
|
|
113
|
+
longer served; a `Thread#raise` into an idle worker crashes it, and
|
|
114
|
+
it is respawned. A connection that has not sent its first bytes (with
|
|
115
|
+
HTTP/2, the whole preface) 15 s after the accept is closed, and one
|
|
116
|
+
that has sent nothing as soon as the drain begins, where with HTTP/2
|
|
117
|
+
on it used to stay open for good. An HTTP/2 peer that is gone no
|
|
118
|
+
longer holds its connection: one silent for 30 s gets a ping, and is
|
|
119
|
+
closed unless it answers within 20 s. With no request waiting, an
|
|
120
|
+
answer's body is closed as soon as the answer is out, not when the
|
|
121
|
+
next request arrives, and every body is closed exactly once; a
|
|
122
|
+
`close` that raises no longer loses the request taken with its answer.
|
|
123
|
+
- In ractor mode, a worker thread that crashes (an exception that is not
|
|
124
|
+
a `StandardError`) is now cleaned up and replaced inside its ractor:
|
|
125
|
+
its in-flight requests get their 500 at once, any sibling threads
|
|
126
|
+
carry on, and the ractor's own state and app threads survive, where
|
|
127
|
+
before the crash could take the whole ractor down. `on_worker_exit`
|
|
128
|
+
fires for each crashed thread, with a `Kino::Error` naming a cause
|
|
129
|
+
that cannot be copied out of its ractor. In both modes, a worker that
|
|
130
|
+
keeps crashing within a second of starting, before it served a
|
|
131
|
+
request, `after_worker_boot` included, is now respawned after a delay
|
|
132
|
+
that doubles from 0.1 s to 5 s instead of thousands of times a second,
|
|
133
|
+
the log showing the first crash with its backtrace and each later one
|
|
134
|
+
as a single line; and a crashed worker's slot goes to a later worker
|
|
135
|
+
once its connections are gone, so crashes no longer grow the
|
|
136
|
+
per-worker rows of `stats`, `/stats` and `/metrics`, and with
|
|
137
|
+
`lanes true` a request that arrives while a crashed worker is being
|
|
138
|
+
replaced waits for a worker instead of getting a 503. A worker thread
|
|
139
|
+
that ends without being asked to, `Thread#kill` included, is a crash
|
|
140
|
+
in both modes. A crashed worker's queued requests go to the other
|
|
141
|
+
workers as new arrivals, their `queue_timeout` starting over, rather
|
|
142
|
+
than get a 500, and a request a worker let go of unanswered gets its
|
|
143
|
+
500 as soon as the worker comes back for its next request or leaves.
|
|
144
|
+
- A streaming response body's write now raises `Kino::ClientGone`, an
|
|
145
|
+
`IOError`, once its client has gone, for enumerable bodies and Rack 3
|
|
146
|
+
streaming bodies alike. Writes to a vanished client used to succeed
|
|
147
|
+
silently, so an endless body such as a server-sent event feed never
|
|
148
|
+
ended and held its worker for good. A body whose response can carry
|
|
149
|
+
none (a HEAD request, a 204 or 304, or one a `request_timeout` 504
|
|
150
|
+
already answered) ends the same way as soon as it writes. Kino treats
|
|
151
|
+
this as the normal end of the request: the body is closed and
|
|
152
|
+
`after_request_complete` runs, with nothing logged and nothing sent
|
|
153
|
+
to `on_error`. Giving up on a stream whose client stopped reading no
|
|
154
|
+
longer waits for that client, so a body that raised mid-stream no
|
|
155
|
+
longer stalls its worker, nor a shutdown past its deadline. Answering
|
|
156
|
+
a request while a thread of the app's own still reads its body works
|
|
157
|
+
too, so a full-duplex body can read on one thread while another
|
|
158
|
+
writes; a `rack.hijack` call then raises an `IOError`, and a WebSocket
|
|
159
|
+
handshake gets a 500. A Rack 3 streaming body that raises mid-stream
|
|
160
|
+
now has its connection cut, as an enumerable body's is, instead of
|
|
161
|
+
ending as if complete. Likewise, a request body cut short by a
|
|
162
|
+
shutdown past its deadline now raises "request interrupted during
|
|
163
|
+
shutdown" when read, instead of ending early as if it were complete.
|
|
164
|
+
- Kino's listener now asks for the longest accept queue the kernel
|
|
165
|
+
allows (`net.core.somaxconn`, 4096 on current Linux) where it had 128,
|
|
166
|
+
so on Linux a burst of new connections no longer loses SYNs and waits
|
|
167
|
+
a second to retry. While Kino is not accepting, that many clients now
|
|
168
|
+
wait connected: overload shows as a slow first byte, and a health
|
|
169
|
+
check that only opens a TCP connection passes for longer. macOS, at
|
|
170
|
+
128 by default, is unchanged.
|
|
171
|
+
- A server booting on a unix socket path, its listener's or its control
|
|
172
|
+
plane's, no longer waits on Linux when a live server there has a full
|
|
173
|
+
accept queue: it is refused at once. A crashed server's socket is
|
|
174
|
+
still reclaimed at the next boot; a path that holds something other
|
|
175
|
+
than a socket is now refused, where Linux used to delete it. On macOS
|
|
176
|
+
a boot can still take the path of a live server whose accept queue is
|
|
177
|
+
full, and two boots at the same instant on a stale path can both bind
|
|
178
|
+
it; a `pidfile` the two share prevents both.
|
|
179
|
+
- Out of file descriptors, Kino now waits 10 ms between attempts to
|
|
180
|
+
accept a connection instead of retrying in a tight loop that kept a
|
|
181
|
+
CPU busy.
|
|
182
|
+
|
|
183
|
+
### Defaults and stats
|
|
184
|
+
|
|
185
|
+
- In ractor mode the default worker count is now the CPU count capped
|
|
186
|
+
at `RUBY_MAX_CPU` (8 unless set), so a default boot no longer warns
|
|
187
|
+
on machines with more than 8 cores. An explicit `workers` is
|
|
188
|
+
unchanged, and threaded mode still defaults to the CPU count.
|
|
189
|
+
- `stats`, `/stats` and `/metrics` now count WebSockets (process-wide,
|
|
190
|
+
under `websockets`; `kino_websockets_*` and `kino_websocket_*_total`
|
|
191
|
+
with causes in a `cause` label), wake hook runs (`kino_wakes_total`),
|
|
192
|
+
open hijacked connections (`kino_hijacked_connections`, and in each
|
|
193
|
+
`worker_status` row with its open sockets) and streamed responses cut
|
|
194
|
+
short, by cause (`responses_cut`, `kino_responses_cut_total`). A
|
|
195
|
+
request leaves `in_flight` once the app hijacks it. `Server#stats`
|
|
196
|
+
keys and the USR1 stats line now follow the order `/stats` reports
|
|
197
|
+
them in.
|
|
198
|
+
|
|
199
|
+
### Fixed
|
|
200
|
+
|
|
201
|
+
- Fixed requests in threaded mode waiting for seconds under sustained
|
|
202
|
+
load. A worker that kept finding requests queued held the GVL until
|
|
203
|
+
Ruby's 100 ms timer took it away, most often in the middle of a
|
|
204
|
+
request, which then waited for every other worker thread's 100 ms:
|
|
205
|
+
over two seconds with 8 workers of 3 threads. A request handed to an
|
|
206
|
+
idle worker could wait as long. A worker now lets the threads waiting
|
|
207
|
+
for the GVL run between two requests once it has held it for a
|
|
208
|
+
millisecond, plus the request it was running. On 8 CPUs the slowest
|
|
209
|
+
response of a CPU-bound endpoint went from 2.3 s to 26 ms at the same
|
|
210
|
+
throughput, while its median rose from 2.2 to 3.4 ms (with `lanes
|
|
211
|
+
true`, where a request waits for its own worker, from 0.16 to 3.7 ms).
|
|
212
|
+
Where workers otherwise rarely hand the GVL over it costs throughput:
|
|
213
|
+
plain-text responses gave up 5% with `io_shards true`, and 2% under a
|
|
214
|
+
`worker_loop` (1% with 16 clients), whose waits in its own scheduler
|
|
215
|
+
Kino does not see, so it may pass the GVL again right after one. Ractor
|
|
216
|
+
mode with more than one thread per worker gets the same bound; with
|
|
217
|
+
one, the default, it is unchanged.
|
|
218
|
+
- Fixed a complete response going out with the app's `Content-Length`
|
|
219
|
+
when that disagreed with its body: on a kept-alive HTTP/1.1
|
|
220
|
+
connection, the rest of a longer body was read as the next response,
|
|
221
|
+
or a shorter one swallowed the start of the next, and over HTTP/2 the
|
|
222
|
+
client got a mismatched length. A complete body now goes out with its
|
|
223
|
+
own length, and an app's own `Transfer-Encoding` on it is dropped
|
|
224
|
+
(beside a `Content-Length` it used to make Kino close the connection
|
|
225
|
+
unanswered); an app that compresses its body says so in
|
|
226
|
+
`Content-Encoding`.
|
|
227
|
+
- Fixed `Server.run`, the `kino` executable and the Rack handler
|
|
228
|
+
waiting for the workers to exit rather than for the shutdown to end:
|
|
229
|
+
after INT or TERM the process could exit with its pidfile and socket
|
|
230
|
+
files still in place; with `max_workers` above `workers` it could
|
|
231
|
+
exit on its own once the pool retired its first worker; and in
|
|
232
|
+
ractor mode a worker stuck past `shutdown_timeout` kept it from
|
|
233
|
+
exiting at all. They now return once the shutdown has ended and
|
|
234
|
+
raise its error if it failed, so the process exits non-zero. A
|
|
235
|
+
`shutdown` called during another now waits for it.
|
|
236
|
+
- Fixed a worker that waited for its next request leaving for good when
|
|
237
|
+
another thread called `Thread#wakeup` or `Thread#run` on it: it took
|
|
238
|
+
the wake for a shutdown, nothing replaced it, and requests sent its
|
|
239
|
+
way hung until the drain gave up on them. It now goes back to
|
|
240
|
+
waiting, and a request it takes just as a `Thread#raise` arrives is
|
|
241
|
+
no longer lost: it goes back to wait for the next take, or, with
|
|
242
|
+
nowhere to go back to, is answered with a 500 at once, and the
|
|
243
|
+
exception is raised first. A request waiting on its client, for more
|
|
244
|
+
of its body or for room for the next chunk of a streamed response, no
|
|
245
|
+
longer fails with "request interrupted during shutdown" when woken
|
|
246
|
+
either, and a `Thread#raise`, which `Timeout.timeout` uses, reaches
|
|
247
|
+
the app's `rescue` with the request intact: a streamed response the
|
|
248
|
+
app then ends now ends for the client too, where it used to stay
|
|
249
|
+
open, and the app can still take the connection over with
|
|
250
|
+
`rack.hijack`, which used to fail.
|
|
251
|
+
- Fixed a threaded worker killed by an exception outside
|
|
252
|
+
`StandardError` (`raise Exception`, a stack overflow) leaving its
|
|
253
|
+
client unanswered and its request in flight, so the next shutdown
|
|
254
|
+
waited out `shutdown_timeout` or was cut short by the crash. As in
|
|
255
|
+
ractor mode, the client now gets a 500 at once and a fresh thread
|
|
256
|
+
takes its place, counted in `respawns` and
|
|
257
|
+
`kino_worker_respawns_total`.
|
|
258
|
+
- Fixed a streamed response cut short, as the app raised mid-stream or
|
|
259
|
+
its worker crashed, sometimes reaching its client as nothing at all,
|
|
260
|
+
head included, rather than as what was written followed by the cut,
|
|
261
|
+
over HTTP/1.1 and HTTP/2 alike.
|
|
262
|
+
- Fixed HTTP/2 answers that may carry no body: one to a HEAD request,
|
|
263
|
+
Kino's own 500, 503 and 504 included, sent its body, and so did a 204
|
|
264
|
+
or 304 the app streamed, while a 204 sent a `Content-Length`; clients
|
|
265
|
+
built on nghttp2, such as curl, refuse either as a protocol error.
|
|
266
|
+
Such answers now carry no body, and a 204 no length.
|
|
267
|
+
- Fixed `Server#shutdown` with a `timeout:` that is NaN, negative or not
|
|
268
|
+
a number: it is now refused with an `ArgumentError` before the
|
|
269
|
+
shutdown begins, leaving the server serving and no `Server#wait`
|
|
270
|
+
seeing the error, and such a `shutdown_timeout` fails at boot.
|
|
271
|
+
`Float::INFINITY` still waits for the drain however long it takes.
|
|
272
|
+
- Fixed `SERVER_PORT` for a request whose `Host` (or HTTP/2
|
|
273
|
+
`:authority`) names no port: it is now the port of the listener that
|
|
274
|
+
took the request (80 on a unix socket), where a process running more
|
|
275
|
+
than one server reported the port of whichever saw that host first.
|
|
276
|
+
|
|
277
|
+
### Dependencies
|
|
278
|
+
|
|
279
|
+
- Updated dependencies, including magnus 0.9.4, bytes 1.12.2 and
|
|
280
|
+
rustls-webpki 0.103.17.
|
|
281
|
+
|
|
282
|
+
## [0.7.2] - 2026-10-24
|
|
283
|
+
|
|
284
|
+
- Updated dependencies, including tokio 1.54, hyper 1.12 and
|
|
285
|
+
parking_lot 0.13, which is faster under lock contention.
|
|
286
|
+
|
|
1
287
|
## [0.7.1] - 2026-09-25
|
|
2
288
|
|
|
3
289
|
- Updated Magnus to 0.9 and other dependencies.
|