Issue 135943
Summary UBSAN is very slow when using print_stacktrace=1
Labels new issue
Assignees
Reporter mariadb-RoelVandePaar
    We are seeing on average a 100x slowdown in SQL queries-per-second when using UBSAN's `print_stacktrace=1` on UB+ASAN MariaDB builds.

For example, when using this SQL in the `mariadb` CLI on MariaDB server 10.5 or 10.6

```
INSTALL SONAME 'ha_rocksdb';
CREATE TABLE T8 (C1 char(5),INDEX(C1)) DEFAULT CHARSET = utf8 ENGINE=RocksDB COMMENT='abcde';
```

The second query will take about 90 seconds with `print_stacktrace=1` in `UBSAN_OPTIONS` and about 4-5 seconds without. 

On generic testruns we measure how many queries are executed within a given timeframe, for example 30 seconds, and we are seeing that with `print_stacktrace=1` the number of queries executed is about 1/100th of the amount of queries without `print_stacktrace=1` while using a wide variety of queries.

The overhead of `print_stacktrace=1` thus seems to be about 100x slowdown, at least when it comes to MariaDB testing.

Compiler: Clang 18.1.3 (1), LLVM 18. Build: ASAN+UBSAN

Settings made:
```
export UBSAN_OPTIONS=suppressions=/home/roel/mariadb-qa/UBSAN.filter:print_stacktrace=1:report_error_type=1
export ASAN_OPTIONS=suppressions=${HOME}/mariadb-qa/ASAN.filter:quarantine_size_mb=512:atexit=0:detect_invalid_pointer_pairs=3:dump_instruction_bytes=1:abort_on_error=1:allocator_may_return_null=1
```

ulimits (if relevant):
```
$ ulimit -a
real-time non-blocking time  (microseconds, -R) unlimited
core file size              (blocks, -c) unlimited
data seg size               (kbytes, -d) unlimited
scheduling priority                 (-e) 0
file size                   (blocks, -f) unlimited
pending signals                     (-i) unlimited
max locked memory           (kbytes, -l) unlimited
max memory size             (kbytes, -m) unlimited
open files                          (-n) 1048576
pipe size                (512 bytes, -p) 8
POSIX message queues         (bytes, -q) unlimited
real-time priority                  (-r) 0
stack size                  (kbytes, -s) 400000
cpu time                   (seconds, -t) unlimited
max user processes                  (-u) unlimited
virtual memory              (kbytes, -v) unlimited
file locks                          (-x) unlimited
```

Please let me know if there is any fix / solution or workaround, as full stacks are required.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to