From 89d959fd6ac206a1a3b5a6cb151d19290df6a235 Mon Sep 17 00:00:00 2001 From: Simon Mo Date: Sat, 21 Mar 2020 15:16:12 -0700 Subject: [PATCH] Stop gap solution for cython functions breaking in memory monitor (#7687) --- python/ray/_raylet.pyx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/python/ray/_raylet.pyx b/python/ray/_raylet.pyx index 7b5ce944c..2995a7155 100644 --- a/python/ray/_raylet.pyx +++ b/python/ray/_raylet.pyx @@ -569,7 +569,12 @@ cdef void get_py_stack(c_string* stack_out) nogil: """ with gil: - frame = inspect.currentframe() + try: + frame = inspect.currentframe() + except ValueError: # overhead of exception handling is about 20us + stack_out[0] = "".encode("ascii") + return + msg = "" while frame: filename = frame.f_code.co_filename