diff options
author | Alan Wu <[email protected]> | 2021-11-22 19:29:29 -0500 |
---|---|---|
committer | GitHub <[email protected]> | 2021-11-22 19:29:29 -0500 |
commit | f5d20411386ff2552ff27661387ddc4bae1ebc30 (patch) | |
tree | 6e59cf9014f4f7fabb3bcb535cbaa31818b9a3ec /vm_trace.c | |
parent | 13d1ded253940585a993e92648ab9f77d355586d (diff) |
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 <[email protected]>
Co-authored-by: John Crepezzi <[email protected]>
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/5156
Merged-By: XrXr
Diffstat (limited to 'vm_trace.c')
-rw-r--r-- | vm_trace.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/vm_trace.c b/vm_trace.c index 3bc55f2c3a..66ea7b24b7 100644 --- a/vm_trace.c +++ b/vm_trace.c @@ -1585,7 +1585,7 @@ postponed_job_register(rb_execution_context_t *ec, rb_vm_t *vm, static rb_execution_context_t * get_valid_ec(rb_vm_t *vm) { - rb_execution_context_t *ec = GET_EC(); + rb_execution_context_t *ec = rb_current_execution_context(false); if (ec == NULL) ec = rb_vm_main_ractor_ec(vm); return ec; } |