OpenSearch: [BUG] new QueryGroupTask warning in 2.18

Describe the bug

The warning: https://github.com/opensearch-project/OpenSearch/pull/14708/files#diff-4e901163f39dfc072ae4d7f93a43f0958bdfdf2bb82f044b2ec9f3ae13fa66dfR56 Ideally should never happen, but it’s spamming our logs for our use cases.

Related component

Search

To Reproduce

curl -s -X POST "localhost:9200/some_index_name/_search?size=2&scroll=30s" -H "content-type: application/json" -d '{"query":{"match_all":{}}}'

with the _scroll_id from the response:

curl -s "localhost:9200/_search/scroll/${_scroll_id}?scroll=30s

The opensearch logs show:

2024-12-17T17:00:36.571341698Z [2024-12-17T17:00:36,570][WARN ][o.o.w.QueryGroupTask     ] [b6feeca76aab] QueryGroup _id can't be null, It should be set before accessing it. This is abnormal behaviour

Expected behavior

No warning

Additional Details

Plugins Please list all plugins currently enabled.

Screenshots If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context Add any other context about the problem here.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 3
  • Comments: 15 (11 by maintainers)

Most upvoted comments

Thanks for bringing it to our attention I think in 2.x the scroll API changes were not merged in due to backward compatibility issues, We will address it as part of this PR: https://github.com/opensearch-project/OpenSearch/pull/17576

The issue is, the WLM picks all the QueryGroupTask types and the Task is created in TransportAction class but tagged in action specific transport classes, e,g; TransportSearchAction hence the querygroupId is missing in those QueryGroupTasks.

Let me see what is causing this. Thanks rursprung bringing this to our attention.

FYI @kaushalmahi12. There’s a couple more cases here beyond scroll. @rursprung’s case suggests there might be a race condition during search triggering this case.

this problem also appears with simple requests against the /search API when you just send enough of them at the same time. tested using a stock 2.18.0 release (i disabled the security plugin for simplicity).

  1. create a test index:
curl --location --request PUT 'http://localhost:9200/testindex' \
--header 'Content-Type: application/json' \
--data-raw '{
    "mappings": {
        "properties": {
            "testfield": {
                "type": "text"
            }
        }
    }
}'
  1. add test data (probably not even needed):
curl --location --request POST 'http://localhost:9200/testindex/_doc' \
--header 'Content-Type: application/json' \
--data-raw '{
    "testfield": "foo"
}'
  1. run a lot of GET requests against the API; i used oha for this, letting it run for 2 minutes with the default 50 parallel requests:
oha -z 2m http://localhost:9200/testindex/_search

i got the message 14x in the OS log during this time.

I’m also seeing this error popup on a fresh cluster running the re-index API.

@kaushalmahi12 Yes, as far as I can find, only the scroll APIs are affected.

@doug-numetric I suppose this is only happening for scroll APIs?

I think the mechanism to set the queryGroupId for scroll action is missing. To mitigate the logging from QueryGroupTask class, we can do the following

curl -XPUT "localhost:9200/_cluster/settings" -H "Content-Type: Application/json" -d '{"persistent" : { "logger.org.opensearch.wlm.QueryGroupTask": "ERROR" }}'