Zlib decompression errors are not caught in case of failure responses
Closed this issue · 0 comments
adamdobos-seon commented
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
- Enable response decompression
- Somehow make the ClickHouse server respond with failure responses that are malformed. I could reproduce this by creating a high load on the server.
- If the failure response stream is not valid gzip it will throw when processing it in the onResponse callback:
- 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