-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[SearchProfiler] Remove sources of recursion over potentially deeply nested objects #54015
[SearchProfiler] Remove sources of recursion over potentially deeply nested objects #54015
Conversation
Removed recursive normalizeTimes functions (one fewer iteration through the entire data structure) Optimizied appliation of tree mutations by taking `if` out of tight loop Cleaned up types
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
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.
Thanks @jloleysens for getting a fix for this issue so quickly! That's great! I tested your PR and looks like 'ConstantScoreQuery' is now working properly, however I am still seeing the issue with 'DocValuesFieldExistsQuery' field. I will attach a screenshot.
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
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.
@jloleysens I tested the latest commit and looks like all is passing now :) Yay!
…nested objects (elastic#54015) * Added max tree depth guard Removed recursive normalizeTimes functions (one fewer iteration through the entire data structure) Optimizied appliation of tree mutations by taking `if` out of tight loop Cleaned up types * Tidy up data being passed into store (and through immer) * Fix max tree depth logic * Remove immer from non-test code. Co-authored-by: Elastic Machine <[email protected]>
…nested objects (#54015) (#54431) * Added max tree depth guard Removed recursive normalizeTimes functions (one fewer iteration through the entire data structure) Optimizied appliation of tree mutations by taking `if` out of tight loop Cleaned up types * Tidy up data being passed into store (and through immer) * Fix max tree depth logic * Remove immer from non-test code. Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
Summary
Addresses this issue: #53989.
Please Note
Was not able to repro (yet), butfound some areas that could be improved and risk of exceeding stack limits reduced (see steps taken).In the original issue it looks like the stack limit is being exceeded due to a very large object being passed into
immer
. Because this is happening whenView Details
is being clicked it is most probably happening inside of thereducer.ts
's use ofproduce
.Steps taken
x-pack/legacy/plugins/searchprofiler/public/np_ready/application/components/profile_tree/shard_details/shard_details_tree_node.tsx
).Pass only required objects toRemoved use ofproduce
in the store (e.g., remove thechildren
property)immer
in non test code. Unfortunately the optimisations I proposed were not sufficiently addressing the issue :cInvestigation
After meeting with @liza-mae and seeing the issue on her machine after the initial round of optimisations to deep object traversal (results of
breakdown
attribute coming from ES when profiling and theparent
field we create), some of the "View Details" actions that were not working before were working, but the deeper elements still exceeded call stack limits. Because of thisimmer
has been removed.