Page MenuHomePhabricator

Roughly 236k index_not_found_exception errors per week on external CirrusSearch traffic
Closed, ResolvedPublic

Description

While instrumenting the availability SLI for T431145 I ran into a steady stream of index_not_found_exception errors on user-facing search that does not seem to be tracked anywhere.

What the numbers say

mediawiki_CirrusSearch_backend_failures_total{type="config_issue"} counts index_not_found_exception and nothing else, see ElasticaErrorHandler::classifyError(). Over the last 30 days, external namespaces (mw-web plus mw-api-ext):

Errors~726,000, so ~236,000 per week
Share of external search requests0.013%
Share of all search failures that are not user error96%

Where they come from, same 30 days, all namespaces:

namespaceerrors
mw-web712,148
mw-api-ext12,340
mw-jobrunner1,165
mw-cron977

So this is almost entirely browser-facing search rather than jobs or maintenance scripts. Since the pool label landed in T434975 the affected requests are pool="Search" with a handful of pool="Prefix", i.e. ordinary full text search. Split by site, codfw runs about 2.4x eqiad (379k against 159k), which I cannot explain and which may be a clue.

It is not a spike either. The daily rate has grown slowly and steadily: 0.20/s 90 days ago, 0.215/s 30 days ago, 0.266/s now.

Why it is worth a ticket

Each one of these is a search that returned no results to a reader. 0.013% of traffic is small, but it is 96% of everything failing on the search path for reasons that are ours rather than the user's, and it is trending upwards.

It also changes how we scope the availability SLO in T431145. Counting config_issue in the SLI puts external search availability at 99.986%; leaving it out puts it at 99.9995%. I would rather fix the errors than exclude them from the measurement.

Where to look next

The Prometheus metric has no wiki or index dimension, so it cannot say which index is missing. The log line can: ElasticsearchIntermediary::failure() writes to channel CirrusSearch with the message Search backend error during {queryType} after {tookMs}: {error_message}, and error_message carries the index name. A logstash query on that channel filtered to index_not_found_exception should name the wiki or index quickly.

Hypotheses worth ruling out, in no particular order:

  • a wiki whose index was never created, or was deleted and never rebuilt (new, closed or private wikis)
  • a stale cluster assignment, sending a wiki's queries to a cluster that does not hold its index
  • a query against an index alias that exists on only some of the three clusters (chi, omega, psi)

Reproducing the measurement

sum by (kubernetes_namespace) (
  increase(mediawiki_CirrusSearch_backend_failures_total{
    type="config_issue", prometheus="k8s"
  }[30d])
)

Event Timeline

dcausse subscribed.

Suspecting cross cluster searches issued while fetching interwiki results having some race issues because we ccs_minimize_roundtrips is true by default. Trying to reproduce this might take time since the error rate is quite low. Possible fix to reduce the noise could be to relax the search query with ignore_unavailable=true & allow_no_indices=true for interwiki searches (these are generally best efforts and errors are not presented to users, plus I doubt that we want disable ccs_minimize_roundtrips).

Change #1346093 had a related patch set uploaded (by DCausse; author: DCausse):

[mediawiki/extensions/CirrusSearch@master] Set ignore_unavailable on cross cluster searches (interwiki)

https://gerrit.wikimedia.org/r/1346093

Change #1346326 had a related patch set uploaded (by DCausse; author: DCausse):

[mediawiki/extensions/CirrusSearch@master] Disable fallbacks to constructed configs for interwiki

https://gerrit.wikimedia.org/r/1346326

Actually looking closer I suspect a more likely cause is problems fetching the target wiki config during interwiki searches, in case of failures we fallback to a constructed minimal config. This artificial config was fine before we switched to a multi-cluster setup but now there's no way to actually construct this config reliably because we need to know what is the target cluster.

Change #1346093 merged by jenkins-bot:

[mediawiki/extensions/CirrusSearch@master] Set ignore_unavailable on cross cluster searches (interwiki)

https://gerrit.wikimedia.org/r/1346093

Change #1346326 merged by jenkins-bot:

[mediawiki/extensions/CirrusSearch@master] Disable fallbacks to constructed configs for interwiki

https://gerrit.wikimedia.org/r/1346326