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

[BUG] HTTP REST API hangs with Accept-Encoding zstd #17339

Open
mmguero opened this issue Feb 12, 2025 · 1 comment
Open

[BUG] HTTP REST API hangs with Accept-Encoding zstd #17339

mmguero opened this issue Feb 12, 2025 · 1 comment
Assignees
Labels
bug Something isn't working Other v2.19.1 Issues and PRs related to version 2.19.1 v3.0.0 Issues and PRs related to version 3.0.0

Comments

@mmguero
Copy link

mmguero commented Feb 12, 2025

Describe the bug

As of v2.19.0 on Linux, when using cURL or libcurl against the OpenSearch REST API and zstd is in the Accept-Encoding headers, the response from OpenSearch hangs.

Related component

Other

To Reproduce

Broken:

$ curl 'http://localhost:9200/_cat/health?format=json' --verbose -H "Accept-Encoding: deflate, gzip, br, zstd" -o /dev/null
* Host localhost:9200 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying [::1]:9200...
* Connected to localhost (::1) port 9200
> GET /_cat/health?format=json HTTP/1.1
> Host: localhost:9200
> User-Agent: curl/8.5.0
> Accept: */*
> Accept-Encoding: deflate, gzip, br, zstd
> 
< HTTP/1.1 200 OK
< content-type: application/json; charset=UTF-8
< content-length: 300
< content-encoding: zstd
< 

The API call never returns, until the client times out or the process is killed.

Expected behavior

Here's what happens if you remove the zstd from the Accept-Encoding header.

$ curl 'http://localhost:9200/_cat/health?format=json' --verbose -H "Accept-Encoding: deflate, gzip, br" -o /dev/null
* Host localhost:9200 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying [::1]:9200...
* Connected to localhost (::1) port 9200
> GET /_cat/health?format=json HTTP/1.1
> Host: localhost:9200
> User-Agent: curl/8.5.0
> Accept: */*
> Accept-Encoding: deflate, gzip, br
> 
< HTTP/1.1 200 OK
< content-type: application/json; charset=UTF-8
< content-encoding: gzip
< content-length: 214
< 
{ [214 bytes data]
100   214  100   214    0     0   161k      0 --:--:-- --:--:-- --:--:--  208k
* Connection #0 to host localhost left intact

Also, this is the behavior in v2.18.0, even with the zstd included in Accept-Encoding:

$ curl 'http://localhost:9200/_cat/health?format=json' --verbose -H "Accept-Encoding: deflate, gzip, br, zstd" -o /dev/null
* Host localhost:9200 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying [::1]:9200...
* Connected to localhost (::1) port 9200
> GET /_cat/health?format=json HTTP/1.1
> Host: localhost:9200
> User-Agent: curl/8.5.0
> Accept: */*
> Accept-Encoding: deflate, gzip, br, zstd
> 
< HTTP/1.1 200 OK
< content-type: application/json; charset=UTF-8
< content-encoding: gzip
< content-length: 214
< 
{ [214 bytes data]
100   214  100   214    0     0   101k      0 --:--:-- --:--:-- --:--:--  104k
* Connection #0 to host localhost left intact

Note that in v2.18.0 content-encoding: gzip but in v2.19.0 content-encoding: zstd with it hanging.

Additional Details

Plugins

$ opensearch-plugin list
opensearch-alerting
opensearch-anomaly-detection
opensearch-asynchronous-search
opensearch-cross-cluster-replication
opensearch-custom-codecs
opensearch-flow-framework
opensearch-geospatial
opensearch-index-management
opensearch-job-scheduler
opensearch-knn
opensearch-ltr
opensearch-ml
opensearch-neural-search
opensearch-notifications
opensearch-notifications-core
opensearch-observability
opensearch-reports-scheduler
opensearch-security-analytics
opensearch-skills
opensearch-sql
opensearch-system-templates
query-insights

Note that I have removed the opensearch-security and opensearch-performance-analyzer but I think that's probably not relevant (?).

Host/Environment (please complete the following information):

  • OS: Linux, x86_64 in Docker (based on official opensearchproject/opensearch:2.19.0 image)
  • Version: v2.19.0 (regression since v2.18.0)

**Workaround

Setting http.compression to false causes the problem to go away.

@mmguero mmguero added bug Something isn't working untriaged labels Feb 12, 2025
@github-actions github-actions bot added the Other label Feb 12, 2025
@mmguero mmguero changed the title [BUG] REST API hangs with Accept-Encoding zstd [BUG] HTTP REST API hangs with Accept-Encoding zstd Feb 12, 2025
mmguero added a commit to mmguero-dev/Malcolm that referenced this issue Feb 12, 2025
…tp.compression: false` and things are working correctly, so I'm putting v2.19.0 back in

Revert "Revert "bump opensearch and dashboards to v2.19.0", as it seems to break arkime capture:"

This reverts commit 54472cf.
@reta
Copy link
Collaborator

reta commented Feb 13, 2025

I seems like OpenSearch never supported ZSTD compression (for HTTP), but 4.1.116 has a bunch of changes that may trigger this behavior (since OpenSearch has zstd-jni on the classpath).

[1] netty/netty#14466
[2] netty/netty#14519

@reta reta removed the untriaged label Feb 13, 2025
@reta reta self-assigned this Feb 13, 2025
@reta reta added v3.0.0 Issues and PRs related to version 3.0.0 v2.19.0 Issues and PRs related to version 2.19.0 v2.19.1 Issues and PRs related to version 2.19.1 and removed v2.19.0 Issues and PRs related to version 2.19.0 labels Feb 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Other v2.19.1 Issues and PRs related to version 2.19.1 v3.0.0 Issues and PRs related to version 3.0.0
Projects
None yet
Development

No branches or pull requests

2 participants