stoneatom / stonedb

StoneDB is an Open-Source MySQL HTAP and MySQL-Native DataBase for OLTP, Real-Time Analytics, a counterpart of MySQLHeatWave. (https://stonedb.io)
https://stonedb.io/
GNU General Public License v2.0
862 stars 139 forks source link

bug: mysqld --initialize-insecure crash unexpectedly #1793

Open zhouji1993 opened 1 year ago

zhouji1993 commented 1 year ago

Have you read the Contributing Guidelines on issues?

Please confirm if bug report does NOT exists already ?

Describe the problem

my.cnf 配置如下: ` [root@db-monitor-16-61 install8]# cat my.cnf [client] port = 3307 socket = /data/stone/stonedb/build/install8/tmp/mysql.sock

[mysqld] port = 3307 basedir = /data/stone/stonedb/build/install8/ character-sets-dir = /data/stone/stonedb/build/install8/share/charsets/ plugin_dir = /data/stone/stonedb/build/install8/lib/plugin/ tmpdir = /data/stone/stonedb/build/install8/tmp/ socket = /data/stone/stonedb/build/install8/tmp/mysql.sock datadir = /data/stone/stonedb/build/install8/data/ pid-file = /data/stone/stonedb/build/install8/data/mysqld.pid log-error = /data/stone/stonedb/build/install8/log/mysqld.log lc-messages-dir = /data/stone/stonedb/build/install8/share/ lc_messages = en_US local-infile

character-set-server = utf8mb4 collation-server = utf8mb4_general_ci init_connect='SET NAMES utf8mb4'

log-basename = mysqld

debug-no-sync

Retry bind as this may fail on busy server

port-open-timeout = 10

plugin-load-add = ha_connect.so

max_connections = 100

explicit_defaults_for_timestamp = true sql_mode='STRICT_TRANS_TABLES,NO_ENGINE_SUBSTITUTION' tmp_table_size = 1024M

back_log = 130

query_cache_size = 218M

query_cache_type = 0

concurrent_insert = 2

deadlock_search_depth_short = 3

deadlock_search_depth_long = 10

deadlock_timeout_long = 10000000

deadlock_timeout_short = 5000

slow-query-log = 1 slow_query_log_file = /data/stone/stonedb/build/install8/log/slow.log

binlog config

long_query_time = 5 max_binlog_size = 1024M sync_binlog = 0 log-bin = /data/stone/stonedb/build/install8/binlog/binlog binlog_expire_logs_seconds = 86400

log_bin_compress = 1

log_bin_compress_min_len = 256

binlog_format = statement binlog_cache_size = 524288

wait_timeout = 3600 interactive_timeout = 3600 connect_timeout = 360 net_read_timeout = 360 net_write_timeout = 360 lock_wait_timeout = 120 replica_net_timeout = 120

skip-external-locking

loose-key_buffer_size = 512M max_allowed_packet = 512M loose-sort_buffer_size = 4M loose-read_buffer_size = 4M loose-read_rnd_buffer_size = 16M loose-thread_cache_size = 8 loose-query_cache_size = 0

Try number of CPU's*2 for thread_concurrency

thread_concurrency = 8

thread_stack = 512K lower_case_table_names = 0 group_concat_max_len = 512

open_files_limit = 65535 server-id = 1

Uncomment the following if you are using innodb tables

loose-innodb_data_home_dir = /data/stone/stonedb/build/install8/data/ loose-innodb_data_file_path = ibdata1:2000M;ibdata2:10M:autoextend loose-innodb_buffer_pool_size = 512M loose-innodb_lru_scan_depth = 100 loose-innodb_write_io_threads = 2 loose-innodb_read_io_threads = 2 loose-innodb_log_buffer_size = 1M loose-innodb_log_file_size = 1024M loose-innodb_log_files_in_group = 2 loose-innodb_log_group_home_dir = /data/stone/stonedb/build/install8/redolog/ loose-innodb-stats-persistent = OFF loose-innodb_lock_wait_timeout = 50 loose-innodb_flush_method = O_DIRECT loose-innodb_io_capacity = 500 loose-innodb_buffer_pool_dump_pct = 40 loose-innodb_print_all_deadlocks = 1 loose-innodb_undo_directory = /data/stone/stonedb/build/install8/undolog/ loose-innodb_undo_log_truncate = 1 loose-innodb_undo_tablespaces = 3 loose-innodb_undo_logs = 128

MAINTAINER:

the loose- syntax is to make sure the cnf file is also

valid when building without the performance schema.

Run tests with the performance schema instrumentation

loose-enable-performance-schema

Run tests with a small number of instrumented objects

to limit memory consumption with MTR

loose-performance-schema-accounts-size = 100 loose-performance-schema-digests-size = 200 loose-performance-schema-hosts-size = 100 loose-performance-schema-users-size = 100 loose-performance-schema-max-mutex-instances = 5000 loose-performance-schema-max-rwlock-instances = 5000 loose-performance-schema-max-cond-instances = 1000 loose-performance-schema-max-file-instances = 10000 loose-performance-schema-max-socket-instances = 1000 loose-performance-schema-max-table-instances = 500 loose-performance-schema-max-table-handles = 1000

loose-performance-schema-events-waits-history-size = 10 loose-performance-schema-events-waits-history-long-size = 10000 loose-performance-schema-events-stages-history-size = 10 loose-performance-schema-events-stages-history-long-size = 1000 loose-performance-schema-events-statements-history-size = 10 loose-performance-schema-events-statements-history-long-size = 1000 loose-performance-schema-max-thread-instances = 200 loose-performance-schema-session-connect-attrs-size = 2048

Enable everything, for maximun code exposure during testing

loose-performance-schema-instrument = '%=ON'

loose-performance-schema-consumer-events-stages-current = ON loose-performance-schema-consumer-events-stages-history = ON loose-performance-schema-consumer-events-stages-history-long = ON loose-performance-schema-consumer-events-statements-current = ON loose-performance-schema-consumer-events-statements-history = ON loose-performance-schema-consumer-events-statements-history-long = ON loose-performance-schema-consumer-events-waits-current = ON loose-performance-schema-consumer-events-waits-history = ON loose-performance-schema-consumer-events-waits-history-long = ON loose-performance-schema-consumer-global-instrumentation = ON loose-performance-schema-consumer-thread-instrumentation = ON

binlog-direct-non-transactional-updates

default-storage-engine=tianmu

use_stat_tables=preferably

here, at the end of [mysqld] group mtr will automatically disable

all optional plugins.

[embedded]

mtr automatically adds [embedded] group at the end and copies [mysqld]

and [mysqld.1] groups into it.

but we want [server] group to be after [mysqld] (and its copies).

create a non-empty [embedded] group here, to force it before [server]

local-infile

[server]

Aria is optional, but it must be enabled if it's used for temporary

tables. Let's enable it in the [server] group, because this group

is read after [mysqld] and [embedded]

loose-loog

[connection] default-character-set = utf8mb4

[mysqldump] quick max_allowed_packet = 512M

[mysql] no-auto-rehash

Remove the next comment character if you are not familiar with SQL

safe-updates

[isamchk] key_buffer_size = 256M sort_buffer_size = 256M read_buffer = 2M write_buffer = 2M

[mysqlhotcopy] interactive-timeout `

[root@db-monitor-16-61 install8]# gcc -v Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-11/root/usr/libexec/gcc/x86_64-redhat-linux/11/lto-wrapper Target: x86_64-redhat-linux Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/opt/rh/devtoolset-11/root/usr --mandir=/opt/rh/devtoolset-11/root/usr/share/man --infodir=/opt/rh/devtoolset-11/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --with-default-libstdcxx-abi=gcc4-compatible --enable-plugin --enable-initfini-array --with-isl=/builddir/build/BUILD/gcc-11.2.1-20220127/obj-x86_64-redhat-linux/isl-install --enable-gnu-indirect-function --with-tune=generic --with-arch_32=x86-64 --build=x86_64-redhat-linux Thread model: posix Supported LTO compression algorithms: zlib gcc version 11.2.1 20220127 (Red Hat 11.2.1-9) (GCC) 系统版本 3.10.0-1160.90.1.el7.x86_64

Expected behavior

在执行/stonedb/build/install8/bin/mysqld --defaults-file=./my.cnf --initialize-insecure时候, 在日志中展示: `2023-05-18T07:59:41.154176Z 0 [Warning] [MY-010915] [Server] 'NO_ZERO_DATE', 'NO_ZERO_IN_DATE' and 'ERROR_FOR_DIVISION_BY_ZERO' sql modes should be used with strict mode. They will be merged with strict mode in a future release. 2023-05-18T07:59:41.154406Z 0 [System] [MY-013169] [Server] /stonedb/build/install8/bin/mysqld (mysqld 8.0.30-debug) initializing of server in progress as process 511261 2023-05-18T07:59:41.154532Z 0 [ERROR] [MY-010338] [Server] Can't find error-message file '/data/stone/stonedb/build/install8/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive. 2023-05-18T07:59:41.244068Z 0 [Warning] [MY-013267] [InnoDB] The setting INNODB_UNDO_TABLESPACES is deprecated and is no longer used. InnoDB always creates 2 undo tablespaces to start with. If you need more, please use CREATE UNDO TABLESPACE. 2023-05-18T07:59:41.244166Z 0 [Warning] [MY-013907] [InnoDB] Deprecated configuration parameters innodb_log_file_size and/or innodb_log_files_in_group have been used to compute innodb_redo_log_capacity=2147483648. Please use innodb_redo_log_capacity instead. 2023-05-18T07:59:41.250443Z 1 [System] [MY-013576] [InnoDB] InnoDB initialization has started. 2023-05-18T07:59:47.894696Z 1 [System] [MY-013577] [InnoDB] InnoDB initialization has ended. 07:59:53 UTC - mysqld got signal 11 ; Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware. Thread pointer: 0xa37c630 Attempting backtrace. You can use the following information to find out where mysqld died. If you see no messages after this, something went terribly wrong... stack_bottom = 7fff741bdc40 thread_stack 0x80000 /stonedb/build/install8/bin/mysqld(my_print_stacktrace(unsigned char const, unsigned long)+0x43) [0x50e56da] /stonedb/build/install8/bin/mysqld(print_fatal_signal(int)+0x280) [0x3d0c421] /stonedb/build/install8/bin/mysqld(handle_fatal_signal+0x75) [0x3d0c624] /lib64/libpthread.so.0(+0xf630) [0x7f78fe302630] /stonedb/build/install8/bin/mysqld(std::_Hashtable<std::string, std::pair<std::string const, std::string>, std::allocator<std::pair<std::string const, std::string> >, std::detail::_Select1st, std::equal_to, std::hash, std::detail::_Mod_range_hashing, std::detail::_Default_ranged_hash, std::__detail::_Prime_rehash_policy, std::detail::_Hashtable_traits<true, false, true> >::_M_find_before_node(unsigned long, std::string const&, unsigned long) const+0x2a) [0x5115870] /usr/local/stonedb-gcc-rocksdb/librocksdb.so.6(rocksdb::RocksDBOptionsParser::VerifyCFOptions(rocksdb::ConfigOptions const&, rocksdb::ColumnFamilyOptions const&, rocksdb::ColumnFamilyOptions const&, std::unordered_map<std::string, std::string, std::hash, std::equal_to, std::allocator<std::pair<std::string const, std::string> > > const)+0x2ef) [0x7f78fd8040cf] /usr/local/stonedb-gcc-rocksdb/librocksdb.so.6(rocksdb::RocksDBOptionsParser::VerifyRocksDBOptionsFromFile(rocksdb::ConfigOptions const&, rocksdb::DBOptions const&, std::vector<std::string, std::allocator > const&, std::vector<rocksdb::ColumnFamilyOptions, std::allocator > const&, std::string const&, rocksdb::FileSystem)+0x776) [0x7f78fd8049d6] /usr/local/stonedb-gcc-rocksdb/librocksdb.so.6(rocksdb::PersistRocksDBOptions(rocksdb::ConfigOptions const&, rocksdb::DBOptions const&, std::vector<std::string, std::allocator > const&, std::vector<rocksdb::ColumnFamilyOptions, std::allocator > const&, std::string const&, rocksdb::FileSystem)+0x13fb) [0x7f78fd805f5b] /usr/local/stonedb-gcc-rocksdb/librocksdb.so.6(rocksdb::PersistRocksDBOptions(rocksdb::DBOptions const&, std::vector<std::string, std::allocator > const&, std::vector<rocksdb::ColumnFamilyOptions, std::allocator > const&, std::string const&, rocksdb::FileSystem)+0xb0) [0x7f78fd806660] /usr/local/stonedb-gcc-rocksdb/librocksdb.so.6(rocksdb::DBImpl::WriteOptionsFile(bool, bool)+0x95c) [0x7f78fd67fa0c] /usr/local/stonedb-gcc-rocksdb/librocksdb.so.6(rocksdb::DBImpl::Open(rocksdb::DBOptions const&, std::string const&, std::vector<rocksdb::ColumnFamilyDescriptor, std::allocator > const&, std::vector<rocksdb::ColumnFamilyHandle, std::allocator<rocksdb::ColumnFamilyHandle> >, rocksdb::DB, bool, bool)+0x169a) [0x7f78fd6d698a] /usr/local/stonedb-gcc-rocksdb/librocksdb.so.6(rocksdb::TransactionDB::Open(rocksdb::DBOptions const&, rocksdb::TransactionDBOptions const&, std::string const&, std::vector<rocksdb::ColumnFamilyDescriptor, std::allocator > const&, std::vector<rocksdb::ColumnFamilyHandle, std::allocator<rocksdb::ColumnFamilyHandle> >*, rocksdb::TransactionDB*)+0x808) [0x7f78fd955618] /stonedb/build/install8/bin/mysqld(Tianmu::index::KVStore::Init()+0x548) [0x5b21f76] /stonedb/build/install8/bin/mysqld(Tianmu::handler::tianmu_init_func(void)+0x430) [0x5ad4c11] /stonedb/build/install8/bin/mysqld(ha_initialize_handlerton(st_plugin_int)+0x1a1) [0x3e9d608] /stonedb/build/install8/bin/mysqld() [0x3b11b4e] /stonedb/build/install8/bin/mysqld() [0x3b122c8] /stonedb/build/install8/bin/mysqld(plugin_register_dynamic_and_init_all(int, char, int)+0x282) [0x3b13382] /stonedb/build/install8/bin/mysqld() [0x392a942] /stonedb/build/install8/bin/mysqld(mysqld_main(int, char**)+0x1801) [0x392e87c] /stonedb/build/install8/bin/mysqld(main+0x20) [0x391bea6] /lib64/libc.so.6(__libc_start_main+0xf5) [0x7f78fb982555] /stonedb/build/install8/bin/mysqld() [0x391bdcb]

Trying to get some variables. Some pointers may be invalid and cause the dump to abort. Query (0): Connection ID (thread ID): 0 Status: NOT_KILLED

The manual page at http://dev.mysql.com/doc/mysql/en/crashing.html contains information that should help you find out what is causing the crash.`

How To Reproduce

centos7上编译8.0后,初始化的时候产生的问题

Environment

centos7.9 stone 8.0

Are you interested in submitting a PR to solve the problem?

hustjieke commented 1 year ago

Is your lc-messages-dir correct?

2023-05-18T07:59:41.154532Z 0 [ERROR] [MY-010338] [Server] Can't find error-message file '/data/stone/stonedb/build/install8/share/errmsg.sys'. Check error-message file location and 'lc-messages-dir' configuration directive.
zhouji1993 commented 1 year ago

我使用配置是

lc-messages-dir                 = /data/stone/stonedb/build/install8/share/
lc-messages                     = en_US

但是在查看的时候这个文件是没有的。

hustjieke commented 1 year ago

Can you find these errmsg.sys?

root@dev-stonedb-debug01:/github/stonedb/build/install8# find . -name errmsg.sys
./share/czech/errmsg.sys
./share/japanese/errmsg.sys
./share/bulgarian/errmsg.sys
./share/spanish/errmsg.sys
./share/estonian/errmsg.sys
./share/dutch/errmsg.sys
./share/german/errmsg.sys
./share/portuguese/errmsg.sys
./share/slovak/errmsg.sys
./share/italian/errmsg.sys
./share/swedish/errmsg.sys
./share/russian/errmsg.sys
./share/norwegian-ny/errmsg.sys
./share/danish/errmsg.sys
./share/romanian/errmsg.sys
./share/serbian/errmsg.sys
./share/norwegian/errmsg.sys
./share/korean/errmsg.sys
./share/hungarian/errmsg.sys
./share/english/errmsg.sys
./share/polish/errmsg.sys
./share/greek/errmsg.sys
./share/french/errmsg.sys
./share/ukrainian/errmsg.sys

我使用配置是

lc-messages-dir                 = /data/stone/stonedb/build/install8/share/
lc-messages                     = en_US

但是在查看的时候这个文件是没有的。

zhouji1993 commented 1 year ago

/stonedb/build/install8/share 这个下面有

zhouji1993 commented 1 year ago

我重新配置了下,初始化的日志。见附件。 mysqld.log