-
Notifications
You must be signed in to change notification settings - Fork 104
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
fix: Fix response iterator in Python In-Process API #370
Conversation
e959c98
to
a80cd1c
Compare
numpy.testing.assert_array_equal(input_value, output_value) | ||
) | ||
|
||
responses = list(response_iterator) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is subtle at a glance, but list(response_iterator)
is actually blocking and iterating on the iterator until it's completely consumed, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. It looks like sometimes the previous version of the test didn't execute since there were no responses observed. This is to make sure that the response length is always one.
del self._request | ||
self._request = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From bindings / lifecycle perspectives, are there any cons introduced by not explicitly deleting the request here or somewhere else? Will an object get kept around unexpectedly?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Memory usage appears to be stable. Might need stress tests to make sure it is not leaking any memory.
What is being held in request object? Aren't the responses being stored in the iterator? |
@GuanLuo I think the |
What does the PR do?
The response iterator destroyed the request object after final response is received which lead to destruction of the queue and responses not being retrieved by the user.
Checklist
<commit_type>: <Title>
Commit Type:
Check the conventional commit type
box here and add the label to the github PR.
Related PRs:
N/A
Where should the reviewer start?
N/A
Test plan:
Updated L0_python_api.
15804851
Caveats:
N/A
Background
N/A
Related Issues: (use one of the action keywords Closes / Fixes / Resolves / Relates to)
N/A