Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-21551

tpool : fix calculation of currently active tasks in maybe_wake_or_create_thread()

    XMLWordPrintable

    Details

      Description

      A task that is executed,could be counted as waiting (after wait_begin()
      before wait_end()) or as long-running (callback runs for a long time).

      If task is both marked waiting and long-running, then calculation of
      current concurrency (# of executing tasks - long tasks - waiting tasks)
      would be wrong, as single task is counted twice.

      the number above could go negative, with unsigned arithmetic it will become a huge.

      As a result, maybe_wake_or_create_thread() would neither wake nor create
      a thread, when it should. Which may result in a deadlock.

        Attachments

          Activity

            People

            Assignee:
            wlad Vladislav Vaintroub
            Reporter:
            wlad Vladislav Vaintroub
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: