Skip to content
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] a lot of getting all indices error when open sample detector page #251

Closed
ylwu-amzn opened this issue Apr 26, 2022 · 3 comments · Fixed by #262
Closed

[BUG] a lot of getting all indices error when open sample detector page #251

ylwu-amzn opened this issue Apr 26, 2022 · 3 comments · Fixed by #262
Labels
bug Something isn't working untriaged

Comments

@ylwu-amzn
Copy link
Contributor

ylwu-amzn commented Apr 26, 2022

What is the bug?
See a lot of "Error getting all indices" error when open sample detector.

How can one reproduce the bug?
Steps to reproduce the behavior:

  1. Create multi node cluster with CDK
  2. Create 3 sample detectors
  3. Open sample-ecommerce-detector
  4. See a lot of Error getting all indices error. Open browser network, see many requests of _indices?index=.

What is the expected behavior?
Just throw one error and don't sent out so many request in short time.

What is your host/environment?

  • OS: Amazon Linux 2
  • Version 1.3.1
  • Plugins

Do you have any screenshots?
Screen Shot 2022-04-25 at 5 30 40 PM

Do you have any additional context?
Add any other context about the problem.

@ylwu-amzn ylwu-amzn added bug Something isn't working untriaged labels Apr 26, 2022
@inidona
Copy link

inidona commented May 10, 2022

we have this problem also, with our regular indices. I have this screenshot from java script console. So it seems that the browser could not process so much requests at once.
image

@amitgalitz
Copy link
Member

Thanks @ylwu-amzn and @inidona for bringing this up. After an initial look the issue seems to be within these lines of code: https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/blob/main/public/pages/DetectorDetail/containers/DetectorDetail.tsx#L157-L165 We have it set up to refetch indices on any changes to prop/states. The original purpose as described in the comment is to re-fetch if there are changes to the detector "(e.g., detector starts, result index recreated or user switches tabs to re-fetch detector)" however if the page is taking a while to load initially it will constantly refetch indices until the page has fully rendered and all initial prop/states changes have happened. I’ll look into a potential fix, let us know if you have suggestion or if you would like to contribute to this fix

@amitgalitz
Copy link
Member

More specifically what is happening is that the useFetchDetectorInfo(detectorId) method is getting called in a loop until various conditions are met: https://github.com/opensearch-project/anomaly-detection-dashboards-plugin/blob/main/public/pages/CreateDetectorSteps/hooks/useFetchDetectorInfo.ts#L23. Solution would either be to change useFetchDetectorInfo() to only get called once and wait for response or to add if (!isLoadingDetector) before calling getInitialIndices() so we don't make constant network requests while detector is being fetched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working untriaged
Projects
None yet
3 participants