Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search for
  Advanced Search

Re: Exceeded maximum lock level



Alvaro Herrera wrote:
Fatal error 'Exceeded maximum lock level' at line 519 in file /usr/src/lib/libpthread/thread/thr_mutex.c (errno = 844913743)

This is clearly not a PG problem -- I'd think there's a bug in your own
code.

This is very helpful :)

My code is just this:

int SQLLog( PGconn *conn,
        struct auth *a,
        struct client *c,
        struct request *r,
        struct data *d )
{
    char * str;
    char log[256];

    char *request;
    unsigned char *esc_bytea;
    size_t      length;
    PGresult   *res;


if ((esc_bytea = PQescapeByteaConn(conn,d->data,d->len,&length)) == NULL)
    {
        snprintf(log,256, "Error: %s",PQerrorMessage(conn));
        logging(log);
        return 0;
    }

    request = malloc ( sizeof(a->user) + sizeof(c->src) +
            sizeof(r->dst) + sizeof(esc_bytea) + 110);

sprintf(request, "INSERT INTO raw (username,from_addr,to_addr,rawdata,direction) VALUES ('%s','%s','%s',E'%s',%d)", a->user,c->src,r->dst,esc_bytea,d->dir);

    res = PQexec(conn, request);

    if (PQresultStatus(res) != PGRES_COMMAND_OK)
    {
        snprintf(log,256,"failed: %s", PQerrorMessage(conn));
        logging(log);
    }

    free(request);
    PQfreemem(esc_bytea);
    PQclear(res);

    return 0;
}

int OpenSQL( PGconn **conn )
{
    char log[256];
    char *conninfo;
    conninfo = "host=localhost dbname=db user=user password=password";

    *conn = PQconnectdb(conninfo);
    if (PQstatus(*conn) != CONNECTION_OK)
    {
        snprintf(log,256, "Connection to database failed: %s",
                PQerrorMessage(*conn));
        logging(log);
        return 1;
    } else
        return 0;
}

int CloseSQL( PGconn *conn )
{
    PQfinish(conn);
    return 0;
}


I didn't touch any mutex (i don't even sure about what is mutex). While not calling any of sql functions, application works just fine. In non-threaded mode it is working with sql functions. Where did i go wrong?

--
wbr, alexander



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group