Skip to content

Commit bc59ae4

Browse files
committed
Merge remote-tracking branch 'gh/master' into zjit-locals-in-stackmap
2 parents 3249a69 + f4813a3 commit bc59ae4

133 files changed

Lines changed: 3299 additions & 1256 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.git-blame-ignore-revs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ d1474affa8e105bece209cc9d594bb0a989859e1
1515
# Indentation
1616
0e4bad888e605d424b9222ae0ca43f85c1634e5e
1717
61aa46c41648c6d1e9b0daa1a292de551fde78df
18+
f1c708d02e99c036e48ff56c0e4410592bcc7265
1819

1920
# Enable Style/StringLiterals cop for RubyGems/Bundler
2021
d7ffd3fea402239b16833cc434404a7af82d44f3
@@ -45,6 +46,8 @@ e90282be7ba1bc8e3119f6e1a2c80356ceb3f80a
4546
2f53985da9ee593fe524d408256835667938c7d7
4647
bf01f6ae89a95d8f5572e050facfe311c8c28aaf
4748
7480cd8d37fd71a41ce12b759090051c7e14fb5a
49+
c0a526dd97b22f462f49a2a0062420523303769d
50+
9ee713a92c2fe8bf5aac4c2f5b0c4c7e6b475b47
4851

4952
# Win32: EOL code of batch files
5053
23f9a0d655c4d405bb2397a147a1523436205486

.github/workflows/zjit-macos.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ jobs:
9898
rustup install ${{ matrix.rust_version }} --profile minimal
9999
rustup default ${{ matrix.rust_version }}
100100
101-
- uses: taiki-e/install-action@ba47c86ac325773530516bb756137ac718732518 # v2.86.5
101+
- uses: taiki-e/install-action@b6ff580856c41316412a0b9b60540fbc6f8c82cc # v2.86.7
102102
with:
103103
tool: nextest@0.9
104104
if: ${{ matrix.test_task == 'zjit-check' }}

.github/workflows/zjit-ubuntu.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ jobs:
152152
ruby-version: '3.1'
153153
bundler: none
154154

155-
- uses: taiki-e/install-action@ba47c86ac325773530516bb756137ac718732518 # v2.86.5
155+
- uses: taiki-e/install-action@b6ff580856c41316412a0b9b60540fbc6f8c82cc # v2.86.7
156156
with:
157157
tool: nextest@0.9
158158
if: ${{ matrix.test_task == 'zjit-check' }}

