Bug #105423 main.mysql_config_editor testcase failed in the arm architecture
Submitted: 2 Nov 2021 13:41 Modified: 9 Nov 2021 10:31
Reporter: zhe chen Email Updates:
Status: Verified Impact on me:
None 
Category:Tools: MTR / mysql-test-run Severity:S7 (Test Cases)
Version:8.0.27 OS:Linux
Assigned to: CPU Architecture:ARM

[2 Nov 2021 13:41] zhe chen
Description:
[root@184004866c7e mysql-test]# cat /proc/version
Linux version 4.19.36-vhulk1907.1.0.h748.eulerosv2r8.aarch64 (abuild@szxrtosci10000) (gcc version 7.3.0 (GCC)) #1 SMP Thu May 14 16:41:16 UTC 2020

[root@184004866c7e mysql-test]# ./mtr main.mysql_config_editor
Logging: /mysql-server/mysql-test/mysql-test-run.pl  main.mysql_config_editor
MySQL Version 8.0.27
Checking supported features
 - Binaries are debug compiled
Using 'all' suites
Collecting tests
Removing old var directory
Creating var directory '/mysql-server/debug/mysql-test/var'
Installing system database
Using parallel: 1

==============================================================================
                  TEST NAME                       RESULT  TIME (ms) COMMENT
------------------------------------------------------------------------------
worker[1] mysql-test-run: WARNING: running this script as _root_ will cause some tests to be skipped
[ 50%] main.mysql_config_editor                  [ fail ]
        Test ended at 2021-11-02 21:15:51

CURRENT_TEST: main.mysql_config_editor
sh: line 1: 25391 Segmentation fault      (core dumped) /mysql-server/debug/runtime_output_directory//mysqladmin --no-defaults -S /mysql-server/debug/mysql-test/var/tmp/mysqld.1.sock -P 13000 -uroot ping 2> /dev/null
mysqltest: At line 188: Command "$MYSQLADMIN --no-defaults -S $MASTER_MYSOCK -P $MASTER_MYPORT -uroot ping 2> /dev/null" failed.

Output from before failure:
exec of '/mysql-server/debug/runtime_output_directory//mysqladmin --no-defaults -S /mysql-server/debug/mysql-test/var/tmp/mysqld.1.sock -P 13000 -uroot ping 2> /dev/null' failed, error: 35584, status: 139, errno: 0.

The result from queries just before the failure was:
--user=test_user2
--host=127.0.0.1

# Dropping users 'test_user1' & 'test_user2'
DROP USER test_user1, test_user2;

###############################
# Resetting the test login file
###############################
# done..

####################################
# Testing with an invalid login file
####################################
# mysql_config_editor.test
This is non-standard test login file.
# The 'invalid' login file should not cause
# any problem.
#
exec of '/mysql-server/debug/runtime_output_directory//mysqladmin --no-defaults -S /mysql-server/debug/mysql-test/var/tmp/mysqld.1.sock -P 13000 -uroot ping 2> /dev/null' failed, error: 35584, status: 139, errno: 0.
safe_process[25329]: Child process: 25330, exit: 1

 - the logfile can be found in '/mysql-server/debug/mysql-test/var/log/main.mysql_config_editor/mysql_config_editor.log'

 - found 'core.25391', moving it to '/mysql-server/debug/mysql-test/var/log/main.mysql_config_editor'
 - found 'core.25391' (0/5)

Trying 'dbx' to get a backtrace

