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

Re: Exceeded maximum lock level

From: alexander lunyov <lan(at)zato(dot)ru>
To: pgsql-interfaces(at)postgresql(dot)org
Cc: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
Subject: Re: Exceeded maximum lock level
Date: 2008-04-24 05:34:19
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-interfaces
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)) == 
         snprintf(log,256, "Error: %s",PQerrorMessage(conn));
         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));


     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",
         return 1;
     } else
         return 0;

int CloseSQL( PGconn *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

In response to


pgsql-interfaces by date

Next:From: Alvaro HerreraDate: 2008-04-24 14:12:35
Subject: Re: Exceeded maximum lock level
Previous:From: Alvaro HerreraDate: 2008-04-23 14:55:10
Subject: Re: Exceeded maximum lock level

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group