[MDEV-21551] tpool : fix calculation of currently active tasks in maybe_wake_or_create_thread() Created: 2020-01-21  Updated: 2020-03-25  Resolved: 2020-03-25

Status: Closed
Project: MariaDB Server
Component/s: Storage Engine - InnoDB
Affects Version/s: 10.5.1
Fix Version/s: 10.5.2

Type: Bug Priority: Major
Reporter: Vladislav Vaintroub Assignee: Vladislav Vaintroub
Resolution: Fixed Votes: 0
Labels: None


 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.


Generated at Thu Feb 08 09:07:59 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.