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

Zlib decompression errors are not caught in case of failure responses #363

Closed
adamdobos-seon opened this issue Dec 4, 2024 · 0 comments · Fixed by #366
Closed

Zlib decompression errors are not caught in case of failure responses #363

adamdobos-seon opened this issue Dec 4, 2024 · 0 comments · Fixed by #366
Labels
bug Something isn't working

Comments

@adamdobos-seon
Copy link

Describe the bug

When response decompression is enabled malformed clickhouse failure responses will throw an unhandled promise rejection which cannot be caught on the application side by wrapping the query function in error handling logic.

Steps to reproduce

  1. Enable response decompression
  2. Somehow make the ClickHouse server respond with failure responses that are malformed. I could reproduce this by creating a high load on the server.
  3. If the failure response stream is not valid gzip it will throw when processing it in the onResponse callback:
  4. If there isn't a global unhandledRejection event handler registered it will make the node process exit with an error.

Expected behaviour

An error in failure response parsing should be propagated to the user instead.

Error log

node:internal/process/promises:394
    triggerUncaughtException(err, true /* fromPromise */);
    ^
Error: incorrect header check
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at Zlib.zlibOnError [as onerror] (node:zlib:185:17) {
  errno: -3,
  code: 'Z_DATA_ERROR'
}
Node.js v22.11.0

Configuration

Environment

  • Client version: 1.7.0
  • Language version: Node 22.11.0
  • OS: Linux

ClickHouse server

  • ClickHouse Server version: 24.8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant