elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.67k stars 8.23k forks source link

[Data services] unnecessary calls to async search results #201250

Open markov00 opened 17 hours ago

markov00 commented 17 hours ago

Kibana version: main

Describe the bug: If you click the Dashboard refresh button, panels will reload their data but also a series of subsequent requests to the same async search id are issued for ~9 more times at an interval of 30 seconds each.

Steps to reproduce:

  1. Create a dashboard with a single panel
  2. Open the dev tools network panel
  3. disable the auto-refresh if enabled
  4. click on the refresh button
  5. you will see a first ese cancelled query, then the actual ese query.
  6. now wait 30 seconds and another request with the async id will be issued to the kibana server
  7. the same will happen for other 7/8 times

This happen for every panel on the dashboard, so it means that if you have more than one, the number of requests sent after the first request depends on the number of panels

Expected behavior: Hitting refresh should only refresh the panels one time and should not trigger any other data request.

Screenshots (if relevant): An example with 3 panels

Image

Errors in browser console (if relevant): no errors in console

Any additional context:

The first canceled request looks like the culprit here, is not clear why a request was sent and immediately cancelled.

elasticmachine commented 17 hours ago

Pinging @elastic/kibana-visualizations (Team:Visualizations)

elasticmachine commented 17 hours ago

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

davismcphee commented 13 hours ago

These seem related to search session requests, keeping the searches alive in case the users chooses to save the session. Typically those requests look similar to these with the search ID included, and I think search sessions typically poll at 30 sec intervals up to 5 min when we discard the session if not saved. Maybe @lukasolson can confirm?

If that's the case, the issue might actually be that Dashboard doesn't poll for search sessions on the initial fetch, and instead only after refetching. I don't know how this impacts search sessions, but I wonder how long it's been going on for... Maybe it goes to show how little search sessions are used 😅

The cancelled requests seem like they may be an unrelated issue. Possibly just that Dashboard attempts to refetch all panels twice in quick succession, causing the initial fetches to abort?

markov00 commented 2 hours ago

I think search sessions typically poll at 30 sec intervals up to 5 min when we discard the session if not saved

this seems exactly the case, because it polls for ~10 times so basically 5 minutes