Skip to content

DNN-21973: retry the search when there have exception throw during search process. #2198

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

Merged
merged 3 commits into from
Aug 13, 2018

Conversation

zyhfish
Copy link
Contributor

@zyhfish zyhfish commented Aug 2, 2018

fixes #2183

@sleupold
Copy link
Contributor

sleupold commented Aug 2, 2018

what are the reasons for the search to throw an exception and does it really helps just to retry 5 times immediately in a row?

@zyhfish
Copy link
Contributor Author

zyhfish commented Aug 2, 2018

This is an edge case in azure instances, exception will thrown during migrate new instances, the drive need to prepare for a while, and in that time when request index files will get IOException, so need to close the reader and try again. actually its not retry immediately but wait for 100ms then retry. also the retry times can config to a larger number if we found the drive initialize will take longer time.

@ashishpd
Copy link
Contributor

ashishpd commented Aug 2, 2018

We are seeing this exception at customer's site. Please note most of the PR from @zyhfish come from real customer issues.

@ashishpd ashishpd added the esw Issues reported by ESW team or Evoq customers label Aug 2, 2018
return luceneResults;
}
catch (Exception ex)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If possible, please catch a more specific exception. You mention IOException in the ticket. Any other exception probably should not cause a retry, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yep, there have more exceptions but not only this one after deploy the patch and get the error log, have create several sub tasks to handle these errors.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then please add a specific catch clause for each "expected exception". Let's start by catching the IOExcpetion in this PR and subsequent submissions will add more handling

Logger.Error($"Search Index Folder Is Not Available: {ex.Message}, Retry {retryTimes} time(s).");
Thread.Sleep(100);

return Search(searchContext, retryTimes);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not call Search recursively from try..catch. Instead please wrap error handling in a loop and break out of that loop when the results have been successfully returned.


//Page doesn't exist
if (luceneResults.TotalHits < minResults)
return luceneResults;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why increase the nesting depth with this change from a return if the total hits were less than mins?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not a new change in this PR.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@zyhfish Yes, this is a change in this PR. You removed the old process which returned early, to an inversed logic that increases the IL nesting depth of the code

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's amusing that with the logical expression reversed the comment above is not incorrect :)

@zyhfish
Copy link
Contributor Author

zyhfish commented Aug 13, 2018

is this PR able to merge? there have more changes was required based on this change, so need it merged then can continue that part work, thx

@mitchelsellers mitchelsellers merged commit 8880acc into dnnsoftware:development Aug 13, 2018
@zyhfish zyhfish deleted the bug/DNN-21973 branch August 13, 2018 01:15
@ohine ohine added this to the 9.2.2 milestone Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
esw Issues reported by ESW team or Evoq customers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

sometimes search result will be empty in azure app service
6 participants