Uploaded image for project: 'Realm Core'
  1. Realm Core
  2. RCORE-1270

Update test in test_lang_bind_helper.cpp to disable global page reclaimer during test

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Core
    • None

      Expected results

      Update the operation of the LangBindHelper_ImplicitTransactions_InterProcess test (line 3110) in test_lang_bind_helper.cpp to disable the global page reclaimer during the test.

      Actual Results

      A task run on Ubuntu 20.04 ARM64 experienced a hang during the test_lang_bind_helper.cpp test:

      [2022/09/28 17:52:40.746] 1: Thread[8]: ../test/test_lang_bind_helper.cpp:3110: Begin LangBindHelper_ImplicitTransactions_InterProcess
      [2022/09/28 18:22:21.934] Command stopped early: context canceled
      

      From the core dump, it looks like it was determined that the mutex was potentially locked by the global page reclaimer when the test forked another process, leading to the mutex being locked in the new process, which will never be freed and the execution hangs while trying to retrieve file information.

      This failure is difficult to reproduce since it is a race condition that is dependent on the page reclaimer actively working with a file when the test creates a forked process.

      Core dump:

      [2022/09/28 18:22:51.274] #0  __lll_lock_wait (futex=futex@entry=0xaaab22056fb0, private=0) at lowlevellock.c:52
      [2022/09/28 18:22:51.274] #1  0x0000ffffafd71cd8 in __GI___pthread_mutex_lock (mutex=0xaaab22056fb0) at pthread_mutex_lock.c:80
      [2022/09/28 18:22:51.274] #2  0x0000aaaae0ea0458 in realm::util::Mutex::lock (this=0xaaab22056fb0) at ../src/realm/util/thread.hpp:530
      [2022/09/28 18:22:51.274] #3  0x0000aaaae0ea0550 in realm::util::LockGuard::LockGuard (this=0xffffd25fb3d0, m=...) at ../src/realm/util/thread.hpp:567
      [2022/09/28 18:22:51.274] #4  0x0000aaaae19e6b88 in realm::util::get_file_info_for_file (file=...) at ../src/realm/util/file_mapper.cpp:479
      [2022/09/28 18:22:51.274] #5  0x0000aaaae1836274 in realm::SlabAlloc::attach_file (this=0xaaab22016458, file_path="LangBindHelper_ImplicitTransactions_InterProcess.1.path.realm", cfg=...) at ../src/realm/alloc_slab.cpp:898
      [2022/09/28 18:22:51.274] #6  0x0000aaaae18a4a68 in realm::DB::open (this=0xaaab22016410, path="LangBindHelper_ImplicitTransactions_InterProcess.1.path.realm", no_create_file=false, options=...) at ../src/realm/db.cpp:910
      [2022/09/28 18:22:51.274] #7  0x0000aaaae18a5dc4 in realm::DB::open (this=0xaaab22016410, repl=..., file="LangBindHelper_ImplicitTransactions_InterProcess.1.path.realm", options=...) at ../src/realm/db.cpp:1215
      [2022/09/28 18:22:51.274] #8  0x0000aaaae18aa620 in realm::DB::create (repl=..., file="LangBindHelper_ImplicitTransactions_InterProcess.1.path.realm", options=...) at ../src/realm/db.cpp:2531
      [2022/09/28 18:22:51.274] #9  0x0000aaaae117cb60 in Realm_UnitTest__LangBindHelper_ImplicitTransactions_InterProcess::test_run (this=0xffffd25fd160) at ../test/test_lang_bind_helper.cpp:3144
      [2022/09/28 18:22:51.274] #10 0x0000aaaae11bd72c in realm::test_util::unit_test::RegisterTest<Realm_UnitTest__LangBindHelper_ImplicitTransactions_InterProcess>::run_test (test_context=...) at ../test/util/unit_test.hpp:616
      [2022/09/28 18:22:51.274] #11 0x0000aaaae171541c in realm::test_util::unit_test::TestList::ThreadContextImpl::run (this=0xaaab22058170, entry=..., lock=...) at ../test/util/unit_test.cpp:751
      [2022/09/28 18:22:51.274] #12 0x0000aaaae17152fc in realm::test_util::unit_test::TestList::ThreadContextImpl::nonconcur_run (this=0xaaab22058170) at ../test/util/unit_test.cpp:735
      [2022/09/28 18:22:51.274] #13 0x0000aaaae1714d70 in realm::test_util::unit_test::TestList::run (this=0xaaaae215c198 <realm::test_util::unit_test::get_default_test_list()::list>, config=...) at ../test/util/unit_test.cpp:676
      [2022/09/28 18:22:51.274] #14 0x0000aaaae1308744 in (anonymous namespace)::run_tests (logger=0x0) at ../test/test_all.cpp:526
      [2022/09/28 18:22:51.274] #15 0x0000aaaae1308b24 in test_all (logger=0x0) at ../test/test_all.cpp:594
      [2022/09/28 18:22:51.274] #16 0x0000aaaae0e5638c in main (argc=1, argv=0xffffd25ff0c8) at ../test/main.cpp:26
      

      Steps & Code to Reproduce

      The test doesn't hang.

      Core version

      The test was being performed against commit https://github.com/realm/realm-core/commit/7f59cbc4524b8b1c90ecf46d94faf3681f7f660c

            Assignee:
            Unassigned Unassigned
            Reporter:
            michael.wilkersonbarker@mongodb.com Michael Wilkerson-Barker (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: