diff options
author | Carl Friedrich Bolz-Tereick <cfbolz@gmx.de> | 2021-02-19 17:34:42 +0100 |
---|---|---|
committer | Carl Friedrich Bolz-Tereick <cfbolz@gmx.de> | 2021-02-19 17:34:42 +0100 |
commit | cbdbd854daae62d9c7b59b225c513d08124f7d34 (patch) | |
tree | 0b0ed3320beb725ac23c9f286628cdc3f90f22c4 /rpython | |
parent | randomly fix broken target (diff) | |
download | pypy-cbdbd854daae62d9c7b59b225c513d08124f7d34.tar.gz pypy-cbdbd854daae62d9c7b59b225c513d08124f7d34.tar.bz2 pypy-cbdbd854daae62d9c7b59b225c513d08124f7d34.zip |
workaround for a crash when running test_recursive_pickle in test_functools on
the py3.7 branch
The test produces stack overflows intentionally, and if we blackhole at the
wrong stack depth then an vmprof frame is not popped correctly for some reason.
unfortunately I was not able to find the reason, but this mitigation at least
prevents the vm from crashing.
Diffstat (limited to 'rpython')
-rw-r--r-- | rpython/rlib/rvmprof/cintf.py | 21 |
1 files changed, 19 insertions, 2 deletions
diff --git a/rpython/rlib/rvmprof/cintf.py b/rpython/rlib/rvmprof/cintf.py index c63e12d120..b8e9492789 100644 --- a/rpython/rlib/rvmprof/cintf.py +++ b/rpython/rlib/rvmprof/cintf.py @@ -229,8 +229,25 @@ def jit_rvmprof_code(leaving, unique_id): enter_code(unique_id) # ignore the return value else: s = vmprof_tl_stack.getraw() - assert s.c_value == unique_id and s.c_kind == VMPROF_CODE_TAG - leave_code(s) + if s.c_value == unique_id and s.c_kind == VMPROF_CODE_TAG: + leave_code(s) + else: + # this is a HACK! in some strange situations related to stack + # overflows we end up in a situation where the stack is not + # properly popped somewhere, so we end up with an extra entry. + # instead of crashing with an assertion error (which was done + # previously) try to fix the situation by popping of the stack + # twice. if that also gives the wrong unique_id we still crash with + # an assert. + + # the test that found this problem is test_recursive_pickle in + # python3 test_functools.py + assert (s.c_next and s.c_next.c_value == unique_id and + s.c_next.c_kind == VMPROF_CODE_TAG) + s = vmprof_tl_stack.getraw() + leave_code(s) + s = vmprof_tl_stack.getraw() + leave_code(s) # # traceback support |