[JIT] Add a flag to rethrow caught exception in jit interpreter (#63073)
authorDon Jang <djang@fb.com>
Fri, 13 Aug 2021 15:37:23 +0000 (08:37 -0700)
committerFacebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
Fri, 13 Aug 2021 15:44:24 +0000 (08:44 -0700)
commit61b49c8e41a2faf7fd40278ca72616c5d92963cb
treeaeb0c23205ecb6b8ce99e5d155d7199d2d448972
parent32b6104f37a0d2db68fb8378143ed7c7685c4782
[JIT] Add a flag to rethrow caught exception in jit interpreter (#63073)

Summary:
Pull Request resolved: https://github.com/pytorch/pytorch/pull/63073

It turned out that it's less than ideal to print out verbose stacktrace in exception messages in high-QPS services (see the related task) with a non-significant failure rate due to the truncation of long stacktrace which results in losing the original exception message thrown from native code. It is actually desirable to retain only the message of the original exception directly thrown from native code in such a usecase.

This change adds a new flag `torch_jit_disable_exception_stacktrace` to the pytorch jit interpreter to suppress stacktrace in the messages of exception thrown from the interpreter.

Reviewed By: Krovatkin

Differential Revision: D30241792

fbshipit-source-id: c340225c69286663cbd857bd31ba6f1736b1ac4c
test/cpp/jit/test_interpreter.cpp
torch/csrc/jit/runtime/interpreter.cpp
torch/csrc/jit/runtime/interpreter.h