NEWS.md

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ Note: We're only listing outstanding class updates.
3939
given names, raising `KeyError` for missing names unless a block is
4040
given. [[Feature #21781]]
4141

42+
* Fiber::Scheduler
43+
44+
* The `fiber_interrupt` hook is now required. Schedulers which do not
45+
implement it can no longer be installed with `Fiber.set_scheduler`.
46+
4247
* Hash
4348

4449
* `Hash.ruby2_keywords_hash?` and `Hash.ruby2_keywords_hash` are
@@ -171,7 +176,7 @@ They are still available on rubygems.org and can be installed with
171176
### The following default gems are updated.
172177

173178
* RubyGems 4.1.0.dev
174-
* 4.0.3 to [v4.0.4][RubyGems-v4.0.4], [v4.0.5][RubyGems-v4.0.5], [v4.0.6][RubyGems-v4.0.6], [v4.0.7][RubyGems-v4.0.7], [v4.0.8][RubyGems-v4.0.8], [v4.0.9][RubyGems-v4.0.9], [v4.0.10][RubyGems-v4.0.10], [v4.0.11][RubyGems-v4.0.11], [v4.0.12][RubyGems-v4.0.12], [v4.0.13][RubyGems-v4.0.13], [v4.0.14][RubyGems-v4.0.14], [v4.0.15][RubyGems-v4.0.15], [v4.0.16][RubyGems-v4.0.16], [v4.0.17][RubyGems-v4.0.17], [v4.0.18][RubyGems-v4.0.18]
179+
* 4.0.3 to [v4.0.4][RubyGems-v4.0.4], [v4.0.5][RubyGems-v4.0.5], [v4.0.6][RubyGems-v4.0.6], [v4.0.7][RubyGems-v4.0.7], [v4.0.8][RubyGems-v4.0.8], [v4.0.9][RubyGems-v4.0.9], [v4.0.10][RubyGems-v4.0.10], [v4.0.11][RubyGems-v4.0.11], [v4.0.12][RubyGems-v4.0.12], [v4.0.13][RubyGems-v4.0.13], [v4.0.14][RubyGems-v4.0.14], [v4.0.15][RubyGems-v4.0.15], [v4.0.16][RubyGems-v4.0.16], [v4.0.17][RubyGems-v4.0.17], [v4.0.18][RubyGems-v4.0.18], [v4.0.19][RubyGems-v4.0.19]
175180
* bundler 4.1.0.dev
176181
* 4.0.3 to [v4.0.4][bundler-v4.0.4], [v4.0.5][bundler-v4.0.5], [v4.0.6][bundler-v4.0.6], [v4.0.7][bundler-v4.0.7], [v4.0.8][bundler-v4.0.8], [v4.0.9][bundler-v4.0.9], [v4.0.10][bundler-v4.0.10], [v4.0.11][bundler-v4.0.11], [v4.0.12][bundler-v4.0.12], [v4.0.13][bundler-v4.0.13], [v4.0.14][bundler-v4.0.14], [v4.0.15][bundler-v4.0.15], [v4.0.16][bundler-v4.0.16], [v4.0.17][bundler-v4.0.17]
177182
* erb 6.0.7
@@ -183,14 +188,16 @@ They are still available on rubygems.org and can be installed with
183188
* 1.2.8 to [v1.2.9][ipaddr-v1.2.9]
184189
* json 3.0.0.rc1
185190
* 2.18.0 to [v2.18.1][json-v2.18.1], [v2.19.0][json-v2.19.0], [v2.19.1][json-v2.19.1], [v2.19.2][json-v2.19.2], [v2.19.3][json-v2.19.3], [v2.19.4][json-v2.19.4], [v2.19.5][json-v2.19.5], [v2.19.6][json-v2.19.6], [v2.19.7][json-v2.19.7], [v2.19.8][json-v2.19.8], [v2.19.9][json-v2.19.9], [v2.20.0][json-v2.20.0], [v2.21.0][json-v2.21.0], [v2.21.2][json-v2.21.2], [v3.0.0.rc1][json-v3.0.0.rc1]
191+
* net-protocol 0.3.0
192+
* 0.2.2 to [v0.3.0][net-protocol-v0.3.0]
186193
* openssl 4.0.2
187194
* 4.0.0 to [v4.0.1][openssl-v4.0.1], [v4.0.2][openssl-v4.0.2]
188195
* pp 0.6.4
189196
* 0.6.3 to [v0.6.4][pp-v0.6.4]
190197
* prism 1.9.0
191198
* 1.7.0 to [v1.8.0][prism-v1.8.0], [v1.8.1][prism-v1.8.1], [v1.9.0][prism-v1.9.0]
192199
* psych 5.5.0
193-
* 5.3.1 to [v5.4.0][psych-v5.4.0]
200+
* 5.3.1 to [v5.4.0][psych-v5.4.0], [v5.5.0][psych-v5.5.0]
194201
* resolv 0.7.1
195202
* 0.7.0 to [v0.7.1][resolv-v0.7.1]
196203
* stringio 3.2.1.dev
@@ -205,6 +212,8 @@ They are still available on rubygems.org and can be installed with
205212
### The following bundled gems are updated.
206213

207214
* minitest 6.0.6
215+
* power_assert 3.1.0
216+
* 3.0.1 to [v3.1.0][power_assert-v3.1.0]
208217
* rake 13.4.2
209218
* 13.3.1 to [v13.4.0][rake-v13.4.0], [v13.4.1][rake-v13.4.1], [v13.4.2][rake-v13.4.2]
210219
* test-unit 3.7.8
@@ -213,7 +222,7 @@ They are still available on rubygems.org and can be installed with
213222
* 0.3.2 to [0.3.3][rss-0.3.3]
214223
* net-imap 0.6.6
215224
* 0.6.2 to [v0.6.3][net-imap-v0.6.3], [v0.6.4][net-imap-v0.6.4], [v0.6.4.1][net-imap-v0.6.4.1], [v0.6.5][net-imap-v0.6.5], [v0.6.6][net-imap-v0.6.6]
216-
* rbs 4.0.3
225+
* rbs 4.2.0
217226
* 3.10.0 to [v3.10.1][rbs-v3.10.1], [v3.10.2][rbs-v3.10.2], [v3.10.3][rbs-v3.10.3], [v3.10.4][rbs-v3.10.4], [v4.0.0.dev.1][rbs-v4.0.0.dev.1], [v4.0.0.dev.2][rbs-v4.0.0.dev.2], [v4.0.0.dev.3][rbs-v4.0.0.dev.3], [v4.0.0.dev.4][rbs-v4.0.0.dev.4], [v4.0.0.dev.5][rbs-v4.0.0.dev.5], [v4.0.0][rbs-v4.0.0], [v4.0.1.dev.1][rbs-v4.0.1.dev.1], [v4.0.1.dev.2][rbs-v4.0.1.dev.2], [v4.0.1][rbs-v4.0.1], [v4.0.2][rbs-v4.0.2], [v4.0.3][rbs-v4.0.3]
218227
* typeprof 0.32.0
219228
* mutex_m 0.3.0
@@ -384,6 +393,7 @@ A lot of work has gone into making Ractors more stable, performant, and usable.
384393
[RubyGems-v4.0.16]: https://github.com/rubygems/rubygems/releases/tag/v4.0.16
385394
[RubyGems-v4.0.17]: https://github.com/rubygems/rubygems/releases/tag/v4.0.17
386395
[RubyGems-v4.0.18]: https://github.com/rubygems/rubygems/releases/tag/v4.0.18
396+
[RubyGems-v4.0.19]: https://github.com/rubygems/rubygems/releases/tag/v4.0.19
387397
[bundler-v4.0.4]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.4
388398
[bundler-v4.0.5]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.5
389399
[bundler-v4.0.6]: https://github.com/rubygems/rubygems/releases/tag/bundler-v4.0.6
@@ -424,18 +434,21 @@ A lot of work has gone into making Ractors more stable, performant, and usable.
424434
[json-v2.21.0]: https://github.com/ruby/json/releases/tag/v2.21.0
425435
[json-v2.21.2]: https://github.com/ruby/json/releases/tag/v2.21.2
426436
[json-v3.0.0.rc1]: https://github.com/ruby/json/releases/tag/v3.0.0.rc1
437+
[net-protocol-v0.3.0]: https://github.com/ruby/net-protocol/releases/tag/v0.3.0
427438
[openssl-v4.0.1]: https://github.com/ruby/openssl/releases/tag/v4.0.1
428439
[openssl-v4.0.2]: https://github.com/ruby/openssl/releases/tag/v4.0.2
429440
[pp-v0.6.4]: https://github.com/ruby/pp/releases/tag/v0.6.4
430441
[prism-v1.8.0]: https://github.com/ruby/prism/releases/tag/v1.8.0
431442
[prism-v1.8.1]: https://github.com/ruby/prism/releases/tag/v1.8.1
432443
[prism-v1.9.0]: https://github.com/ruby/prism/releases/tag/v1.9.0
433444
[psych-v5.4.0]: https://github.com/ruby/psych/releases/tag/v5.4.0
445+
[psych-v5.5.0]: https://github.com/ruby/psych/releases/tag/v5.5.0
434446
[resolv-v0.7.1]: https://github.com/ruby/resolv/releases/tag/v0.7.1
435447
[strscan-v3.1.7]: https://github.com/ruby/strscan/releases/tag/v3.1.7
436448
[strscan-v3.1.8]: https://github.com/ruby/strscan/releases/tag/v3.1.8
437449
[timeout-v0.6.1]: https://github.com/ruby/timeout/releases/tag/v0.6.1
438450
[zlib-v3.2.3]: https://github.com/ruby/zlib/releases/tag/v3.2.3
451+
[power_assert-v3.1.0]: https://github.com/ruby/power_assert/releases/tag/v3.1.0
439452
[rake-v13.4.0]: https://github.com/ruby/rake/releases/tag/v13.4.0
440453
[rake-v13.4.1]: https://github.com/ruby/rake/releases/tag/v13.4.1
441454
[rake-v13.4.2]: https://github.com/ruby/rake/releases/tag/v13.4.2

box.c

Lines changed: 36 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ bool ruby_box_crashed = false; // extern, changed only in vm.c
6565

6666
VALUE rb_resolve_feature_path(VALUE klass, VALUE fname);
6767
static VALUE rb_box_inspect(VALUE obj);
68-
static void cleanup_all_local_extensions(VALUE libmap);
6968

7069
void
7170
rb_box_set_gem_flags(rb_box_gem_flags_t *flags)
@@ -303,8 +302,6 @@ box_entry_free(void *ptr)
303302
st_foreach(box->classext_cow_classes, free_classext_for_box, (st_data_t)box);
304303
}
305304

306-
cleanup_all_local_extensions(box->ruby_dln_libmap);
307-
308305
free_box_st_tables(ptr);
309306
SIZED_FREE(box);
310307
}
@@ -808,24 +805,48 @@ rb_box_cleanup_local_extension(VALUE cleanup)
808805
(void)p;
809806
}
810807

