From f5d20411386ff2552ff27661387ddc4bae1ebc30 Mon Sep 17 00:00:00 2001 From: Alan Wu Date: Mon, 22 Nov 2021 19:29:29 -0500 Subject: Avoid assert failure when NULL EC is expected After 5680c38c75aeb5cbd219aafa8eb48c315f287d97, postponed job APIs now expect to be called on native threads not managed by Ruby and handles getting a NULL execution context. However, in debug builds the change runs into an assertion failure with GET_EC() which asserts that EC is non-NULL. Avoid the assertion failure by passing `false` for `expect_ec` instead as the intention is to handle when there is no EC. Add a test from John Crepezzi and John Hawthorn to exercise this situation. See GH-4108 See GH-5094 [Bug #17573] Co-authored-by: John Hawthorn Co-authored-by: John Crepezzi --- test/-ext-/postponed_job/test_postponed_job.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'test') diff --git a/test/-ext-/postponed_job/test_postponed_job.rb b/test/-ext-/postponed_job/test_postponed_job.rb index 7dc28776d0..fee0172d11 100644 --- a/test/-ext-/postponed_job/test_postponed_job.rb +++ b/test/-ext-/postponed_job/test_postponed_job.rb @@ -25,4 +25,11 @@ class TestPostponed_job < Test::Unit::TestCase Bug.postponed_job_register_one(ary = []) assert_equal [1], ary end + + if Bug.respond_to?(:postponed_job_register_in_c_thread) + def test_register_in_c_thread + assert Bug.postponed_job_register_in_c_thread(ary = []) + assert_equal [1], ary + end + end end -- cgit v1.2.3