kino 0.7.0 → 0.7.2
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/CHANGELOG.md +14 -0
- data/Cargo.lock +110 -109
- data/ext/kino/Cargo.toml +4 -4
- data/ext/kino/src/env_strings.rs +23 -9
- data/ext/kino/src/pin.rs +47 -8
- data/ext/kino/src/registry.rs +1 -1
- data/ext/kino/src/request.rs +1 -1
- data/ext/kino/src/server.rs +2 -1
- data/lib/kino/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d5ba3faf99dcffba28d12558dfba29e21f37498d67699fb710acae3f4a74fc8d
|
|
4
|
+
data.tar.gz: 6c8a712e396ef28ca00d20ebe87aca91ca8bc816dd3c75442c49de014300612d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0a118f9340c9f57922fe2a5e9a2451c540e3d5483c16fcaf841998a5f90d2dbfa9502fd8800c5533c19ec605d4933c21a747fa242644838b6ffce0fabd6ef171
|
|
7
|
+
data.tar.gz: 15268eeccc7ecb86973673a3e55959bb438e362c565f0b60800f70dba5285da543f5511b9d18a8c5cd7c316984b63d77df11b9bafac3f67e1116a4c1184d104a
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
1
|
+
## [0.7.2] - 2026-10-24
|
|
2
|
+
|
|
3
|
+
- Updated dependencies, including tokio 1.54, hyper 1.12 and
|
|
4
|
+
parking_lot 0.13, which is faster under lock contention.
|
|
5
|
+
|
|
6
|
+
## [0.7.1] - 2026-09-25
|
|
7
|
+
|
|
8
|
+
- Updated Magnus to 0.9 and other dependencies.
|
|
9
|
+
- Kino is now tested against Ruby HEAD (the unreleased next version)
|
|
10
|
+
as well as Ruby 4.0.
|
|
11
|
+
- Fixed a crash on Ruby 4.1 in ractor mode: with Ruby's new
|
|
12
|
+
per-ractor GC, a worker ractor could collect cached env strings and
|
|
13
|
+
large response bodies that other ractors were still using.
|
|
14
|
+
|
|
1
15
|
## [0.7.0] - 2026-09-08
|
|
2
16
|
|
|
3
17
|
- Experimental elastic worker pool. Set `max_workers` above `workers`
|
data/Cargo.lock
CHANGED
|
@@ -24,12 +24,6 @@ dependencies = [
|
|
|
24
24
|
"memchr",
|
|
25
25
|
]
|
|
26
26
|
|
|
27
|
-
[[package]]
|
|
28
|
-
name = "allocator-api2"
|
|
29
|
-
version = "0.2.21"
|
|
30
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
31
|
-
checksum = "683d7910e743518b0e34f1186f92494becacb047c7b6bf616c96772180fef923"
|
|
32
|
-
|
|
33
27
|
[[package]]
|
|
34
28
|
name = "atomic-waker"
|
|
35
29
|
version = "1.1.2"
|
|
@@ -42,7 +36,7 @@ version = "0.72.1"
|
|
|
42
36
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
43
37
|
checksum = "993776b509cfb49c750f11b8f07a46fa23e0a1386ffc01fb1e7d343efc387895"
|
|
44
38
|
dependencies = [
|
|
45
|
-
"bitflags 2.13.
|
|
39
|
+
"bitflags 2.13.2",
|
|
46
40
|
"cexpr",
|
|
47
41
|
"clang-sys",
|
|
48
42
|
"itertools",
|
|
@@ -62,9 +56,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
|
|
|
62
56
|
|
|
63
57
|
[[package]]
|
|
64
58
|
name = "bitflags"
|
|
65
|
-
version = "2.13.
|
|
59
|
+
version = "2.13.2"
|
|
66
60
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
67
|
-
checksum = "
|
|
61
|
+
checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06"
|
|
68
62
|
|
|
69
63
|
[[package]]
|
|
70
64
|
name = "bumpalo"
|
|
@@ -80,9 +74,9 @@ checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04"
|
|
|
80
74
|
|
|
81
75
|
[[package]]
|
|
82
76
|
name = "cc"
|
|
83
|
-
version = "1.
|
|
77
|
+
version = "1.10.0"
|
|
84
78
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
85
|
-
checksum = "
|
|
79
|
+
checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0"
|
|
86
80
|
dependencies = [
|
|
87
81
|
"find-msvc-tools",
|
|
88
82
|
"shlex 2.0.1",
|
|
@@ -99,9 +93,9 @@ dependencies = [
|
|
|
99
93
|
|
|
100
94
|
[[package]]
|
|
101
95
|
name = "cfg-if"
|
|
102
|
-
version = "1.0.
|
|
96
|
+
version = "1.0.5"
|
|
103
97
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
104
|
-
checksum = "
|
|
98
|
+
checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600"
|
|
105
99
|
|
|
106
100
|
[[package]]
|
|
107
101
|
name = "clang-sys"
|
|
@@ -116,9 +110,9 @@ dependencies = [
|
|
|
116
110
|
|
|
117
111
|
[[package]]
|
|
118
112
|
name = "defmt"
|
|
119
|
-
version = "1.
|
|
113
|
+
version = "1.2.0"
|
|
120
114
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
121
|
-
checksum = "
|
|
115
|
+
checksum = "e4a0795ac740cb54d7b3775c9c17345f6aaecf884c01733b39d6017738e0e3e1"
|
|
122
116
|
dependencies = [
|
|
123
117
|
"bitflags 1.3.2",
|
|
124
118
|
"defmt-macros",
|
|
@@ -126,36 +120,36 @@ dependencies = [
|
|
|
126
120
|
|
|
127
121
|
[[package]]
|
|
128
122
|
name = "defmt-macros"
|
|
129
|
-
version = "1.
|
|
123
|
+
version = "1.2.0"
|
|
130
124
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
131
|
-
checksum = "
|
|
125
|
+
checksum = "840bb056bd99c495c9188198a258ab787c79f306d864db3e6e8451442d6d8366"
|
|
132
126
|
dependencies = [
|
|
133
127
|
"defmt-parser",
|
|
134
128
|
"proc-macro2",
|
|
135
129
|
"quote",
|
|
136
|
-
"syn
|
|
130
|
+
"syn 3.0.9",
|
|
137
131
|
]
|
|
138
132
|
|
|
139
133
|
[[package]]
|
|
140
134
|
name = "defmt-parser"
|
|
141
|
-
version = "1.
|
|
135
|
+
version = "1.1.0"
|
|
142
136
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
143
|
-
checksum = "
|
|
137
|
+
checksum = "71958f69fb2de856c5dd51ac9377e986ca1aa5919f931bf5395a807277f889a0"
|
|
144
138
|
dependencies = [
|
|
145
139
|
"thiserror",
|
|
146
140
|
]
|
|
147
141
|
|
|
148
142
|
[[package]]
|
|
149
143
|
name = "either"
|
|
150
|
-
version = "1.
|
|
144
|
+
version = "1.19.0"
|
|
151
145
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
152
|
-
checksum = "
|
|
146
|
+
checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be"
|
|
153
147
|
|
|
154
148
|
[[package]]
|
|
155
149
|
name = "equivalent"
|
|
156
|
-
version = "1.0.
|
|
150
|
+
version = "1.0.3"
|
|
157
151
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
158
|
-
checksum = "
|
|
152
|
+
checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826"
|
|
159
153
|
|
|
160
154
|
[[package]]
|
|
161
155
|
name = "fastrand"
|
|
@@ -168,9 +162,9 @@ dependencies = [
|
|
|
168
162
|
|
|
169
163
|
[[package]]
|
|
170
164
|
name = "find-msvc-tools"
|
|
171
|
-
version = "0.1.
|
|
165
|
+
version = "0.1.15"
|
|
172
166
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
173
|
-
checksum = "
|
|
167
|
+
checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48"
|
|
174
168
|
|
|
175
169
|
[[package]]
|
|
176
170
|
name = "flume"
|
|
@@ -261,9 +255,9 @@ checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b"
|
|
|
261
255
|
|
|
262
256
|
[[package]]
|
|
263
257
|
name = "h2"
|
|
264
|
-
version = "0.4.
|
|
258
|
+
version = "0.4.20"
|
|
265
259
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
266
|
-
checksum = "
|
|
260
|
+
checksum = "7d29020232d6aa3fb1daca64c1127cf662cf97f254ae16c18c05b8ab635fc118"
|
|
267
261
|
dependencies = [
|
|
268
262
|
"atomic-waker",
|
|
269
263
|
"bytes",
|
|
@@ -284,8 +278,6 @@ version = "0.17.1"
|
|
|
284
278
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
285
279
|
checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a"
|
|
286
280
|
dependencies = [
|
|
287
|
-
"allocator-api2",
|
|
288
|
-
"equivalent",
|
|
289
281
|
"foldhash",
|
|
290
282
|
]
|
|
291
283
|
|
|
@@ -336,9 +328,9 @@ checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9"
|
|
|
336
328
|
|
|
337
329
|
[[package]]
|
|
338
330
|
name = "hyper"
|
|
339
|
-
version = "1.
|
|
331
|
+
version = "1.12.0"
|
|
340
332
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
341
|
-
checksum = "
|
|
333
|
+
checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c"
|
|
342
334
|
dependencies = [
|
|
343
335
|
"atomic-waker",
|
|
344
336
|
"bytes",
|
|
@@ -358,9 +350,9 @@ dependencies = [
|
|
|
358
350
|
|
|
359
351
|
[[package]]
|
|
360
352
|
name = "hyper-util"
|
|
361
|
-
version = "0.1.
|
|
353
|
+
version = "0.1.21"
|
|
362
354
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
363
|
-
checksum = "
|
|
355
|
+
checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff"
|
|
364
356
|
dependencies = [
|
|
365
357
|
"bytes",
|
|
366
358
|
"http",
|
|
@@ -372,9 +364,9 @@ dependencies = [
|
|
|
372
364
|
|
|
373
365
|
[[package]]
|
|
374
366
|
name = "indexmap"
|
|
375
|
-
version = "2.14.
|
|
367
|
+
version = "2.14.2"
|
|
376
368
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
377
|
-
checksum = "
|
|
369
|
+
checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855"
|
|
378
370
|
dependencies = [
|
|
379
371
|
"equivalent",
|
|
380
372
|
"hashbrown",
|
|
@@ -397,9 +389,9 @@ checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682"
|
|
|
397
389
|
|
|
398
390
|
[[package]]
|
|
399
391
|
name = "jiff"
|
|
400
|
-
version = "0.2.
|
|
392
|
+
version = "0.2.38"
|
|
401
393
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
402
|
-
checksum = "
|
|
394
|
+
checksum = "b2b005715dcbeb0089a3c0dab99f2ff1cc3b2525323552703d648585d342a383"
|
|
403
395
|
dependencies = [
|
|
404
396
|
"defmt",
|
|
405
397
|
"jiff-core",
|
|
@@ -413,18 +405,19 @@ dependencies = [
|
|
|
413
405
|
|
|
414
406
|
[[package]]
|
|
415
407
|
name = "jiff-core"
|
|
416
|
-
version = "0.1.
|
|
408
|
+
version = "0.1.1"
|
|
417
409
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
418
|
-
checksum = "
|
|
410
|
+
checksum = "5e52fe76043ccecc9005d2305ebaadf7d7fc0cc89ca6baa10a94d6bc68c7128c"
|
|
419
411
|
dependencies = [
|
|
420
412
|
"defmt",
|
|
413
|
+
"log",
|
|
421
414
|
]
|
|
422
415
|
|
|
423
416
|
[[package]]
|
|
424
417
|
name = "jiff-static"
|
|
425
|
-
version = "0.2.
|
|
418
|
+
version = "0.2.38"
|
|
426
419
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
427
|
-
checksum = "
|
|
420
|
+
checksum = "2cc9817253cf7c7ee4684451bd327e88d6f3658014e54a29198625590650695c"
|
|
428
421
|
dependencies = [
|
|
429
422
|
"jiff-core",
|
|
430
423
|
"proc-macro2",
|
|
@@ -434,9 +427,9 @@ dependencies = [
|
|
|
434
427
|
|
|
435
428
|
[[package]]
|
|
436
429
|
name = "js-sys"
|
|
437
|
-
version = "0.3.
|
|
430
|
+
version = "0.3.106"
|
|
438
431
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
439
|
-
checksum = "
|
|
432
|
+
checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5"
|
|
440
433
|
dependencies = [
|
|
441
434
|
"cfg-if",
|
|
442
435
|
"wasm-bindgen",
|
|
@@ -444,7 +437,7 @@ dependencies = [
|
|
|
444
437
|
|
|
445
438
|
[[package]]
|
|
446
439
|
name = "kino"
|
|
447
|
-
version = "0.7.
|
|
440
|
+
version = "0.7.2"
|
|
448
441
|
dependencies = [
|
|
449
442
|
"ahash",
|
|
450
443
|
"bytes",
|
|
@@ -468,15 +461,15 @@ dependencies = [
|
|
|
468
461
|
|
|
469
462
|
[[package]]
|
|
470
463
|
name = "lazy_static"
|
|
471
|
-
version = "1.5.
|
|
464
|
+
version = "1.5.1"
|
|
472
465
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
473
|
-
checksum = "
|
|
466
|
+
checksum = "20870f649af7073d53e38067b2a84312175d56ea15217e1b15bc83506ec50afb"
|
|
474
467
|
|
|
475
468
|
[[package]]
|
|
476
469
|
name = "libc"
|
|
477
|
-
version = "0.2.
|
|
470
|
+
version = "0.2.191"
|
|
478
471
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
479
|
-
checksum = "
|
|
472
|
+
checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a"
|
|
480
473
|
|
|
481
474
|
[[package]]
|
|
482
475
|
name = "libloading"
|
|
@@ -506,6 +499,15 @@ dependencies = [
|
|
|
506
499
|
"scopeguard",
|
|
507
500
|
]
|
|
508
501
|
|
|
502
|
+
[[package]]
|
|
503
|
+
name = "lock_api"
|
|
504
|
+
version = "0.5.0"
|
|
505
|
+
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
506
|
+
checksum = "65d91b22da179613dcf4d6ec8349563f52a363f6849e03b00dd0a185ec4a59af"
|
|
507
|
+
dependencies = [
|
|
508
|
+
"scopeguard",
|
|
509
|
+
]
|
|
510
|
+
|
|
509
511
|
[[package]]
|
|
510
512
|
name = "log"
|
|
511
513
|
version = "0.4.34"
|
|
@@ -514,18 +516,18 @@ checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6"
|
|
|
514
516
|
|
|
515
517
|
[[package]]
|
|
516
518
|
name = "lru"
|
|
517
|
-
version = "0.
|
|
519
|
+
version = "0.19.0"
|
|
518
520
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
519
|
-
checksum = "
|
|
521
|
+
checksum = "4a9f71e3591c7ec44d3e563e87bf14ddc2bada8519dca046e5b0e560cd004e2d"
|
|
520
522
|
dependencies = [
|
|
521
523
|
"hashbrown",
|
|
522
524
|
]
|
|
523
525
|
|
|
524
526
|
[[package]]
|
|
525
527
|
name = "magnus"
|
|
526
|
-
version = "0.
|
|
528
|
+
version = "0.9.3"
|
|
527
529
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
528
|
-
checksum = "
|
|
530
|
+
checksum = "40ef424404d166cbb71c8b8d19c9c589c748c4547c1afa1928c5504299f6c713"
|
|
529
531
|
dependencies = [
|
|
530
532
|
"magnus-macros",
|
|
531
533
|
"rb-sys",
|
|
@@ -535,9 +537,9 @@ dependencies = [
|
|
|
535
537
|
|
|
536
538
|
[[package]]
|
|
537
539
|
name = "magnus-macros"
|
|
538
|
-
version = "0.
|
|
540
|
+
version = "0.9.1"
|
|
539
541
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
540
|
-
checksum = "
|
|
542
|
+
checksum = "9dafde2eeb66f090e0f326112323eb8324b12cb32b5d1210e541d3df6b0ce77e"
|
|
541
543
|
dependencies = [
|
|
542
544
|
"proc-macro2",
|
|
543
545
|
"quote",
|
|
@@ -567,9 +569,9 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a"
|
|
|
567
569
|
|
|
568
570
|
[[package]]
|
|
569
571
|
name = "mio"
|
|
570
|
-
version = "1.2.
|
|
572
|
+
version = "1.2.4"
|
|
571
573
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
572
|
-
checksum = "
|
|
574
|
+
checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee"
|
|
573
575
|
dependencies = [
|
|
574
576
|
"libc",
|
|
575
577
|
"wasi",
|
|
@@ -594,21 +596,20 @@ checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50"
|
|
|
594
596
|
|
|
595
597
|
[[package]]
|
|
596
598
|
name = "parking_lot"
|
|
597
|
-
version = "0.
|
|
599
|
+
version = "0.13.0"
|
|
598
600
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
599
|
-
checksum = "
|
|
601
|
+
checksum = "a9cf937ca4e1d0b7578784559063422fc39ae7c5a00f02471f2614d5486fd226"
|
|
600
602
|
dependencies = [
|
|
601
|
-
"lock_api",
|
|
603
|
+
"lock_api 0.5.0",
|
|
602
604
|
"parking_lot_core",
|
|
603
605
|
]
|
|
604
606
|
|
|
605
607
|
[[package]]
|
|
606
608
|
name = "parking_lot_core"
|
|
607
|
-
version = "0.
|
|
609
|
+
version = "0.10.0"
|
|
608
610
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
609
|
-
checksum = "
|
|
611
|
+
checksum = "9cfff060068cc18aa7815010fcaf80c68c7fb9e85fc7f5c0f9bf142c21d19826"
|
|
610
612
|
dependencies = [
|
|
611
|
-
"cfg-if",
|
|
612
613
|
"libc",
|
|
613
614
|
"redox_syscall",
|
|
614
615
|
"smallvec",
|
|
@@ -629,9 +630,9 @@ checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85"
|
|
|
629
630
|
|
|
630
631
|
[[package]]
|
|
631
632
|
name = "portable-atomic-util"
|
|
632
|
-
version = "0.2.
|
|
633
|
+
version = "0.2.8"
|
|
633
634
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
634
|
-
checksum = "
|
|
635
|
+
checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715"
|
|
635
636
|
dependencies = [
|
|
636
637
|
"portable-atomic",
|
|
637
638
|
]
|
|
@@ -698,11 +699,11 @@ checksum = "cca7ad6a7e21e72151d56fe2495a259b5670e204c3adac41ee7ef676ea08117a"
|
|
|
698
699
|
|
|
699
700
|
[[package]]
|
|
700
701
|
name = "redox_syscall"
|
|
701
|
-
version = "0.5
|
|
702
|
+
version = "0.9.5"
|
|
702
703
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
703
|
-
checksum = "
|
|
704
|
+
checksum = "580c875845b41ecb1564ad1ae4703044cef774145e3d7a94dc2b3fa7c97868fd"
|
|
704
705
|
dependencies = [
|
|
705
|
-
"bitflags 2.13.
|
|
706
|
+
"bitflags 2.13.2",
|
|
706
707
|
]
|
|
707
708
|
|
|
708
709
|
[[package]]
|
|
@@ -756,9 +757,9 @@ checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d"
|
|
|
756
757
|
|
|
757
758
|
[[package]]
|
|
758
759
|
name = "rustls"
|
|
759
|
-
version = "0.23.
|
|
760
|
+
version = "0.23.46"
|
|
760
761
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
761
|
-
checksum = "
|
|
762
|
+
checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf"
|
|
762
763
|
dependencies = [
|
|
763
764
|
"log",
|
|
764
765
|
"once_cell",
|
|
@@ -789,9 +790,9 @@ dependencies = [
|
|
|
789
790
|
|
|
790
791
|
[[package]]
|
|
791
792
|
name = "rustls-webpki"
|
|
792
|
-
version = "0.103.
|
|
793
|
+
version = "0.103.16"
|
|
793
794
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
794
|
-
checksum = "
|
|
795
|
+
checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281"
|
|
795
796
|
dependencies = [
|
|
796
797
|
"ring",
|
|
797
798
|
"rustls-pki-types",
|
|
@@ -833,7 +834,7 @@ checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348"
|
|
|
833
834
|
dependencies = [
|
|
834
835
|
"proc-macro2",
|
|
835
836
|
"quote",
|
|
836
|
-
"syn 3.0.
|
|
837
|
+
"syn 3.0.9",
|
|
837
838
|
]
|
|
838
839
|
|
|
839
840
|
[[package]]
|
|
@@ -862,9 +863,9 @@ checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5"
|
|
|
862
863
|
|
|
863
864
|
[[package]]
|
|
864
865
|
name = "smallvec"
|
|
865
|
-
version = "1.
|
|
866
|
+
version = "1.16.4"
|
|
866
867
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
867
|
-
checksum = "
|
|
868
|
+
checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8"
|
|
868
869
|
|
|
869
870
|
[[package]]
|
|
870
871
|
name = "socket2"
|
|
@@ -882,7 +883,7 @@ version = "0.9.9"
|
|
|
882
883
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
883
884
|
checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e"
|
|
884
885
|
dependencies = [
|
|
885
|
-
"lock_api",
|
|
886
|
+
"lock_api 0.4.14",
|
|
886
887
|
]
|
|
887
888
|
|
|
888
889
|
[[package]]
|
|
@@ -904,9 +905,9 @@ dependencies = [
|
|
|
904
905
|
|
|
905
906
|
[[package]]
|
|
906
907
|
name = "syn"
|
|
907
|
-
version = "3.0.
|
|
908
|
+
version = "3.0.9"
|
|
908
909
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
909
|
-
checksum = "
|
|
910
|
+
checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b"
|
|
910
911
|
dependencies = [
|
|
911
912
|
"proc-macro2",
|
|
912
913
|
"quote",
|
|
@@ -915,29 +916,29 @@ dependencies = [
|
|
|
915
916
|
|
|
916
917
|
[[package]]
|
|
917
918
|
name = "thiserror"
|
|
918
|
-
version = "2.0.
|
|
919
|
+
version = "2.0.21"
|
|
919
920
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
920
|
-
checksum = "
|
|
921
|
+
checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e"
|
|
921
922
|
dependencies = [
|
|
922
923
|
"thiserror-impl",
|
|
923
924
|
]
|
|
924
925
|
|
|
925
926
|
[[package]]
|
|
926
927
|
name = "thiserror-impl"
|
|
927
|
-
version = "2.0.
|
|
928
|
+
version = "2.0.21"
|
|
928
929
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
929
|
-
checksum = "
|
|
930
|
+
checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524"
|
|
930
931
|
dependencies = [
|
|
931
932
|
"proc-macro2",
|
|
932
933
|
"quote",
|
|
933
|
-
"syn 3.0.
|
|
934
|
+
"syn 3.0.9",
|
|
934
935
|
]
|
|
935
936
|
|
|
936
937
|
[[package]]
|
|
937
938
|
name = "tokio"
|
|
938
|
-
version = "1.
|
|
939
|
+
version = "1.54.1"
|
|
939
940
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
940
|
-
checksum = "
|
|
941
|
+
checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3"
|
|
941
942
|
dependencies = [
|
|
942
943
|
"bytes",
|
|
943
944
|
"libc",
|
|
@@ -956,14 +957,14 @@ checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e"
|
|
|
956
957
|
dependencies = [
|
|
957
958
|
"proc-macro2",
|
|
958
959
|
"quote",
|
|
959
|
-
"syn 3.0.
|
|
960
|
+
"syn 3.0.9",
|
|
960
961
|
]
|
|
961
962
|
|
|
962
963
|
[[package]]
|
|
963
964
|
name = "tokio-rustls"
|
|
964
|
-
version = "0.26.
|
|
965
|
+
version = "0.26.6"
|
|
965
966
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
966
|
-
checksum = "
|
|
967
|
+
checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db"
|
|
967
968
|
dependencies = [
|
|
968
969
|
"rustls",
|
|
969
970
|
"tokio",
|
|
@@ -971,9 +972,9 @@ dependencies = [
|
|
|
971
972
|
|
|
972
973
|
[[package]]
|
|
973
974
|
name = "tokio-util"
|
|
974
|
-
version = "0.7.
|
|
975
|
+
version = "0.7.20"
|
|
975
976
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
976
|
-
checksum = "
|
|
977
|
+
checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b"
|
|
977
978
|
dependencies = [
|
|
978
979
|
"bytes",
|
|
979
980
|
"futures-core",
|
|
@@ -1010,9 +1011,9 @@ checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b"
|
|
|
1010
1011
|
|
|
1011
1012
|
[[package]]
|
|
1012
1013
|
name = "unicode-ident"
|
|
1013
|
-
version = "1.0.
|
|
1014
|
+
version = "1.0.27"
|
|
1014
1015
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1015
|
-
checksum = "
|
|
1016
|
+
checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563"
|
|
1016
1017
|
|
|
1017
1018
|
[[package]]
|
|
1018
1019
|
name = "untrusted"
|
|
@@ -1028,9 +1029,9 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a"
|
|
|
1028
1029
|
|
|
1029
1030
|
[[package]]
|
|
1030
1031
|
name = "want"
|
|
1031
|
-
version = "0.3.
|
|
1032
|
+
version = "0.3.2"
|
|
1032
1033
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1033
|
-
checksum = "
|
|
1034
|
+
checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b"
|
|
1034
1035
|
dependencies = [
|
|
1035
1036
|
"try-lock",
|
|
1036
1037
|
]
|
|
@@ -1052,9 +1053,9 @@ dependencies = [
|
|
|
1052
1053
|
|
|
1053
1054
|
[[package]]
|
|
1054
1055
|
name = "wasm-bindgen"
|
|
1055
|
-
version = "0.2.
|
|
1056
|
+
version = "0.2.129"
|
|
1056
1057
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1057
|
-
checksum = "
|
|
1058
|
+
checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409"
|
|
1058
1059
|
dependencies = [
|
|
1059
1060
|
"cfg-if",
|
|
1060
1061
|
"once_cell",
|
|
@@ -1065,9 +1066,9 @@ dependencies = [
|
|
|
1065
1066
|
|
|
1066
1067
|
[[package]]
|
|
1067
1068
|
name = "wasm-bindgen-macro"
|
|
1068
|
-
version = "0.2.
|
|
1069
|
+
version = "0.2.129"
|
|
1069
1070
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1070
|
-
checksum = "
|
|
1071
|
+
checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535"
|
|
1071
1072
|
dependencies = [
|
|
1072
1073
|
"quote",
|
|
1073
1074
|
"wasm-bindgen-macro-support",
|
|
@@ -1075,22 +1076,22 @@ dependencies = [
|
|
|
1075
1076
|
|
|
1076
1077
|
[[package]]
|
|
1077
1078
|
name = "wasm-bindgen-macro-support"
|
|
1078
|
-
version = "0.2.
|
|
1079
|
+
version = "0.2.129"
|
|
1079
1080
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1080
|
-
checksum = "
|
|
1081
|
+
checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7"
|
|
1081
1082
|
dependencies = [
|
|
1082
1083
|
"bumpalo",
|
|
1083
1084
|
"proc-macro2",
|
|
1084
1085
|
"quote",
|
|
1085
|
-
"syn
|
|
1086
|
+
"syn 3.0.9",
|
|
1086
1087
|
"wasm-bindgen-shared",
|
|
1087
1088
|
]
|
|
1088
1089
|
|
|
1089
1090
|
[[package]]
|
|
1090
1091
|
name = "wasm-bindgen-shared"
|
|
1091
|
-
version = "0.2.
|
|
1092
|
+
version = "0.2.129"
|
|
1092
1093
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1093
|
-
checksum = "
|
|
1094
|
+
checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6"
|
|
1094
1095
|
dependencies = [
|
|
1095
1096
|
"unicode-ident",
|
|
1096
1097
|
]
|
|
@@ -1191,18 +1192,18 @@ checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e"
|
|
|
1191
1192
|
|
|
1192
1193
|
[[package]]
|
|
1193
1194
|
name = "zerocopy"
|
|
1194
|
-
version = "0.8.
|
|
1195
|
+
version = "0.8.63"
|
|
1195
1196
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1196
|
-
checksum = "
|
|
1197
|
+
checksum = "e5fe1f8f1b06191a00962174c61aa5005e0bb391a6d80d07e24d115c01a92ed8"
|
|
1197
1198
|
dependencies = [
|
|
1198
1199
|
"zerocopy-derive",
|
|
1199
1200
|
]
|
|
1200
1201
|
|
|
1201
1202
|
[[package]]
|
|
1202
1203
|
name = "zerocopy-derive"
|
|
1203
|
-
version = "0.8.
|
|
1204
|
+
version = "0.8.63"
|
|
1204
1205
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1205
|
-
checksum = "
|
|
1206
|
+
checksum = "863ad3ac83293fb4d740aedbfdc9240dd8d1a50c1099acd76ce80ce7c7230c7f"
|
|
1206
1207
|
dependencies = [
|
|
1207
1208
|
"proc-macro2",
|
|
1208
1209
|
"quote",
|
|
@@ -1211,6 +1212,6 @@ dependencies = [
|
|
|
1211
1212
|
|
|
1212
1213
|
[[package]]
|
|
1213
1214
|
name = "zeroize"
|
|
1214
|
-
version = "1.9.
|
|
1215
|
+
version = "1.9.1"
|
|
1215
1216
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1216
|
-
checksum = "
|
|
1217
|
+
checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879"
|
data/ext/kino/Cargo.toml
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[package]
|
|
2
2
|
name = "kino"
|
|
3
|
-
version = "0.7.
|
|
3
|
+
version = "0.7.2"
|
|
4
4
|
edition = "2021"
|
|
5
5
|
authors = ["Yaroslav Markin <yaroslav@markin.net>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -12,13 +12,13 @@ crate-type = ["cdylib", "rlib"]
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
[dependencies]
|
|
15
|
-
magnus = { version = "0.
|
|
15
|
+
magnus = { version = "0.9.0", features = ["rb-sys"] }
|
|
16
16
|
rb-sys = { version = "0.9", features = ["stable-api-compiled-fallback"] }
|
|
17
17
|
flume = "0.12"
|
|
18
|
-
parking_lot = "0.
|
|
18
|
+
parking_lot = "0.13"
|
|
19
19
|
ahash = "0.8"
|
|
20
20
|
smallvec = "1"
|
|
21
|
-
lru = "0.
|
|
21
|
+
lru = "0.19"
|
|
22
22
|
mimalloc = { version = "0.1", default-features = false }
|
|
23
23
|
tokio = { version = "1.45", features = ["rt-multi-thread", "net", "time", "sync", "io-util", "macros"] }
|
|
24
24
|
hyper = { version = "1.6", features = ["http1", "http2", "server"] }
|
data/ext/kino/src/env_strings.rs
CHANGED
|
@@ -12,6 +12,10 @@
|
|
|
12
12
|
//! immortal. Built once, with the GVL held, on the main ractor; read-only
|
|
13
13
|
//! afterwards.
|
|
14
14
|
//!
|
|
15
|
+
//! Every cached string is flagged shareable as it is built, not just
|
|
16
|
+
//! frozen: under per-ractor GC (Ruby 4.1) that flag is what keeps a
|
|
17
|
+
//! string one ractor allocated alive in another ractor's env.
|
|
18
|
+
//!
|
|
15
19
|
//! The LRU caches (hosts, peer addresses, interned header values) are the
|
|
16
20
|
//! exception: they insert and evict from every worker ractor in parallel.
|
|
17
21
|
//! That rules out per-value GC registration, because in Ruby 4.0
|
|
@@ -32,7 +36,7 @@ use std::sync::{Arc, OnceLock};
|
|
|
32
36
|
|
|
33
37
|
use magnus::rb_sys::AsRawValue;
|
|
34
38
|
use magnus::value::Opaque;
|
|
35
|
-
use magnus::{
|
|
39
|
+
use magnus::{prelude::*, RString, Ruby, Value};
|
|
36
40
|
use parking_lot::{Mutex, RwLock};
|
|
37
41
|
|
|
38
42
|
use crate::pin::{PinKeeper, PinSlab};
|
|
@@ -296,16 +300,14 @@ pub fn cgi_name(lower: &str) -> String {
|
|
|
296
300
|
/// registration takes the VM lock, and nothing else must exist yet.
|
|
297
301
|
fn frozen(ruby: &Ruby, s: &str) -> Opaque<RString> {
|
|
298
302
|
let string = frozen_str(ruby, s);
|
|
299
|
-
|
|
303
|
+
ruby.gc_register_mark_object(string);
|
|
300
304
|
Opaque::from(string)
|
|
301
305
|
}
|
|
302
306
|
|
|
303
307
|
/// A fresh frozen string, rooted only by the caller's stack until a
|
|
304
308
|
/// cache slot or an env takes it.
|
|
305
309
|
fn frozen_str(ruby: &Ruby, s: &str) -> RString {
|
|
306
|
-
|
|
307
|
-
string.freeze();
|
|
308
|
-
string
|
|
310
|
+
shareable(ruby.str_new(s))
|
|
309
311
|
}
|
|
310
312
|
|
|
311
313
|
/// Header values are bytes on the wire (not guaranteed UTF-8), so they
|
|
@@ -313,8 +315,20 @@ fn frozen_str(ruby: &Ruby, s: &str) -> RString {
|
|
|
313
315
|
/// uncached path; interning must not change the encoding an app
|
|
314
316
|
/// observes.
|
|
315
317
|
fn frozen_slice(ruby: &Ruby, bytes: &[u8]) -> RString {
|
|
316
|
-
|
|
318
|
+
shareable(ruby.str_from_slice(bytes))
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
/// Freeze `string` and flag it shareable. Every cached string ends up
|
|
322
|
+
/// in envs on other ractors, and with per-ractor GC (Ruby 4.1) the flag
|
|
323
|
+
/// is what keeps it alive there: a ractor's local sweep never frees a
|
|
324
|
+
/// shareable object, while an unflagged one allocated on a worker
|
|
325
|
+
/// ractor is rooted only by the keeper on main, which that local GC
|
|
326
|
+
/// does not see. Called before any cache lock is taken (module docs).
|
|
327
|
+
fn shareable(string: RString) -> RString {
|
|
317
328
|
string.freeze();
|
|
329
|
+
// SAFETY: GVL held; a frozen string without ivars is shareable by
|
|
330
|
+
// definition, so this only sets the flag and cannot raise.
|
|
331
|
+
unsafe { rb_sys::rb_ractor_make_shareable(string.as_raw()) };
|
|
318
332
|
string
|
|
319
333
|
}
|
|
320
334
|
|
|
@@ -339,7 +353,7 @@ pub fn init(ruby: &Ruby) {
|
|
|
339
353
|
// The slab's GC-visible face lives for the process: registered here
|
|
340
354
|
// on the main ractor, before any worker ractor can exist.
|
|
341
355
|
let slab = Arc::new(PinSlab::with_capacity(CACHE_SLAB_CAPACITY));
|
|
342
|
-
|
|
356
|
+
ruby.gc_register_mark_object(ruby.obj_wrap(PinKeeper(slab.clone())));
|
|
343
357
|
|
|
344
358
|
let strings = EnvStrings {
|
|
345
359
|
request_method: frozen(ruby, "REQUEST_METHOD"),
|
|
@@ -400,8 +414,8 @@ pub fn register_defaults(
|
|
|
400
414
|
));
|
|
401
415
|
}
|
|
402
416
|
}
|
|
403
|
-
|
|
404
|
-
|
|
417
|
+
ruby.gc_register_mark_object(errors);
|
|
418
|
+
ruby.gc_register_mark_object(null_input);
|
|
405
419
|
let s = get();
|
|
406
420
|
*s.errors_stream.write() = Some(Opaque::from(errors));
|
|
407
421
|
*s.null_input.write() = Some(Opaque::from(null_input));
|
data/ext/kino/src/pin.rs
CHANGED
|
@@ -26,6 +26,18 @@
|
|
|
26
26
|
//! The slab is also how env_strings.rs roots its cached env strings (a
|
|
27
27
|
//! second slab, marked through its own keeper), for the same reason: no
|
|
28
28
|
//! GC registration API may be called from parallel ractors.
|
|
29
|
+
//!
|
|
30
|
+
//! Per-ractor GC (Ruby 4.1): each ractor collects its own heap, and a
|
|
31
|
+
//! local collection marks only that ractor's roots. A keeper on the main
|
|
32
|
+
//! ractor is invisible to a worker ractor's local GC, so a string the
|
|
33
|
+
//! worker allocated and rooted only here would be swept while hyper
|
|
34
|
+
//! still reads its bytes. Shareable objects are exempt: only a global
|
|
35
|
+
//! GC, which marks every root including the keeper, may free them. A
|
|
36
|
+
//! slab serving worker ractors on such a Ruby therefore pins only
|
|
37
|
+
//! strings already flagged shareable (typically an app's frozen
|
|
38
|
+
//! constants) and copies the rest; making each per-request body
|
|
39
|
+
//! shareable instead would push it into the population only a
|
|
40
|
+
//! stop-the-world collection reclaims.
|
|
29
41
|
|
|
30
42
|
use std::sync::atomic::{AtomicU64, AtomicUsize, Ordering};
|
|
31
43
|
use std::sync::Arc;
|
|
@@ -47,6 +59,10 @@ pub const ZERO_COPY_MIN: usize = 4096;
|
|
|
47
59
|
/// throughput heuristic, not a limit on concurrency.
|
|
48
60
|
const SLAB_CAPACITY: usize = 4096;
|
|
49
61
|
|
|
62
|
+
/// Whether this Ruby collects each ractor's heap separately (see the
|
|
63
|
+
/// module docs). Ruby 4.0 has one heap for every ractor.
|
|
64
|
+
const PER_RACTOR_GC: bool = cfg!(ruby_gte_4_1);
|
|
65
|
+
|
|
50
66
|
extern "C" {
|
|
51
67
|
// Exported by libruby but absent from the public headers: io.c's
|
|
52
68
|
// buffer-stabilizing primitive (see module docs). Signature per
|
|
@@ -61,18 +77,28 @@ pub struct PinSlab {
|
|
|
61
77
|
slots: Box<[AtomicU64]>,
|
|
62
78
|
/// Rotating claim cursor: keeps the free-slot scan O(1) amortized.
|
|
63
79
|
cursor: AtomicUsize,
|
|
80
|
+
/// Pin only strings flagged shareable (pinned_bytes): set for a
|
|
81
|
+
/// slab that worker ractors fill on a per-ractor-GC Ruby.
|
|
82
|
+
shareable_only: bool,
|
|
64
83
|
}
|
|
65
84
|
|
|
66
85
|
impl PinSlab {
|
|
67
|
-
/// A slab for one server's in-flight response buffers
|
|
68
|
-
|
|
69
|
-
|
|
86
|
+
/// A slab for one server's in-flight response buffers, filled by
|
|
87
|
+
/// worker ractors when `ractor_mode` (else by main-ractor threads).
|
|
88
|
+
pub fn for_responses(ractor_mode: bool) -> Self {
|
|
89
|
+
PinSlab {
|
|
90
|
+
shareable_only: ractor_mode && PER_RACTOR_GC,
|
|
91
|
+
..Self::with_capacity(SLAB_CAPACITY)
|
|
92
|
+
}
|
|
70
93
|
}
|
|
71
94
|
|
|
95
|
+
/// A slab for callers that root only shareable values themselves
|
|
96
|
+
/// (env_strings), or for tests.
|
|
72
97
|
pub fn with_capacity(capacity: usize) -> Self {
|
|
73
98
|
PinSlab {
|
|
74
99
|
slots: (0..capacity).map(|_| AtomicU64::new(0)).collect(),
|
|
75
100
|
cursor: AtomicUsize::new(0),
|
|
101
|
+
shareable_only: false,
|
|
76
102
|
}
|
|
77
103
|
}
|
|
78
104
|
|
|
@@ -169,9 +195,10 @@ impl Drop for PinnedBuf {
|
|
|
169
195
|
}
|
|
170
196
|
|
|
171
197
|
/// Bytes borrowing `body`'s buffer, with the string rooted until hyper
|
|
172
|
-
/// drops it; None when the body is below ZERO_COPY_MIN
|
|
173
|
-
/// full
|
|
174
|
-
///
|
|
198
|
+
/// drops it; None when the body is below ZERO_COPY_MIN, the slab is
|
|
199
|
+
/// full, or the slab takes only shareable strings and this one is not
|
|
200
|
+
/// (caller copies). Requires the calling worker's GVL; safe from any
|
|
201
|
+
/// ractor.
|
|
175
202
|
pub fn pinned_bytes(slab: &Arc<PinSlab>, body: RString) -> Option<Bytes> {
|
|
176
203
|
if body.len() < ZERO_COPY_MIN {
|
|
177
204
|
return None;
|
|
@@ -180,6 +207,9 @@ pub fn pinned_bytes(slab: &Arc<PinSlab>, body: RString) -> Option<Bytes> {
|
|
|
180
207
|
// by the caller. The acquired tmp is rooted by this thread's machine
|
|
181
208
|
// stack (conservatively scanned) until the slab insert publishes it.
|
|
182
209
|
let tmp = unsafe { rb_str_tmp_frozen_acquire(body.as_raw()) };
|
|
210
|
+
if slab.shareable_only && !flagged_shareable(tmp) {
|
|
211
|
+
return None;
|
|
212
|
+
}
|
|
183
213
|
let index = slab.insert(tmp)?;
|
|
184
214
|
// SAFETY: tmp is frozen, alive, and slab-rooted; len >= ZERO_COPY_MIN
|
|
185
215
|
// rules out an embedded buffer, so ptr is a stable heap allocation.
|
|
@@ -197,13 +227,22 @@ pub fn pinned_bytes(slab: &Arc<PinSlab>, body: RString) -> Option<Bytes> {
|
|
|
197
227
|
}))
|
|
198
228
|
}
|
|
199
229
|
|
|
230
|
+
/// Whether `value` (a heap object) carries the shareable flag. A plain
|
|
231
|
+
/// flag read: a frozen string that no one has checked yet may be
|
|
232
|
+
/// shareable in principle but unflagged, and the GC goes by the flag.
|
|
233
|
+
fn flagged_shareable(value: rb_sys::VALUE) -> bool {
|
|
234
|
+
let shareable = rb_sys::ruby_fl_type::RUBY_FL_SHAREABLE as rb_sys::VALUE;
|
|
235
|
+
// SAFETY: value is a live heap object (an RString) under the GVL.
|
|
236
|
+
unsafe { (*(value as *const rb_sys::RBasic)).flags & shareable != 0 }
|
|
237
|
+
}
|
|
238
|
+
|
|
200
239
|
#[cfg(test)]
|
|
201
240
|
mod tests {
|
|
202
241
|
use super::*;
|
|
203
242
|
|
|
204
243
|
#[test]
|
|
205
244
|
fn insert_release_reuse_cycle() {
|
|
206
|
-
let slab = PinSlab::
|
|
245
|
+
let slab = PinSlab::with_capacity(SLAB_CAPACITY);
|
|
207
246
|
let a = slab.insert(0x1000).expect("slot free");
|
|
208
247
|
let b = slab.insert(0x2000).expect("slot free");
|
|
209
248
|
assert_ne!(a, b);
|
|
@@ -222,7 +261,7 @@ mod tests {
|
|
|
222
261
|
|
|
223
262
|
#[test]
|
|
224
263
|
fn full_slab_refuses_instead_of_evicting() {
|
|
225
|
-
let slab = PinSlab::
|
|
264
|
+
let slab = PinSlab::with_capacity(SLAB_CAPACITY);
|
|
226
265
|
let indexes: Vec<usize> = (0..SLAB_CAPACITY)
|
|
227
266
|
.map(|i| slab.insert(0x1000 + i as rb_sys::VALUE).expect("capacity"))
|
|
228
267
|
.collect();
|
data/ext/kino/src/registry.rs
CHANGED
|
@@ -409,7 +409,7 @@ pub fn test_server(lanes: bool, queue_depth: usize) -> Arc<ServerInner> {
|
|
|
409
409
|
access_log: None,
|
|
410
410
|
lanes,
|
|
411
411
|
lane_cursor: AtomicUsize::new(0),
|
|
412
|
-
pin_slab: Arc::new(crate::pin::PinSlab::
|
|
412
|
+
pin_slab: Arc::new(crate::pin::PinSlab::for_responses(false)),
|
|
413
413
|
queue_histogram: QueueHistogram::new(),
|
|
414
414
|
})
|
|
415
415
|
}
|
data/ext/kino/src/request.rs
CHANGED
|
@@ -518,7 +518,7 @@ pub fn test_ctx() -> crate::registry::BoxedCtx {
|
|
|
518
518
|
body_rx: None,
|
|
519
519
|
leftover: None,
|
|
520
520
|
slot: None,
|
|
521
|
-
pin_slab: Arc::new(crate::pin::PinSlab::
|
|
521
|
+
pin_slab: Arc::new(crate::pin::PinSlab::for_responses(false)),
|
|
522
522
|
responder: Arc::new(Responder::new(head_tx)),
|
|
523
523
|
enqueued_at: std::time::Instant::now(),
|
|
524
524
|
timed: false,
|
data/ext/kino/src/server.rs
CHANGED
|
@@ -117,6 +117,7 @@ pub fn server_start(ruby: &Ruby, config: magnus::RHash) -> Result<(u64, u16, Opt
|
|
|
117
117
|
let (req_tx, req_rx) = flume::bounded(queue_depth);
|
|
118
118
|
let (shutdown_tx, shutdown_rx) = tokio::sync::watch::channel(false);
|
|
119
119
|
|
|
120
|
+
let pin_slab = Arc::new(crate::pin::PinSlab::for_responses(mode == "ractor"));
|
|
120
121
|
let server = Arc::new(ServerInner {
|
|
121
122
|
id: registry::next_server_id(),
|
|
122
123
|
req_tx: Mutex::new(Some(req_tx)),
|
|
@@ -150,7 +151,7 @@ pub fn server_start(ruby: &Ruby, config: magnus::RHash) -> Result<(u64, u16, Opt
|
|
|
150
151
|
access_log: log_requests.then(|| crate::logsink::Sink::new(std::io::stdout())),
|
|
151
152
|
lanes,
|
|
152
153
|
lane_cursor: std::sync::atomic::AtomicUsize::new(0),
|
|
153
|
-
pin_slab
|
|
154
|
+
pin_slab,
|
|
154
155
|
queue_histogram: registry::QueueHistogram::new(),
|
|
155
156
|
});
|
|
156
157
|
|
data/lib/kino/version.rb
CHANGED
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: kino
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.7.
|
|
4
|
+
version: 0.7.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Yaroslav Markin
|
|
@@ -258,7 +258,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
258
258
|
- !ruby/object:Gem::Version
|
|
259
259
|
version: '0'
|
|
260
260
|
requirements: []
|
|
261
|
-
rubygems_version: 4.0.
|
|
261
|
+
rubygems_version: 4.0.20
|
|
262
262
|
specification_version: 4
|
|
263
263
|
summary: High-performance Ractor web server for Ruby.
|
|
264
264
|
test_files: []
|