811-
static int
812-
cleanup_local_extension_i(VALUE key, VALUE value, VALUE arg)
813-
{
814808
#if defined(_WIN32)
815-
HMODULE h = (HMODULE)NUM2PTR(value);
816-
WCHAR module_path[MAXPATHLEN];
817-
DWORD len = GetModuleFileNameW(h, module_path, numberof(module_path));
809+
struct box_local_ext_list {
810+
struct box_local_ext_list *next;
811+
HMODULE handle;
812+
};
813+
static struct box_local_ext_list *box_local_exts;
814+
#endif
818815

819-
FreeLibrary(h);
820-
if (len > 0 && len < numberof(module_path)) DeleteFileW(module_path);
816+
void
817+
rb_box_defer_unload_local_extension(void *handle)
818+
{
819+
#if defined(_WIN32)
820+
/* A box-local copy of an extension DLL must stay loaded as long as
821+
* objects created by it can be finalized; unloading is deferred to
822+
* rb_box_unload_local_extensions after the objspace is destructed.
823+
* The loaded copy cannot be deleted on Windows, so the file is also
824+
* removed there instead of in box_ext_cleanup_free. */
825+
struct box_local_ext_list *ext = malloc(sizeof(struct box_local_ext_list));
826+
if (!ext) return;
827+
ext->handle = (HMODULE)handle;
828+
ext->next = box_local_exts;
829+
box_local_exts = ext;
821830
#endif
822-
return ST_DELETE;
823831
}
824832

825-
static void
826-
cleanup_all_local_extensions(VALUE libmap)
833+
void
834+
rb_box_unload_local_extensions(void)
827835
{
828-
rb_hash_foreach(libmap, cleanup_local_extension_i, 0);
836+
#if defined(_WIN32)
837+
struct box_local_ext_list *ext = box_local_exts;
838+
box_local_exts = NULL;
839+
while (ext) {
840+
struct box_local_ext_list *next = ext->next;
841+
WCHAR module_path[MAXPATHLEN];
842+
DWORD len = GetModuleFileNameW(ext->handle, module_path, numberof(module_path));
843+
844+
FreeLibrary(ext->handle);
845+
if (len > 0 && len < numberof(module_path)) DeleteFileW(module_path);
846+
free(ext);
847+
ext = next;
848+
}
849+
#endif
829850
}
830851

831852
VALUE

compile.c

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,29 @@ static void iseq_add_setlocal(rb_iseq_t *iseq, LINK_ANCHOR *const seq, const NOD
358358
#define IS_INSN_ID(iobj, insn) (INSN_OF(iobj) == BIN(insn))
359359
#define IS_NEXT_INSN_ID(link, insn) \
360360
((link)->next && IS_INSN((link)->next) && IS_INSN_ID((link)->next, insn))
361+
#define IS_NEXT_NEXT_INSN_ID(link, insn) \
362+
((link)->next && IS_NEXT_INSN_ID((link)->next, insn))
363+
364+
static inline bool
365+
IS_INDEPENDENT_INSN(LINK_ELEMENT *link)
366+
{
367+
if (!IS_INSN(link)) {
368+
return false;
369+
}
370+
371+
enum ruby_vminsn_type type = INSN_OF(link);
372+
373+
return (
374+
type == BIN(putobject) ||
375+
type == BIN(putspecialobject) ||
376+
type == BIN(putnil) ||
377+
type == BIN(putself) ||
378+
type == BIN(duphash) ||
379+
type == BIN(getinstancevariable) ||
380+
type == BIN(getlocal) ||
381+
type == BIN(opt_getconstant_path)
382+
);
383+
}
361384

362385
/* error */
363386
#if CPDEBUG > 0
@@ -1225,6 +1248,25 @@ ELEM_REMOVE(LINK_ELEMENT *elem)
12251248
}
12261249
}
12271250

