heavyai / heavydb

HeavyDB (formerly OmniSciDB)
https://heavy.ai
Apache License 2.0
2.96k stars 448 forks source link

[Crash Bug] Insert Values after Create Table With ( page_size = value (too small or large) ) cause Crash #795

Open qwebug opened 1 year ago

qwebug commented 1 year ago

Describe:

HeavyDB will crash when insert values after create table with too small or large pagesize, after SET EXECUTOR_DEVICE='GPU'.

It is worth mentioning that no error report when create table with too small or large pagesize.

SQL:

ALTER SESSION SET EXECUTOR_DEVICE='GPU';
CREATE TABLE t1(c0 int) WITH (page_size=20); 
INSERT INTO t1(c0) VALUES(1);

Result:

2023-08-31T08:26:35.743983 F 1460 18 2 FileBuffer.cpp:50 Check failed: pageSize_ > reservedHeaderSize_ (20 > 32)
Stack trace:
std::__cxx11::basic_string
File_Namespace::FileBuffer::FileBuffer
File_Namespace::FileMgr::createBufferUnlocked
File_Namespace::FileMgr::createBuffer
Data_Namespace::DataMgr::createChunkBuffer
Chunk_NS::Chunk::createChunkBuffer
Fragmenter_Namespace::InsertOrderFragmenter::createNewFragment
Fragmenter_Namespace::InsertOrderFragmenter::insertDataImpl
Fragmenter_Namespace::InsertOrderFragmenter::insertDataNoCheckpoint
Fragmenter_Namespace::InsertDataLoader::insertData
RelAlgExecutor::executeSimpleInsert
Parser::InsertValuesStmt::execute
DBHandler::sql_execute_impl
DBHandler::sql_execute_local
DBHandler::sql_execute
HeavyProcessor::process_sql_execute
HeavyProcessor::dispatchCall
TrackingProcessor::process
apache::thrift::server::TConnectedClient::run
apache::thrift::server::TThreadedServer::TConnectedClientRunner::run
apache::thrift::concurrency::Thread::threadMain
void std::__invoke_impl
std::__invoke_result
void std::thread::_Invoker
std::thread::_Invoker
std::thread::_State_impl
clone
/opt/heavyai/scripts/innerstartheavy: line 180:  1460 Aborted                 (core dumped) ./bin/heavydb $MAPD_DATA $RO --port $MAPD_TCP_PORT --http-port $MAPD_HTTP_PORT --calcite-port $MAPD_CALCITE_PORT $CONFIG $VERBOSE $*
Failed to write to log, write storage/log/heavy_web_server.84a687ddbe10.root.log.ALL.20230831-082529.1461: file already closed
startheavy 1449 exited

SQL:

ALTER SESSION SET EXECUTOR_DEVICE='GPU';
CREATE TABLE t1(c0 INT) WITH (page_size=5441381524733052600); 
INSERT INTO t1(c0) VALUES(1);

Result:

2023-08-31T08:33:55.148154 F 2248 24 2 File.cpp:74 Error trying to create file 'storage/data/table_1_9/0.18446744072721155768.data', file size 1 does not equal pageSize * numPages 18446743820680214528
[2023-08-31 08:33:56.349176] [0x00007fe3bcff9000] [info]    25 4 DBHandler.cpp:7986 stdlog get_license_claims 25 21     
[2023-08-31 08:33:56.422569] [0x00007fe3a6ffd000] [info]    26 5 DBHandler.cpp:934 stdlog_begin connect 26 0     
[2023-08-31 08:33:56.730517] [0x00007fe3a6ffd000] [info]    26 5 DBHandler.cpp:980 User admin connected to database heavyai
[2023-08-31 08:33:56.730554] [0x00007fe3a6ffd000] [info]    26 5 DBHandler.cpp:934 stdlog connect 26 308 heavyai admin 356-PMdU {"client","roles"} {"http:localhost:41314","super"}
[2023-08-31 08:33:56.779125] [0x00007fe3a6ffd000] [info]    27 5 DBHandler.cpp:1275 stdlog get_session_info 27 0 heavyai admin 356-PMdU {"client"} {"http:localhost:41314"}
[2023-08-31 08:33:56.920217] [0x00007fe3a6ffd000] [info]    28 5 DBHandler.cpp:1275 stdlog get_session_info 28 0 heavyai admin 356-PMdU {"client"} {"http:localhost:41314"}
[2023-08-31 08:33:56.984323] [0x00007fe3a6ffd000] [info]    29 5 DBHandler.cpp:1275 stdlog get_session_info 29 0 heavyai admin 356-PMdU {"client"} {"http:172.17.0.1"}
[2023-08-31 08:33:57.013509] [0x00007fe3a6ffd000] [info]    30 5 DBHandler.cpp:1182 stdlog get_status 30 0 heavyai admin 356-PMdU {"client"} {"http:172.17.0.1"}
[2023-08-31 08:33:57.098269] [0x00007fe3a6ffd000] [info]    31 5 DBHandler.cpp:1230 stdlog get_hardware_info 31 0 heavyai admin 356-PMdU {"client"} {"http:172.17.0.1"}
/opt/heavyai/scripts/innerstartheavy: line 180:  2248 Aborted                 (core dumped) ./bin/heavydb $MAPD_DATA $RO --port $MAPD_TCP_PORT --http-port $MAPD_HTTP_PORT --calcite-port $MAPD_CALCITE_PORT $CONFIG $VERBOSE $*
Failed to write to log, write storage/log/heavy_web_server.84a687ddbe10.root.log.ALL.20230831-083200.2249: file already closed
startheavy 2237 exited

Environment:

Docker Deployment

https://hub.docker.com/layers/heavyai/heavyai-ee-cuda/latest/images/sha256-5af3ad3a00cbc5ce09c299b8b81cda96521a27373dbb1e59209c02358cfd9b1f?context=explore

Docker DIGEST: sha256:5af3ad3a00cbc5ce09c299b8b81cda96521a27373dbb1e59209c02358cfd9b1f

HeavyDB Version: 7.1.0-20230821-eae9ec17da

HeavyDB license: Free Edition

cdessanti commented 1 year ago

Hello @qwebug,

Thank you for bringing this issue to our attention. We will work on enhancing the validation of these parameter values.

Best regards, Candido

qwebug commented 5 months ago

This problem came up at HeavyDB Version: 7.1.0-20230821-eae9ec17da (Docker: https://hub.docker.com/layers/heavyai/heavyai-ee-cuda/v7.1.0/images/sha256-5af3ad3a00cbc5ce09c299b8b81cda96521a27373dbb1e59209c02358cfd9b1f?context=explore ) . And it has been fixed at HeavyDB Version: 7.2.6 (Docker: https://hub.docker.com/layers/heavyai/heavyai-ee-cuda/v7.2.6/images/sha256-d67d20fc9cf50437169cecce8a0180200418ba732ce25f2a05094eac776560be?context=explore), after my verification. Thanks to the developers for their contributions.

Carmelo006 commented 3 weeks ago

Hi @qwebug, Thanks for your report. I'm certain this issue has been fixed at newer HeavyDB Version: 7.1.2 (Docker: https://hub.docker.com/layers/heavyai/heavyai-ee-cuda/v7.1.2/images/sha256-bfc96df7e0a4739bf4405ea726dd7906c72d303ed1b1b8f46cf32b7926a6632f?context=explore).