From: "jaruga (Jun Aruga) via ruby-core" Date: 2023-01-27T14:25:28+00:00 Subject: [ruby-core:112085] [Ruby master Bug#19386] `test_hmac.rb` of openssl is timeout on RHEL9 Issue #19386 has been updated by jaruga (Jun Aruga). I debugged the issue on the latest master branch `47b66a5acd1511089ac9585371d93e1b5ea07232` on the RHEL 9 instance. I installed the following RPM packages to compile and debug. The gdb asked the following debuginfo RPM packages are missing. So, I installed these ones. ``` $ sudo dnf install gdb $ sudo dnf install ruby $ sudo dnf debuginfo-install glibc-2.34-40.el9_1.1.x86_64 gmp-6.2.0-10.el9.x86_64 libgcc-11.3.1-2.1.el9.x86_64 libxcrypt-4.4.18-3.el9.x86_64 zlib-1.2.11-35.el9_1.x86_64 $ sudo dnf debuginfo-install openssl-libs-3.0.1-43.el9_0.x86_64 ``` I compiled the Ruby with the following flags. ``` $ ./autogen.sh $ optflags=-O0 debugflags="-g3 -ggdb3 -gdwarf-4" \ ./configure \ --prefix=$HOME/.local/ruby-47b66a5acd-O0 \ --enable-shared $ make ``` Then I confirmed the stuck or coredump happened with the command below. ``` [jaruga@rhel9 ruby]$ make test-all V=1 TESTS="-v test/openssl/test_hmac.rb -n OpenSSL::TestHMAC#test_dup" exec ./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" - -excludes-dir=./test/excludes --name=!/memory_leak/ -v test/openssl/test_hmac.rb -n OpenSSL::TestHMAC#test_dup Run options: --seed=25634 "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" --excludes-dir=./test/excludes --name=!/memory_leak/ -v -n OpenSSL::TestHMAC#test_dup # Running tests: [1/0] OpenSSL::TestHMAC#test_dup = 0.00 s Finished tests in 0.025968s, 38.5083 tests/s, 154.0333 assertions/s. 1 tests, 4 assertions, 0 failures, 0 errors, 0 skips ruby -v: ruby 3.3.0dev (2023-01-27T11:07:06Z master 47b66a5acd) [x86_64-linux] ^Cmake: *** [uncommon.mk:850: yes-test-all] Interrupt ``` Here is the gdb backtrace. ``` [jaruga@rhel9 ruby]$ gdb -q -ex "set breakpoint pending on" --args ./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems "./test/runner.rb" --ruby="./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" --excludes-dir=./test/excludes -v test/openssl/test_hmac.rb -n OpenSSL::TestHMAC#test_dup (gdb) b main ...... (gdb) n 38 return ruby_run_node(ruby_options(argc, argv)); (gdb) n Run options: --seed=43937 "--ruby=./miniruby -I./lib -I. -I.ext/common ./tool/runruby.rb --extout=.ext -- --disable-gems" --excludes-dir=./test/excludes -v -n OpenSSL::TestHMAC#test_dup # Running tests: [Detaching after vfork from child process 363930] [1/0] OpenSSL::TestHMAC#test_dup = 0.00 s Finished tests in 0.026546s, 37.6711 tests/s, 150.6844 assertions/s. 1 tests, 4 assertions, 0 failures, 0 errors, 0 skips ruby -v: ruby 3.3.0dev (2023-01-27T11:07:06Z master 47b66a5acd) [x86_64-linux] ^C Program received signal SIGINT, Interrupt. 0x00007ffff76c7df6 in __pthread_rwlock_wrlock_full64 (abstime=0x0, clockid=0, rwlock=0x850540) at /usr/src/debug/glibc-2.34-40.el9_1.1.x86_64/nptl/pthread_rwlock_common.c:941 941 if ((atomic_load_acquire (&rwlock->__data.__readers) (gdb) bt #0 0x00007ffff76c7df6 in __pthread_rwlock_wrlock_full64 (abstime=0x0, clockid=0, rwlock=0x850540) at /usr/src/debug/glibc-2.34-40.el9_1.1.x86_64/nptl/pthread_rwlock_common.c:941 #1 ___pthread_rwlock_wrlock (rwlock=0x850540) at pthread_rwlock_wrlock.c:27 #2 0x00007ffff3669f5d in CRYPTO_THREAD_write_lock (lock=) at crypto/threads_pthread.c:100 #3 0x00007ffff364b747 in evp_keymgmt_util_clear_operation_cache (locking=1, pk=pk@entry=0x97e350) at crypto/evp/keymgmt_lib.c:223 #4 evp_pkey_free_it (x=x@entry=0x97e350) at crypto/evp/p_lib.c:1742 #5 0x00007ffff364bf60 in EVP_PKEY_free (x=0x97e350) at crypto/evp/p_lib.c:1768 #6 EVP_PKEY_free (x=0x97e350) at crypto/evp/p_lib.c:1756 #7 0x00007ffff364c252 in EVP_PKEY_CTX_free (ctx=0x861c70) at crypto/evp/pmeth_lib.c:427 #8 0x00007ffff36266a9 in EVP_MD_CTX_reset (ctx=0x8fd770) at crypto/evp/digest.c:76 #9 EVP_MD_CTX_reset (ctx=ctx@entry=0x8fd770) at crypto/evp/digest.c:65 #10 0x00007ffff36266d2 in EVP_MD_CTX_free (ctx=0x8fd770) at crypto/evp/digest.c:123 #11 EVP_MD_CTX_free (ctx=0x8fd770) at crypto/evp/digest.c:118 #12 0x00007ffff39a796d in ossl_hmac_free (ctx=0x8fd770) at ossl_hmac.c:37 --Type for more, q to quit, c to continue without paging-- #13 0x00007ffff7b10e40 in run_final (objspace=0x4097e0, zombie=140737275023000) at gc.c:4388 #14 0x00007ffff7b10efb in finalize_list (objspace=0x4097e0, zombie=140737275023000) at gc.c:4407 #15 0x00007ffff7b11016 in finalize_deferred_heap_pages (objspace=0x4097e0) at gc.c:4436 #16 0x00007ffff7b114f7 in rb_objspace_call_finalizer (objspace=0x4097e0) at gc.c:4573 #17 0x00007ffff7af8b95 in rb_ec_finalize (ec=0x40a6c0) at eval.c:168 #18 0x00007ffff7af9047 in rb_ec_cleanup (ec=0x40a6c0, ex=RUBY_TAG_RAISE) at eval.c:262 #19 0x00007ffff7af9361 in ruby_run_node (n=0x7ffff7482b38) at eval.c:330 #20 0x00000000004011d9 in rb_main (argc=9, argv=0x7fffffffe638) at ./main.c:38 #21 0x0000000000401236 in main (argc=9, argv=0x7fffffffe638) at ./main.c:57 (gdb) ``` ---------------------------------------- Bug #19386: `test_hmac.rb` of openssl is timeout on RHEL9 https://bugs.ruby-lang.org/issues/19386#change-101519 * Author: hsbt (Hiroshi SHIBATA) * Status: Open * Priority: Normal * Backport: 2.7: UNKNOWN, 3.0: UNKNOWN, 3.1: UNKNOWN, 3.2: UNKNOWN ---------------------------------------- I prepared new test instance of RHEL9 for https://rubyci.org/. But it stuck with openssl tests. see http://rubyci.s3.amazonaws.com/rhel9/ruby-master/log/20230127T003004Z.fail.html.gz I did bisect this issue. This issue caused by https://github.com/ruby/ruby/blob/master/test/openssl/test_hmac.rb#L23 ``` def test_dup h1 = OpenSSL::HMAC.new("KEY", "MD5") h1.update("DATA") h = h1.dup assert_equal(h1.digest, h.digest, "dup digest") end ``` Stuck is happened after running this test. /cc @vo.x @jaruga @rhenium -- https://bugs.ruby-lang.org/ ______________________________________________ ruby-core mailing list -- ruby-core@ml.ruby-lang.org To unsubscribe send an email to ruby-core-leave@ml.ruby-lang.org ruby-core info -- https://ml.ruby-lang.org/mailman3/postorius/lists/ruby-core.ml.ruby-lang.org/