Date: Wed, 28 Jul 2021 03:55:59 +0300 From: Rozhuk Ivan <rozhuk.im@gmail.com> To: freebsd-hackers@freebsd.org, freebsd-current@freebsd.org Cc: Rozhuk Ivan <Rozhuk.IM@gmail.com> Subject: pthread_mutex_lock(), EDEADLK and thread ID Message-ID: <20210728035559.3b885fb9@rimwks.local>
next in thread | raw e-mail | index | archive | help
Hi!
We have some product based on FreeBSD 12.2 that running in different places and
environments, more than 5 years.
At one place we got EDEADLK some times then calling pthread_mutex_lock().
This happen to often: 1-4 times per 10 minutes.
Code designed to call abort() and generate coredump.
So we mostly sure that this was not happen in other places in past.
I know that we run as VmWare guest and can ask more details.
In lib/libthr/thread/thr_mutex.c
...
static int
mutex_lock_sleep(struct pthread *curthread, struct pthread_mutex *m,
const struct timespec *abstime)
{
uint32_t id, owner;
int count, ret;
id = TID(curthread);
if (PMUTEX_OWNER_ID(m) == id)
return (mutex_self_lock(m, abstime));
....
mutex_self_lock() may return EDEADLK for PTHREAD_MUTEX_ERRORCHECK mutex type, which is default.
Is it possible that "id = TID(_get_curthread());" some how changed to ID some other thread that lock mutex in past?
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20210728035559.3b885fb9>
