-
Notifications
You must be signed in to change notification settings - Fork 370
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 infinite loop causing memory leak in GH-1519 #1531
Conversation
I don't know the codebase/protocol well enough to know whether we can always expect there to be at least one value in the iterator, or whether we need to have a fallback and a check, e.g. head = next(iter(results), None)
if head is None:
break |
@@ -450,6 +450,7 @@ async def _browse_next(self, results: Iterable[ua.BrowseResult]) -> List[ua.Refe | |||
params.ContinuationPoints = [head.ContinuationPoint] | |||
params.ReleaseContinuationPoints = False | |||
results = await self.session.browse_next(params) | |||
head = next(iter(results)) |
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.
yes we should check that next does not return None
@@ -450,6 +450,7 @@ async def _browse_next(self, results: Iterable[ua.BrowseResult]) -> List[ua.Refe | |||
params.ContinuationPoints = [head.ContinuationPoint] | |||
params.ReleaseContinuationPoints = False | |||
results = await self.session.browse_next(params) | |||
head = next(iter(results)) |
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.
but something else i wrong here. The original code only handled results[0] and this is correct since we only sent one request to server. Now that check is gone...
@@ -450,6 +450,7 @@ async def _browse_next(self, results: Iterable[ua.BrowseResult]) -> List[ua.Refe | |||
params.ContinuationPoints = [head.ContinuationPoint] | |||
params.ReleaseContinuationPoints = False | |||
results = await self.session.browse_next(params) | |||
head = next(iter(results)) |
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.
I propose we just revert to original code, I do not see anything wrong in it (apart from getting a strange error if result does not contain at least one result., it should but...)
Sounds good, @oroulet :) |
No description provided.