Subject: Threading problems
To: None <>
From: D'Arcy J.M. Cain <>
List: tech-kern
Date: 11/23/2004 07:34:48
I am having a problem with PostgreSQL 7.4.6 under NetBSD 2.0 RC5.  Here
is the GDB dump:

#0  0x483cafeb in kill () from /usr/lib/
#1  0x483cd0af in __libc_mutex_catchall_stub (m=1212478892)
    at /usr/src/lib/libc/thread-stub/thread-stub.c:112
#2  0x4843f0f7 in free (ptr=<incomplete type>)
    at /usr/src/lib/libc/stdlib/malloc.c:1149
#3  0x081b3efc in AllocSetDelete (context=<error type>) at aset.c:464
#4  0x081b468a in MemoryContextDelete (context=<error type>) at
/usr/src/gnu/dist/gdb/gdb/gdbtypes.c:515: gdb-internal-error:
make_cv_type: Assertion `TYPE_OBJFILE (*typeptr) == TYPE_OBJFILE (type)
|| TYPE_STUB (*typeptr)' failed.
An internal GDB error was detected.  This may make further
debugging unreliable.  Quit this debugging session? (y or n) 

First of all, what's with that GDB error?  I have never seen it before. 
Second, Why am I dying in that code?  Here is where it dies.

__libc_mutex_catchall_stub(mutex_t *m)
    /* LINTED deliberate lack of effect */
    return (0);

The macro is defined as follows:

do {                    \
    if (__isthreaded)       \
        DIE();          \
} while (/*CONSTCOND*/0)

#if 1
#define CHECK_NOT_THREADED()    /* nothing */

Not being a kernel hacker myself I am not sure exactly what is happening
here but it seems like the app thinks that it is not threaded but the
__isthreaded variable says that it is.  I checked and the value is 1 at
the sime it crashes.

This does seem to be a problem only with the current version of
PostgreSQL (7.4.6) and not a slightly older one (7.4.3) but I can't see
how it could be an application fault.

D'Arcy J.M. Cain <>