public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Assertion `mutex->__data.__owner
@ 2011-11-24 15:10 trisha yad
  2011-11-25  5:34 ` trisha yad
  2011-11-25  6:02 ` Carlos O'Donell
  0 siblings, 2 replies; 4+ messages in thread
From: trisha yad @ 2011-11-24 15:10 UTC (permalink / raw)
  To: libc-help, gcc-help, gcc-help

Dear All,

Today on my ARM Board one problem hit.
pthread_mutex_lock.c:62: __pthread_mutex_lock: Assertion
`mutex->__data.__owner == 0' failed.
This happen in pthread_mutex_lock.c.
May you pls let me know in which all cases it can happen.


int
__pthread_mutex_lock (mutex)
     pthread_mutex_t *mutex;
{
  assert (sizeof (mutex->__size) >= sizeof (mutex->__data));

  unsigned int type = PTHREAD_MUTEX_TYPE (mutex);
  if (__builtin_expect (type & ~PTHREAD_MUTEX_KIND_MASK_NP, 0))
    return __pthread_mutex_lock_full (mutex);

  pid_t id = THREAD_GETMEM (THREAD_SELF, tid);

  if (__builtin_expect (type, PTHREAD_MUTEX_TIMED_NP)
      == PTHREAD_MUTEX_TIMED_NP)
    {
    simple:
      /* Normal mutex.  */
      LLL_MUTEX_LOCK (mutex);
      assert (mutex->__data.__owner ==
0);<-------------------------------------------------Here.
    }
  else if (__builtin_expect (type == PTHREAD_MUTEX_RECURSIVE_NP, 1))
......

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Assertion `mutex->__data.__owner
  2011-11-24 15:10 Assertion `mutex->__data.__owner trisha yad
@ 2011-11-25  5:34 ` trisha yad
  2011-11-25  6:02 ` Carlos O'Donell
  1 sibling, 0 replies; 4+ messages in thread
From: trisha yad @ 2011-11-25  5:34 UTC (permalink / raw)
  To: libc-help, gcc-help, gcc-help

Dear All,

Today on my ARM Board one problem hit.
pthread_mutex_lock.c:62: __pthread_mutex_lock: Assertion
`mutex->__data.__owner == 0' failed.
This happen in pthread_mutex_lock.c.
May you pls let me know in which all cases it can happen.


int
__pthread_mutex_lock (mutex)
     pthread_mutex_t *mutex;
{
  assert (sizeof (mutex->__size) >= sizeof (mutex->__data));

  unsigned int type = PTHREAD_MUTEX_TYPE (mutex);
  if (__builtin_expect (type & ~PTHREAD_MUTEX_KIND_MASK_NP, 0))
    return __pthread_mutex_lock_full (mutex);

  pid_t id = THREAD_GETMEM (THREAD_SELF, tid);

  if (__builtin_expect (type, PTHREAD_MUTEX_TIMED_NP)
      == PTHREAD_MUTEX_TIMED_NP)
    {
    simple:
      /* Normal mutex.  */
      LLL_MUTEX_LOCK (mutex);
      assert (mutex->__data.__owner ==
0);<-------------------------------------------------Here.
    }
  else if (__builtin_expect (type == PTHREAD_MUTEX_RECURSIVE_NP, 1))
......

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Assertion `mutex->__data.__owner
  2011-11-24 15:10 Assertion `mutex->__data.__owner trisha yad
  2011-11-25  5:34 ` trisha yad
@ 2011-11-25  6:02 ` Carlos O'Donell
  2011-11-25  6:15   ` Carlos O'Donell
  1 sibling, 1 reply; 4+ messages in thread
From: Carlos O'Donell @ 2011-11-25  6:02 UTC (permalink / raw)
  To: trisha yad; +Cc: libc-help, gcc-help, gcc-help

On Thu, Nov 24, 2011 at 7:56 AM, trisha yad <trisha1march@gmail.com> wrote:
> Today on my ARM Board one problem hit.
> pthread_mutex_lock.c:62: __pthread_mutex_lock: Assertion
> `mutex->__data.__owner == 0' failed.
> This happen in pthread_mutex_lock.c.
> May you pls let me know in which all cases it can happen.

It should only happen if:
* the atomic operation was *not* atomic and you took a lock owned by
another thread.
* another thread accidentally corrupted the mutex by writing into it
without holding the lock e.g. buffer overrun/underrun etc.
* you have a compiler bug that causes the threading library to be
incorrectly compiled and violate the ordering requirements the code
needs to be atomic.

Is it reproducible?

Cheers,
Carlos.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Assertion `mutex->__data.__owner
  2011-11-25  6:02 ` Carlos O'Donell
@ 2011-11-25  6:15   ` Carlos O'Donell
  0 siblings, 0 replies; 4+ messages in thread
From: Carlos O'Donell @ 2011-11-25  6:15 UTC (permalink / raw)
  To: trisha yad; +Cc: libc-help, gcc-help, gcc-help

On Thu, Nov 24, 2011 at 7:56 AM, trisha yad <trisha1march@gmail.com> wrote:
> Today on my ARM Board one problem hit.
> pthread_mutex_lock.c:62: __pthread_mutex_lock: Assertion
> `mutex->__data.__owner == 0' failed.
> This happen in pthread_mutex_lock.c.
> May you pls let me know in which all cases it can happen.

It should only happen if:
* the atomic operation was *not* atomic and you took a lock owned by
another thread.
* another thread accidentally corrupted the mutex by writing into it
without holding the lock e.g. buffer overrun/underrun etc.
* you have a compiler bug that causes the threading library to be
incorrectly compiled and violate the ordering requirements the code
needs to be atomic.

Is it reproducible?

Cheers,
Carlos.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-11-24 14:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-24 15:10 Assertion `mutex->__data.__owner trisha yad
2011-11-25  5:34 ` trisha yad
2011-11-25  6:02 ` Carlos O'Donell
2011-11-25  6:15   ` Carlos O'Donell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).