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

A possible improper locking bug

    XMLWordPrintable

    Details

      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

        Attachments

          Activity

            People

            Assignee:
            serg Sergei Golubchik
            Reporter:
            Ryan Ryan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Git Integration