[MDEV-26559] A possible improper locking bug Created: 2021-09-07  Updated: 2021-10-26  Resolved: 2021-10-26

Status: Closed
Project: MariaDB Server
Component/s: Server
Affects Version/s: 10.6.4
Fix Version/s: N/A

Type: Bug Priority: Major
Reporter: Ryan Assignee: Sergei Golubchik
Resolution: Not a Bug Votes: 0
Labels: performance, server
Environment:

All



 Description   

Hi, developers, I found an inconsistent code in below code. The lock LOCK_sigwait could be relased and not released in below code, which is correct?

int sigwait(sigset_t *setp, int *sigp)
{
  ...;
 
  pthread_mutex_lock(&LOCK_sigwait);
  for (;;)
  {
    ...;
	pthread_mutex_unlock(&LOCK_sigwait); // release the lock before return
	return 0;
      }
    }
    pthread_cond_wait(&COND_sigwait, &LOCK_sigwait);
  }
  return 0; // do not release the lock before return
}

https://github.com/MariaDB/server/blob/57f14eab20ae2733eb341f3d293515a10a40bc48/mysys/my_pthread.c#L250-L295



 Comments   
Comment by Ryan [ 2021-10-26 ]

Sorry, I check this issue again and find it is a false positive since the second return could not be reached.
Many things for your checking.

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