Skip to content

<Fatal> BaseDaemon exceptions cascade + dropped connection from client on wrong query #95581

@janw-fortum

Description

@janw-fortum

Company or project name

my query was:

select raw_message from messages_parsed where operation='MeterValues' and payload.meterValue[1].sampledValue.context != 'Sample.Clock' limit 10;

parsed as:

SELECT raw_message
FROM messages_parsed
WHERE (operation = 'MeterValues') AND (tupleElement(tupleElement(payload.meterValue[1], 'sampledValue'), 'context') != 'Sample.Clock')
LIMIT 10

the problem is sampledValue is json array, not an object. This resulted ina cascade of exception, dropping connection from cli client and temporary (few seconds) inability to reconnect

payload is of type JSON.

Describe what's wrong

I don't suspect an incorrect select query should cause fatal errors and closing client connection.

Does it reproduce on the most recent release?

Yes

How to reproduce

not sure but I think it's an issue with error-handling missing attributes in JSON types by Clickhouse, so create table with column of type JSON, populate with value like:

{
  "foo": [
    {
      "bar": [
        {
          "bazz": 1,
          "buzz": 2
        },
        {
          "bazz": 0,
          "buzz": 0.5
        }
      ]
    }
  ]
}

and try to access foo[1].bar.bazz when legal path is: foo[1].bar[1].bazz with select query, (put: foo[1].bar.bazz in WHERE clause)

but this could not be specific to JSON columns only, maybe it's an issue with other nested structures as well I didn't test that.

Expected behavior

receive exception analogous to:

Received exception from server (version 25.12.4):
Code: 47. DB::Exception: Received from <hostname>:9000. DB::Exception: Unknown expression or function identifier `operationn` in scope SELECT * FROM messages_parsed WHERE operationn = 'MeterValues' LIMIT 10. Maybe you meant: ['operation']. (UNKNOWN_IDENTIFIER)

Error message and/or stacktrace

attached logs as printed to my terminal

log.txt

Additional context

No response

Metadata

Metadata

Assignees

Labels

jsonIssues and pull-requests related to the new JSON data typepotential bugTo be reviewed by developers and confirmed/rejected.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions