Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-110429

QMutex and QSemaphore don't work after 2038 on 32 bits systems

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • P3: Somewhat important
    • None
    • 5.15.3, 6.2.4
    • Core: Threads
    • None
    • i.MX6 + Linux 5.10 + glibc 2.35
    • Linux/Yocto

    Description

      Environment

      • i.MX6 32 bits CPU
      • Yocto Kirkstone (kirkstone-4.0.6)
      • Linux 5.10.109
      • glibc 2.35 (8d125a1f9145ad90c94e438858d6b5b7578686f2)
      • qtbase 5.15.3 or 6.2.4
      • RFS built with "-D_TIME_BITS=64 -D_FILE_OFFSET_BITS=64" flags
      • System date set after 011903142038 (2038 Jan 19 03:14:00)

      Description

      The following qtbase tests failed:

      • qmutex:
      # /usr/lib/qtbase/ptest/tests/auto/corelib/thread/qmutex/tst_qmutex
      ********* Start testing of tst_QMutex *********
      Config: Using QtTest library 6.2.4, Qt 6.2.4 (arm-little_endian-ilp32-eabi-hardfloat shared (dynamic) release build; by GCC 11.3.0), poky 4.0.6
      [...]
      FAIL!  : tst_QMutex::tryLock_non_recursive() 'timer.elapsed() >= waitTime - systemTimersResolution' returned FALSE. ()
         Loc: [/usr/src/debug/qtbase/6.2.4-r0/git/tests/auto/corelib/thread/qmutex/tst_qmutex.cpp(231)]
      
      • qsemaphore:
      # /usr/lib/qtbase/ptest/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore
      ********* Start testing of tst_QSemaphore *********
      Config: Using QtTest library 6.2.4, Qt 6.2.4 (arm-little_endian-ilp32-eabi-hardfloat shared (dynamic) release build; by GCC 11.3.0), poky 4.0.6
      [...]
      FAIL!  : tst_QSemaphore::tryAcquireWithTimeout(0.2s) 'qAbs(a1-e1) < fuzz' returned FALSE. ((int(time.elapsed())=0) is more than 60 milliseconds different from (timeout=200))
         Loc: [/usr/src/debug/qtbase/6.2.4-r0/git/tests/auto/corelib/thread/qsemaphore/tst_qsemaphore.cpp(326)]
      

      A quick look with strace leads to futex related issue.

      The problem is similar to a recent gstreamer issue.

      Adding the following simple code to src/corelib/thread/qfutex_p.h fix the issue:

      #  ifdef __NR_futex_time64
      #    define __NR_futex __NR_futex_time64
      #  endif
      

      More checks must probably be added.

      Attachments

        Issue Links

          Activity

            People

              thiago Thiago Macieira
              blemou Benjamin Lemouzy
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: