elastic / elasticsearch

Free and Open Source, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
1.1k stars 24.83k forks source link

[CI] SecurityIndexManagerIntegTests testOnIndexAvailableForSearchIndexAlreadyAvailable failing #113336

Closed elasticsearchmachine closed 1 month ago

elasticsearchmachine commented 1 month ago

Build Scans:

Reproduction Line:

./gradlew ":x-pack:plugin:security:internalClusterTest" --tests "org.elasticsearch.xpack.security.support.SecurityIndexManagerIntegTests.testOnIndexAvailableForSearchIndexAlreadyAvailable" -Dtests.seed=19DE7F0872A25AB9 -Dtests.locale=tk-TM -Dtests.timezone=Atlantic/Madeira -Druntime.java=22

Applicable branches: main

Reproduces locally?: N/A

Failure History: See dashboard&_a=(controlGroupInput:(chainingSystem:HIERARCHICAL,controlStyle:twoLine,ignoreParentSettings:(ignoreFilters:!f,ignoreQuery:!f,ignoreTimerange:!f,ignoreValidations:!t),panels:('0c0c9cb8-ccd2-45c6-9b13-96bac4abc542':(explicitInput:(dataViewId:fbbdc689-be23-4b3d-8057-aa402e9ed0c5,enhancements:(),fieldName:task.keyword,grow:!t,id:'0c0c9cb8-ccd2-45c6-9b13-96bac4abc542',searchTechnique:wildcard,selectedOptions:!(),singleSelect:!t,title:'Gradle%20Task',width:medium),grow:!t,order:0,type:optionsListControl,width:small),'144933da-5c1b-4257-a969-7f43455a7901':(explicitInput:(dataViewId:fbbdc689-be23-4b3d-8057-aa402e9ed0c5,enhancements:(),fieldName:name.keyword,grow:!t,id:'144933da-5c1b-4257-a969-7f43455a7901',searchTechnique:wildcard,selectedOptions:!('testOnIndexAvailableForSearchIndexAlreadyAvailable'),title:Test,width:medium),grow:!t,order:2,type:optionsListControl,width:medium),'4e6ad9d6-6fdc-4fcc-bf1a-aa6ca79e0850':(explicitInput:(dataViewId:fbbdc689-be23-4b3d-8057-aa402e9ed0c5,enhancements:(),fieldName:className.keyword,grow:!t,id:'4e6ad9d6-6fdc-4fcc-bf1a-aa6ca79e0850',searchTechnique:wildcard,selectedOptions:!('org.elasticsearch.xpack.security.support.SecurityIndexManagerIntegTests'),title:Suite,width:medium),grow:!t,order:1,type:optionsListControl,width:medium)))))

Failure Message:

org.elasticsearch.ElasticsearchTimeoutException: timed out waiting for security index [.security-7] to become available for search

Issue Reasons:

Note: This issue was created using new test triage automation. Please report issues or feedback to es-delivery.

elasticsearchmachine commented 1 month ago

This has been muted on branch main

Mute Reasons:

Build Scans:

elasticsearchmachine commented 1 month ago

Pinging @elastic/es-security (Team:Security)

n1v0lg commented 1 month ago

This is a genuine issue with prod code but can't actually manifest in practice:

There's a race condition if onIndexAvailableForSearch is called with a 0 (or very low) timeout and the index is already available -- the scheduled timeout task races with the successful completion of the listener and can produce erroneous timeouts.

This can't happen in production right now because in prod-code, onIndexAvailableForSearch is only called if a non-zero timeout is configured -- furthermore, we plan to set the timeout to 5s which is far too long for the race condition to manifest.

I'll of course still fix the race condition (PR is WIP). Labelling it low-risk since it's not something that can happen in practice.

kkrik-es commented 1 month ago

Was this backported to 8.x? I see it here:

https://gradle-enterprise.elastic.co/s/74lsc7sfoexvy/tests/task/:x-pack:plugin:security:internalClusterTest/details/org.elasticsearch.xpack.security.support.SecurityIndexManagerIntegTests/testOnIndexAvailableForSearchIndexAlreadyAvailable?top-execution=1