2020-09-20 13:28:19 +00:00
|
|
|
#!/usr/bin/env bash
|
2021-12-24 06:12:41 +00:00
|
|
|
# Tags: no-tsan, no-asan, no-msan, no-ubsan, no-fasttest
|
2021-12-17 18:29:01 +00:00
|
|
|
# ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
|
|
# NOTE: jemalloc is disabled under sanitizers
|
2020-09-20 13:28:19 +00:00
|
|
|
|
|
|
|
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
2020-12-28 11:46:53 +00:00
|
|
|
# shellcheck source=../shell_config.sh
|
2020-09-20 13:28:19 +00:00
|
|
|
. "$CURDIR"/../shell_config.sh
|
|
|
|
|
|
|
|
ncpus="$(getconf _NPROCESSORS_ONLN)"
|
|
|
|
|
2021-12-22 18:06:40 +00:00
|
|
|
# In debug build the following settings enabled by default:
|
|
|
|
# - abort_conf
|
|
|
|
# - abort
|
|
|
|
# Disable them explicitly (will enable when required).
|
|
|
|
export MALLOC_CONF=abort_conf:false,abort:false
|
2021-12-17 18:29:01 +00:00
|
|
|
|
2020-09-20 13:28:19 +00:00
|
|
|
# Regression for:
|
|
|
|
#
|
|
|
|
# $ taskset --cpu-list 8 ./clickhouse local -q 'select 1'
|
|
|
|
# <jemalloc>: ../contrib/jemalloc/src/jemalloc.c:321: Failed assertion: "ind <= narenas_total_get()"
|
|
|
|
# Aborted (core dumped)
|
|
|
|
taskset --cpu-list $((ncpus-1)) ${CLICKHOUSE_LOCAL} -q 'select 1'
|
|
|
|
# just in case something more complicated
|
|
|
|
taskset --cpu-list $((ncpus-1)) ${CLICKHOUSE_LOCAL} -q 'select * from numbers_mt(100000000) settings max_threads=100 FORMAT Null'
|
2021-12-17 18:29:01 +00:00
|
|
|
|
|
|
|
# this command should fail because percpu arena will be disabled,
|
|
|
|
# and with abort_conf:true it is not allowed
|
|
|
|
(
|
|
|
|
# subshell is required to suppress "Aborted" message from the shell.
|
2021-12-22 18:06:40 +00:00
|
|
|
MALLOC_CONF=abort_conf:true,abort:true
|
2021-12-17 18:29:01 +00:00
|
|
|
taskset --cpu-list $((ncpus-1)) ${CLICKHOUSE_LOCAL} -q 'select 1'
|
|
|
|
) |& grep -F 'Number of CPUs is not deterministic'
|
2021-12-22 07:43:05 +00:00
|
|
|
|
|
|
|
# this command should not fail because we specify narenas explicitly
|
|
|
|
# (even with abort_conf:true)
|
2021-12-22 18:06:40 +00:00
|
|
|
MALLOC_CONF=abort_conf:true,abort:false,narenas:$((ncpus)) taskset --cpu-list $((ncpus-1)) ${CLICKHOUSE_LOCAL} -q 'select 1' 2>&1
|