1251+
/*
1252+
* elem1, elem2 => elem2, elem1
1253+
*/
1254+
static void
1255+
ELEM_SWAP(LINK_ELEMENT *first, LINK_ELEMENT *second)
1256+
{
1257+
RUBY_ASSERT(first->next == second);
1258+
RUBY_ASSERT(first == second->prev);
1259+
1260+
first->prev->next = second;
1261+
second->next->prev = first;
1262+
1263+
first->next = second->next;
1264+
second->next = first;
1265+
1266+
second->prev = first->prev;
1267+
first->prev = second;
1268+
}
1269+
12281270
static LINK_ELEMENT *
12291271
FIRST_ELEMENT(const LINK_ANCHOR *const anchor)
12301272
{
@@ -4253,6 +4295,24 @@ iseq_peephole_optimize(rb_iseq_t *iseq, LINK_ELEMENT *list, const int do_tailcal
42534295
}
42544296
}
42554297

4298+
/*
4299+
* putself / (or any other independent instruction)
4300+
* putnil / (or any other independent instruction)
4301+
* swap
4302+
* =>
4303+
* putnil / (or any other independent instruction)
4304+
* putself / (or any other independent instruction)
4305+
*/
4306+
if (IS_NEXT_NEXT_INSN_ID(&iobj->link, swap)) {
4307+
LINK_ELEMENT *first = &iobj->link;
4308+
LINK_ELEMENT *second = first->next;
4309+
LINK_ELEMENT *swap = second->next;
4310+
if (IS_INDEPENDENT_INSN(first) && IS_INDEPENDENT_INSN(second)) {
4311+
ELEM_REMOVE(swap);
4312+
ELEM_SWAP(first, second);
4313+
}
4314+
}
4315+
42564316
return COMPILE_OK;
42574317
}
42584318