Trying 'gdb' to get a backtrace
Core generated by '/mysql-server/debug/runtime_output_directory//mysqladmin'
Output from gdb follows. The first stack trace is from the failing thread.
The following stack traces are from all threads (so the failing one is
duplicated).
--------------------------
[New LWP 25391]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Missing separate debuginfo for /mysql-server/debug/library_output_directory/libcrypto.so.1.1
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/25/9a32c03fa7e7aeeb0b210e1f75d8fe1c74ba6b.debug
Missing separate debuginfo for /mysql-server/debug/library_output_directory/libssl.so.1.1
Try: dnf --enablerepo='*debug*' install /usr/lib/debug/.build-id/40/e21f6e6e644bbbebf0df9b287e4b8a3149a520.debug
Core was generated by `/mysql-server/debug/runtime_output_directory//mysqladmin --no-defaults -S /mysq'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000ffffa35e1fe8 in ?? () from /mysql-server/debug/library_output_directory/libcrypto.so.1.1
#0  0x0000ffffa35e1fe8 in ?? () from /mysql-server/debug/library_output_directory/libcrypto.so.1.1
#1  0x000000002af83cc0 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

Thread 1 (Thread 0xffffa389d010 (LWP 25391)):
#0  0x0000ffffa35e1fe8 in ?? () from /mysql-server/debug/library_output_directory/libcrypto.so.1.1
#1  0x000000002af83cc0 in ?? ()
Backtrace stopped: previous frame inner to this frame (corrupt stack?)

[100%] shutdown_report                           [ pass ]       
------------------------------------------------------------------------------
The servers were restarted 0 times
The servers were reinitialized 0 times
Spent 0.000 of 29 seconds executing testcases

Completed: Failed 1/2 tests, 50.00% were successful.

Failing test(s): main.mysql_config_editor

The log files in var/log may give you some hint of what went wrong.

If you want to report this error, please read first the documentation
at http://dev.mysql.com/doc/mysql/en/mysql-test-suite.html

mysql-test-run: *** ERROR: there were failing test cases

How to repeat:
Running the mtr testcase in the arm architecture will always lead to crash.

Suggested fix:
Revert the commit 41bcc64d3da4a49481f54b62ad60e97e660b78f8, then it can run to success.
[3 Nov 2021 8:06] MySQL Verification Team
Hello Zhe chen,

Thank you for the report and feedback.
I quickly tried with the source build on aarch64 instance but not seeing any issues.  Could you please share the exact cmake options used for the source build to reproduce the issue at our end? Thank you!

==
TARGET=/dev/shm/bug105423
rm -rf CMakeCache.txt
cmake . -DWITH_BOOST=./boost -DFORCE_INSOURCE_BUILD=1 -DCMAKE_INSTALL_PREFIX=$TARGET -DCOMPILATION_COMMENT=`date +"%m-%d-%Y"` -DWITH_DEBUG=1 -DBUILD_CONFIG=mysql_release  
make -j 128
make install
cd /dev/shm/bug105423
find . -name mysqld-debug
./bin/mysqld-debug
mv ./bin/mysqld-debug ./bin/mysqld
cd mysql-test/

 ./mtr main.mysql_config_editor
Logging: ./mtr  main.mysql_config_editor
MySQL Version 8.0.27
Checking supported features
 - Binaries are debug compiled
Using 'all' suites
Collecting tests
Removing old var directory
Creating var directory '/dev/shm/bug105423/mysql-test/var'
Installing system database
Using parallel: 1

==============================================================================
                  TEST NAME                       RESULT  TIME (ms) COMMENT
------------------------------------------------------------------------------
[ 50%] main.mysql_config_editor                  [ pass ]   7540
[100%] shutdown_report                           [ pass ]
------------------------------------------------------------------------------
The servers were restarted 0 times
The servers were reinitialized 0 times
Spent 7.540 of 37 seconds executing testcases

Completed: All 2 tests were successful.

[umshastr@ellex07]/dev/shm/bug105423/mysql-test: cat /etc/*release
Oracle Linux Server release 8.4
NAME="Oracle Linux Server"
VERSION="8.4"
ID="ol"
ID_LIKE="fedora"
VARIANT="Server"
VARIANT_ID="server"
VERSION_ID="8.4"
PLATFORM_ID="platform:el8"
PRETTY_NAME="Oracle Linux Server 8.4"
ANSI_COLOR="0;31"
CPE_NAME="cpe:/o:oracle:linux:8:4:server"
HOME_URL="https://linux.oracle.com/"
BUG_REPORT_URL="https://bugzilla.oracle.com/"

ORACLE_BUGZILLA_PRODUCT="Oracle Linux 8"
ORACLE_BUGZILLA_PRODUCT_VERSION=8.4
ORACLE_SUPPORT_PRODUCT="Oracle Linux"
ORACLE_SUPPORT_PRODUCT_VERSION=8.4
Red Hat Enterprise Linux release 8.4 (Ootpa)
Oracle Linux Server release 8.4

uname -an
Linux ellex07 5.4.17-2102.204.4.3.el8uek.aarch64 #2 SMP Tue Aug 10 16:25:57 PDT 2021 aarch64 aarch64 aarch64 GNU/Linux

cat /proc/version
Linux version 5.4.17-2102.204.4.3.el8uek.aarch64 (mockbuild@host-100-100-224-62) (gcc version 8.3.1 20190507 (Red Hat 8.3.1-4.5.0.8) (GCC)) #2 SMP Tue Aug 10 16:25:57 PDT 2021

regards,
Umesh
[4 Nov 2021 8:12] zhe chen
Hello, this is the cmake option, which is different at bundled openssl(1.1.1i). And core was generated at /mysql-server/debug/library_output_directory/libcrypto.so.1.1, that is the product of openssl.

cmake /mysql-server/ -DWITH_BOOST=/boost -DWITH_SSL=/openssl -DWITH_DEBUG=1
[4 Nov 2021 8:13] zhe chen
[root@184004866c7e mysql-test]# cat /etc/*release
EulerOS release 2.0 (SP8)
EulerOS release 2.0 (SP8)
NAME="EulerOS"
VERSION="2.0 (SP8)"
ID="euleros"
ID_LIKE="rhel fedora centos"
VERSION_ID="2.0"
PRETTY_NAME="EulerOS 2.0 (SP8)"
ANSI_COLOR="0;31"

EulerOS release 2.0 (SP8)
EulerOS release 2.0 (SP8)
[8 Nov 2021 6:29] MySQL Verification Team
Thank you for the feedback.
Could you please provide exact openssl version used for your builds? Thank you!

-

TARGET=/dev/shm/bug105423
rm -rf CMakeCache.txt
rm -rf bld/
mkdir bld && cd bld
cmake .. -DWITH_BOOST=../boost -DCMAKE_INSTALL_PREFIX=$TARGET -DCOMPILATION_COMMENT=`date +"%m-%d-%Y"` -DWITH_DEBUG=1  
make -j 128
make install
cd /dev/shm/bug105423

 ldd bin/mysqld
        linux-vdso.so.1 (0x0000fffd5f330000)
        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000fffd5f2d0000)
        librt.so.1 => /lib64/librt.so.1 (0x0000fffd5f2a0000)
        libssl.so.1.1 => /lib64/libssl.so.1.1 (0x0000fffd5f1f0000)
        libcrypto.so.1.1 => /lib64/libcrypto.so.1.1 (0x0000fffd5ef30000)
        libdl.so.2 => /lib64/libdl.so.2 (0x0000fffd5ef00000)
        libprotobuf-lite.so.3.11.4 => /dev/shm/bug105423/bin/../lib/private/libprotobuf-lite.so.3.11.4 (0x0000fffd5ede0000)
        libaio.so.1 => /lib64/libaio.so.1 (0x0000fffd5edb0000)
        libnuma.so.1 => /lib64/libnuma.so.1 (0x0000fffd5ed80000)
        libstdc++.so.6 => /lib64/libstdc++.so.6 (0x0000fffd5ebd0000)
        libm.so.6 => /lib64/libm.so.6 (0x0000fffd5eb00000)
        libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000fffd5eac0000)
        libc.so.6 => /lib64/libc.so.6 (0x0000fffd5e940000)
        /lib/ld-linux-aarch64.so.1 (0x0000fffd5f340000)
        libz.so.1 => /lib64/libz.so.1 (0x0000fffd5e900000)

/mysql-test: ./mtr main.mysql_config_editor
Logging: ./mtr  main.mysql_config_editor
MySQL Version 8.0.27
Checking supported features
 - Binaries are debug compiled
Using 'all' suites
Collecting tests
Removing old var directory
Creating var directory '/dev/shm/bug105423/mysql-test/var'
Installing system database
Using parallel: 1

==============================================================================
                  TEST NAME                       RESULT  TIME (ms) COMMENT
------------------------------------------------------------------------------
[ 50%] main.mysql_config_editor                  [ pass ]   7499
[100%] shutdown_report                           [ pass ]
------------------------------------------------------------------------------
The servers were restarted 0 times
The servers were reinitialized 0 times
Spent 7.499 of 36 seconds executing testcases

Completed: All 2 tests were successful.
[8 Nov 2021 12:44] zhe chen
Hi, here is my build step.

Download openssl from https://github.com/openssl/openssl/archive/refs/tags/OpenSSL_1_1_1i.tar.gz
cmake /mysql-server/ -DWITH_BOOST=/boost -DWITH_SSL=/openssl -DWITH_DEBUG=1
make -j8

ldd debug/bin/mysqld
	linux-vdso.so.1 (0x0000ffff9f07b000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x0000ffff9f008000)
	libdl.so.2 => /lib64/libdl.so.2 (0x0000ffff9efe7000)
	librt.so.1 => /lib64/librt.so.1 (0x0000ffff9efc6000)
	libcrypto.so.1.1 => /mysql-server/debug/library_output_directory/libcrypto.so.1.1 (0x0000ffff9ed0f000)
	libssl.so.1.1 => /mysql-server/debug/library_output_directory/libssl.so.1.1 (0x0000ffff9ec6a000)
	libprotobuf-lite.so.3.11.4 => /mysql-server/debug/library_output_directory/libprotobuf-lite.so.3.11.4 (0x0000ffff9eb56000)
	libaio.so.1 => /lib64/libaio.so.1 (0x0000ffff9eb35000)
	libnuma.so.1 => /lib64/libnuma.so.1 (0x0000ffff9eb10000)
	libstdc++.so.6 => /lib64/libstdc++.so.6 (0x0000ffff9e96c000)
	libm.so.6 => /lib64/libm.so.6 (0x0000ffff9e89b000)
	libgcc_s.so.1 => /lib64/libgcc_s.so.1 (0x0000ffff9e86a000)
	libc.so.6 => /lib64/libc.so.6 (0x0000ffff9e6e4000)
	/lib/ld-linux-aarch64.so.1 (0x0000ffff9f03d000)
	libz.so.1 => /lib64/libz.so.1 (0x0000ffff9e6b3000)
	libsecurec.so => /lib64/libsecurec.so (0x0000ffff9e682000)

Can you try to add cmake option -DWITH_SSL=/openssl?
[8 Nov 2021 13:07] MySQL Verification Team
Thank you, let me try with the provided details and get back to you if still not able to reproduce. Thank you once again!

regards,
Umesh
[9 Nov 2021 10:31] MySQL Verification Team
Thank you for the feedback.