Bug #114240 LeakSanitizer has encountered a fatal error
Submitted: 6 Mar 2024 8:12 Modified: 6 Mar 2024 14:54
Reporter: John Jove Email Updates:
Status: Can't repeat Impact on me:
None 
Category:MySQL Server: Compiling Severity:S3 (Non-critical)
Version: OS:Any
Assigned to: CPU Architecture:Any

[6 Mar 2024 8:12] John Jove
Description:
I try to compile the trunk version of MySQL server.
I run the following command.

The following error output.
```
-- AWK_EXECUTABLE is /usr/bin/awk
-- Found Git: /usr/bin/git
-- LIBEVENT_VERSION (bundled) ==52622
-- LIBEVENT_INCLUDE_DIRS /root/mysql-server/extra/libevent/libevent-2.1.11-stable/include;/root/mysql-server/extra/libevent/libevent-2.1.11-stable/include
-- LIBEVENT_LIBRARIES event_core;event_extra;event_openssl;event_pthreads
CMake Error at cmake/libevent.cmake:180 (MESSAGE):
  LIBEVENT version must be at least 2.1, found ==52622.

  Please use -DWITH_LIBEVENT=bundled
Call Stack (most recent call first):
  CMakeLists.txt:1900 (MYSQL_CHECK_LIBEVENT)
```

I then uncomment the cmake/libevent.cmake: 84-87. And get the following error.
```

-- TRY_EVENT RUN_OUTPUT_VARIABLE is ==52648==LeakSanitizer has encountered a fatal error.
==52648==HINT: For debugging, try setting environment variable LSAN_OPTIONS=verbosity=1:log_threads=1
==52648==HINT: LeakSanitizer does not work under ptrace (strace, gdb, etc)

-- LIBEVENT_VERSION (bundled) ==52648
-- LIBEVENT_INCLUDE_DIRS /root/mysql-server/extra/libevent/libevent-2.1.11-stable/include;/root/mysql-server/extra/libevent/libevent-2.1.11-stable/include
-- LIBEVENT_LIBRARIES event_core;event_extra;event_openssl;event_pthreads
CMake Error at cmake/libevent.cmake:180 (MESSAGE):
  LIBEVENT version must be at least 2.1, found ==52648.

  Please use -DWITH_LIBEVENT=bundled
Call Stack (most recent call first):
  CMakeLists.txt:1900 (MYSQL_CHECK_LIBEVENT)
```

How to repeat:
```bash
# pull image
docker pull ubuntu:22.04
# create container

# enter container
docker exec -it ubuntu-mysql bash
# $
apt update
apt upgrade
apt install -y vim
apt install -y git
apt install -y build-essential
apt install -y cmake
apt install -y libncurses-dev
apt install -y bison
apt install -y libssl-dev
apt install -y pkg-config
git clone https://github.com/mysql/mysql-server.git
cd mysql-server
cmake . -DWITH_ASAN=ON -DWITH_LIBEVENT=bundled
# uncomment in cmake/libevent:84-87
cmake . -DWITH_ASAN=ON -DWITH_LIBEVENT=bundled -- LeakSanitizer has encountered a fatal error
```
[6 Mar 2024 11:38] MySQL Verification Team
Hi Mr. Jove,

Thank you for your bug report.

However, we cannot repeat what you are reporting.

First of all, we do not accept here bug reports on the trunk version of MySQL. We would gladly accept your bug report on 8.0.36.

Next,  you should provide us with the versions of all the software that is necessary for building from the source, including the compiler, it's version and versions of all libraries used.

Next, your command line for cmake is absolutely wrong. A correct cmake command line has dozens of settings in order to make a proper binary.

Last, but not least, let us inform you that we have recieved a number of bug reports on building MySQL with sanitiser options and we were able to precisely determine whether it is a bug or not. Regarding the instructions for building, our Manual has information which we deem sufficient for the users.

Can't repeat.
[6 Mar 2024 11:40] MySQL Verification Team
Hi,

One more comment.

We do not see from your report which test failed when ran with sanitiser built binary.

From what you report it seems more that your compilation is failing, which means that you have not provided the correct options to cmake or are using versions of libraries that we do not support.
[6 Mar 2024 11:55] John Jove
Thank you for your reply. I am going to carefully read the user manual and focus on 8.0.36.
[6 Mar 2024 11:56] MySQL Verification Team
Thank you Mr. Jove and good luck !!!!!
[6 Mar 2024 12:28] Tor Didriksen
First of all: never do an in-source build. Create a build directory, cd into it, and do 'cmake <path to source>'

It seems ASAN encountered some problem during feature testing for libevent.
You should be able to see compiler logs in CMakeFiles/CMakeError.log and/or
CMakeFiles/CMakeOutput.log
[6 Mar 2024 14:54] John Jove
Thanks a lot for your explanation!
[6 Mar 2024 15:02] MySQL Verification Team
You are truly welcome .....

You can also view our Changelogs (not all, probably 10 of the last ones) as there you can find library versions that we are using .......

You can also use CMake GUI, because it can also be configured to use ASAN or gprof or what ever it is that you need .....