Clickhouse: Segfault crash on the invalid INSERT INTO SELECT query

Created on 17 Apr 2017  路  4Comments  路  Source: ClickHouse/ClickHouse

Reproducible on v1.1.54180 and v1.1.54214.

If you send more rows than needed in the INSERT INTO SELECT query, the server will crash.
i.e.:

CREATE TABLE test (date Date DEFAULT today(), x UInt64, y UInt64) ENGINE = MergeTree(date, (date, x, y), 8192);
INSERT INTO test (date, x) SELECT today() AS date, number AS x, toUInt64(0) AS y FROM system.numbers LIMIT 10;

The server log:

2017.04.17 14:21:58.753121 [ 4 ] <Trace> HTTPHandler-factory: HTTP Request for HTTPHandler-factory. Method: POST, Address: 127.0.0.1:55363, User-Agent: python-requests/2.13.0
2017.04.17 14:21:58.753155 [ 4 ] <Trace> HTTPHandler: Request URI: /?query=INSERT+INTO+test+%28date%2C+x%29+SELECT+today%28%29+AS+date%2C+number+AS+x%2C+toUInt64%280%29+AS+y+FROM+system.numbers+LIMIT+10&database=default&stacktrace=0&query_id=fa6ed99d-c67d-4f91-aa35-6b938f233551
2017.04.17 14:21:58.753329 [ 4 ] <Debug> executeQuery: (from 127.0.0.1:55363) INSERT INTO test (date, x) SELECT today() AS date, number AS x, toUInt64(0) AS y FROM system.numbers LIMIT 10
2017.04.17 14:21:58.753510 [ 4 ] <Trace> InterpreterSelectQuery: FetchColumns -> Complete
2017.04.17 14:21:58.753676 [ 6 ] <Error> BaseDaemon: ########################################
2017.04.17 14:21:58.753698 [ 6 ] <Error> BaseDaemon: (from thread 4) Received signal Segmentation fault: 11 (11).
2017.04.17 14:21:58.753703 [ 6 ] <Error> BaseDaemon: Address: NULL pointer.
2017.04.17 14:21:58.755684 [ 6 ] <Error> BaseDaemon: 1. 1   clickhouse-server                   0x0000000108318df0 _ZN2DB31NullableAdapterBlockInputStream12buildActionsERKNS_5BlockES3_ + 320
2017.04.17 14:21:58.755705 [ 6 ] <Error> BaseDaemon: 2. 2   clickhouse-server                   0x000000010938eca0 _ZN4Poco10ThreadImpl13runnableEntryEPv + 96
2017.04.17 14:21:58.755711 [ 6 ] <Error> BaseDaemon: 3. 3   libsystem_pthread.dylib             0x00007fff9640099d _pthread_body + 131
2017.04.17 14:21:58.755717 [ 6 ] <Error> BaseDaemon: 4. 4   libsystem_pthread.dylib             0x00007fff9640091a _pthread_body + 0
2017.04.17 14:21:58.755722 [ 6 ] <Error> BaseDaemon: 5. 5   libsystem_pthread.dylib             0x00007fff963fe351 thread_start + 13
[1]    44295 segmentation fault

It'd be better to throw an exception, perhaps?

Most helpful comment

Confirmed, will fix.

All 4 comments

Confirmed, will fix.

And if you provide less columns, than declared to be inserted - it executes it w/o error (should be exception):

:) insert into test(id,date) select number from system.numbers limit 10;

INSERT INTO test (id, date) SELECT number
FROM system.numbers 
LIMIT 10

Ok.

This crash was fixed long time ago.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

bseng picture bseng  路  3Comments

healiseu picture healiseu  路  3Comments

derekperkins picture derekperkins  路  3Comments

jangorecki picture jangorecki  路  3Comments

vixa2012 picture vixa2012  路  3Comments