doc/language/fiber.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ non-blocking*, the operation will invoke the scheduler.
234234

235235
Closing an IO interrupts all blocking operations on that IO. When a thread calls `IO#close`, it first attempts to interrupt any threads or fibers that are blocked on that IO. The closing thread waits until all blocked threads and fibers have been properly interrupted and removed from the IO's blocking list. Each interrupted thread or fiber receives an `IOError` and is cleanly removed from the blocking operation. Only after all blocking operations have been interrupted and cleaned up will the actual file descriptor be closed, ensuring proper resource cleanup and preventing potential race conditions.
236236

237-
For fibers managed by a scheduler, the interruption process involves calling `rb_fiber_scheduler_fiber_interrupt` on the scheduler. This allows the scheduler to handle the interruption in a way that's appropriate for its event loop implementation. The scheduler can then notify the fiber, which will receive an `IOError` and be removed from the blocking operation. This mechanism ensures that fiber-based concurrency works correctly with IO operations, even when those operations are interrupted by `IO#close`.
237+
For fibers managed by a scheduler, the interruption process involves calling `rb_fiber_scheduler_fiber_interrupt` on the scheduler. The corresponding `Fiber::Scheduler#fiber_interrupt` hook is required. This allows the scheduler to handle the interruption in a way that's appropriate for its event loop implementation. The scheduler can then notify the fiber, which will receive an `IOError` and be removed from the blocking operation. This mechanism ensures that fiber-based concurrency works correctly with IO operations, even when those operations are interrupted by `IO#close`.
238238

239239
```mermaid
240240
sequenceDiagram

ext/openssl/lib/openssl/bn.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ def pretty_print(q)
2323
q.text to_i.to_s
2424
}
2525
end
26+
27+
def marshal_dump # :nodoc:
28+
to_i
29+
end
30+
31+
def marshal_load(integer) # :nodoc:
32+
initialize(integer)
33+
end
2634
end # BN
2735
end # OpenSSL
2836

ext/openssl/ossl_ssl.c

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -579,12 +579,21 @@ ssl_npn_select_cb_common(SSL *ssl, VALUE cb, const unsigned char **out,
579579
return SSL_TLSEXT_ERR_OK;
580580
}
581581

582+
static VALUE
583+
ossl_sslctx_obj_from_ssl(const SSL *ssl)
584+
{
585+
SSL_CTX *ctx = SSL_get_SSL_CTX(ssl);
586+
587+
return (VALUE)SSL_CTX_get_ex_data(ctx, ossl_sslctx_ex_ptr_idx);
588+
}
589+
582590
#ifdef OSSL_USE_NEXTPROTONEG
583591
static int
584592
ssl_npn_advertise_cb(SSL *ssl, const unsigned char **out, unsigned int *outlen,
585593
void *arg)
586594
{
587-
VALUE protocols = rb_attr_get((VALUE)arg, id_npn_protocols_encoded);
595+
VALUE protocols = rb_attr_get(ossl_sslctx_obj_from_ssl(ssl),
596+
id_npn_protocols_encoded);
588597

589598
*out = (const unsigned char *) RSTRING_PTR(protocols);
590599
*outlen = RSTRING_LENINT(protocols);
@@ -598,7 +607,7 @@ ssl_npn_select_cb(SSL *ssl, unsigned char **out, unsigned char *outlen,
598607
{
599608
VALUE sslctx_obj, cb;
600609

601-
sslctx_obj = (VALUE) arg;
610+
sslctx_obj = ossl_sslctx_obj_from_ssl(ssl);
602611
cb = rb_attr_get(sslctx_obj, id_i_npn_select_cb);
603612

604613
return ssl_npn_select_cb_common(ssl, cb, (const unsigned char **)out,
@@ -612,7 +621,7 @@ ssl_alpn_select_cb(SSL *ssl, const unsigned char **out, unsigned char *outlen,
612621
{
613622
VALUE sslctx_obj, cb;
614623

615-
sslctx_obj = (VALUE) arg;
624+
sslctx_obj = ossl_sslctx_obj_from_ssl(ssl);
616625
cb = rb_attr_get(sslctx_obj, id_i_alpn_select_cb);
617626

618627
return ssl_npn_select_cb_common(ssl, cb, out, outlen, in, inlen);
@@ -807,11 +816,11 @@ ossl_sslctx_setup(VALUE self)
807816
if (!NIL_P(val)) {
808817
VALUE encoded = ssl_encode_npn_protocols(val);
809818
rb_ivar_set(self, id_npn_protocols_encoded, encoded);
810-
SSL_CTX_set_next_protos_advertised_cb(ctx, ssl_npn_advertise_cb, (void *)self);
819+
SSL_CTX_set_next_protos_advertised_cb(ctx, ssl_npn_advertise_cb, NULL);
811820
OSSL_Debug("SSL NPN advertise callback added");
812821
}
813822
if (RTEST(rb_attr_get(self, id_i_npn_select_cb))) {
814-
SSL_CTX_set_next_proto_select_cb(ctx, ssl_npn_select_cb, (void *) self);
823+
SSL_CTX_set_next_proto_select_cb(ctx, ssl_npn_select_cb, NULL);
815824
OSSL_Debug("SSL NPN select callback added");
816825
}
817826
#endif
@@ -827,7 +836,7 @@ ossl_sslctx_setup(VALUE self)
827836
OSSL_Debug("SSL ALPN values added");
828837
}
829838
if (RTEST(rb_attr_get(self, id_i_alpn_select_cb))) {
830-
SSL_CTX_set_alpn_select_cb(ctx, ssl_alpn_select_cb, (void *) self);
839+
SSL_CTX_set_alpn_select_cb(ctx, ssl_alpn_select_cb, NULL);
831840
OSSL_Debug("SSL ALPN select callback added");
832841
}
833842

0 commit comments

Comments
 (0)