-
Notifications
You must be signed in to change notification settings - Fork 339
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug]: gRPC handler is reraising Exceptions in a way that breaks low-level Python Exception tracking #2221
Comments
Hi @bcalvert-graft, Thanks for the detailed report! Your insights are valuable. We appreciate you considering a quick fix PR. You're absolutely right that the current behavior is counterproductive. We originally opted for |
/unassign |
Thanks @XuanYang-cn for the fast reply. I'll open up a PR as soon as I can |
Also, thank you for this clarification on the motivation for the |
@XuanYang-cn and whoever else I should ping, I've opened up #2225 from a fork of the |
Hi all, Gentle bump on this thread. As mentioned above, I've opened up #2225. Are there additional things I should do to move this bugfix forward? |
Is there an existing issue for this?
Describe the bug
Hello Milvus maintainers,
Thank you in advance for reading my bug-report.
There are three spots in
grpc_handler.py
(first spot, second spot and third spot) that use the following pattern to reraise anException
Respectfully, this
raise err from err
is not a great way to reraise exceptions; instead, as mentioned in the Python docs it should beWhy is the first one not great? It attaches the
err
Exception
as the__cause__
to itself. As I understand it, this is not the desired semantics for__cause__
and this breaks any tools that recursively unroll chainedException
s (e.g. for processing stack traces). As a concrete example of such a tool, we actually uncovered this seeming bug ingrpc_handler.py
when using Milvus as part of a larger Dask computation; specifically, as part of Dask's error-handling, the library uses a utility calledcollect_causes
,When
collect_causes
encounters anException
raised from one of the linked spots ingrpc_handler.py
it triggers an infinite loop of unrollinge.__cause__
, consequently leaking memory until the process is killed.Assuming you agree with the quick fix, I'm happy to submit a PR, but wanted to run it by you first to make sure I'm not missing something.
Cheers,
Brian
Expected Behavior
When handling
Exception
s raised by the linked methods ingrpc_handler.py
, theException
s should not be attached as their own__cause__
Steps/Code To Reproduce behavior
In one process, run
In another process, run
The
In [6]:
step will throw anAssertionError
Environment details
Anything else?
No response
The text was updated successfully, but these errors were encountered: