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

Elasticsearch queries with scroll stopped working #56202

Closed
crspl opened this issue May 5, 2020 · 11 comments
Closed

Elasticsearch queries with scroll stopped working #56202

crspl opened this issue May 5, 2020 · 11 comments
Assignees
Labels
:Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team

Comments

@crspl
Copy link

crspl commented May 5, 2020

Elasticsearch version: 7.6.2
Plugins installed: -
JVM version: shipped with ES (openjdk version "13.0.2" 2020-01-14)
OS: Centos 7 (kernel 3.10.0-862.14.4.el7.x86_64)

Bug description:
Queries with 'scroll' feature stopped working even on very small indices and with v.high value for search.max_open_scroll_context (5000000). Getting error 500 'Trying to create too many scroll contexts' even if node stats doesn't show any open contexts or "scroll current".

Steps to reproduce:
No idea unfortunately. But it started when several heavy searches using scroll were running at the end of month. Initially it worked well but then it stopped and doesn't work anymore for any index/query.

ES_BUG_DEBUG.txt

@cbuescher
Copy link
Member

Hi @crspl! Your question is better suited to the support forums over at https://discuss.elastic.co. We prefer to use Github issues only for bug reports and feature requests, and we think it's more likely this is a question than a bug report. I'm closing this as an issue here, but encourage you to ask this question in the forum instead. Many thanks.

@crspl
Copy link
Author

crspl commented May 5, 2020

Hi @cbuescher . I believe it's a bug and not lack of knowledge on our side. As I've written all was working fine and stopped suddenly after some time and now even very simple queries with "scroll" on idle cluster return 500. Problem is I cannot give you step by step instruction how to reproduce. But before I raised issue here I've asked on forum. Here's my thread -> https://discuss.elastic.co/t/did-i-hit-bug-related-to-scroll-and-too-many-scroll-contexts/230954 Please consider reopen this. I'm happy to give you more debug info.

@crspl
Copy link
Author

crspl commented May 6, 2020

one more update... this morning I've restarted nodes in our cluster one by one. Checked "scroll" query every few and ending up it started working (after 6 node out of 8) and no more 500 'Trying to create too many scroll contexts' exception

@wushuaiwangyin
Copy link

This is a bug. Openscrollcontexts is used to control the maximum scroll context. But by accessing the "_nodes/ data:true/stats/indices/search" get open_context does not reach the limit, which can be modified“ search.max_open_scroll_context "to the maximum value of int.

@sourcelliu
Copy link
Contributor

This is a bug. Encountered this problem in our production environment.
Elasticsearch version: 7.6.2.

_Openscrollcontexts is used to control the maximum scroll context. But by accessing the "nodes/ data:true/stats/indices/search" get open_context does not reach the limit, which can be modified“ search.max_open_scroll_context "to the maximum value of int.

@doowonee
Copy link

Is this bug has been fixed? I'm in the exactly same situation. So I wonder which version should I use then?

@jerryjune
Copy link

After some source code research and debug. This is a confirmed bug and fixed after 7.7.0 release. This commit #53449 fixed this problem. And the walk around solution is set search.max_open_scroll_context to the maximum value of int like @mantuliu did.

@jerryjune
Copy link

This is a bug. Encountered this problem in our production environment.
Elasticsearch version: 7.6.2.

_Openscrollcontexts is used to control the maximum scroll context. But by accessing the "nodes/ data:true/stats/indices/search" get open_context does not reach the limit, which can be modified“ search.max_open_scroll_context "to the maximum value of int.

After source code analysis, because of the bug, AtomicInteger openScrollContexts will be decreased to negative and finally overflow to Int_Max, this will let openScrollContexts > maxOpenScrollContext always true and cannot create scroll anymore. This is why set search.max_open_scroll_context to the maximum value of int can work.

@dnhatn dnhatn reopened this Apr 6, 2021
@dnhatn dnhatn added the :Search/Search Search-related issues that do not fall into other categories label Apr 6, 2021
@elasticmachine elasticmachine added the Team:Search Meta label for search team label Apr 6, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-search (Team:Search)

@dnhatn
Copy link
Member

dnhatn commented Apr 6, 2021

Thanks everyone for the input.

This bug was introduced in #53449 and fixed in 7.7+ in fe2f6b3. I've opened #71354 to fix it in 6.8.

dnhatn added a commit that referenced this issue Apr 7, 2021
The scroll context counter can be negative even become Integer.MAX_VALUE
after handling many search requests.  This bug causes two issues:

- Disable the limit of open scroll contexts when the counter is negative
- Prevent opening new scroll contexts when the counter is greater than 
  the limit of open scroll contexts

Relates #53449
Closes #56202
@jimczi
Copy link
Contributor

jimczi commented Apr 19, 2021

Fixed by #71354

@jimczi jimczi closed this as completed Apr 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
:Search/Search Search-related issues that do not fall into other categories Team:Search Meta label for search team
Projects
None yet
Development

No branches or pull requests

9 participants