too may LWLocks

Started by hariprasath nallasamyabout 9 years ago3 messagesgeneral
Jump to latest
#1hariprasath nallasamy
hariprasathnallasamy@gmail.com

Hi all
I am building an extension using shared memory hash table and for locking
hash table i am using LWLocks, but the thing was when i try to run some 1k
queries one after other, for each query i am getting one LWLock but on
executing 200th query i am getting the error *ERROR: too many LWLocks
taken*.

But in each query i acquire and release that block. So that lock has to be
flushed after executing query, but why am i getting this error.?

Is this due to *held_lwlocks *in LWLock.c is fixed only to some number 200
here.
Or am i missing something here.?

thanks
harry

#2Julien Rouhaud
rjuju123@gmail.com
In reply to: hariprasath nallasamy (#1)
Re: too may LWLocks

On Wed, Mar 08, 2017 at 03:34:56PM +0530, hariprasath nallasamy wrote:

Hi all
I am building an extension using shared memory hash table and for locking
hash table i am using LWLocks, but the thing was when i try to run some 1k
queries one after other, for each query i am getting one LWLock but on
executing 200th query i am getting the error *ERROR: too many LWLocks
taken*.

But in each query i acquire and release that block. So that lock has to be
flushed after executing query, but why am i getting this error.?

Is this due to *held_lwlocks *in LWLock.c is fixed only to some number 200
here.
Or am i missing something here.?

The most likely reason is that you have some code path in your extension where
you don't release the LWLock. Without access to the code we can't do much more
to help you I'm afraid. You could also try on a postgres build having
LWLOCK_STATS defined.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

#3hariprasath nallasamy
hariprasathnallasamy@gmail.com
In reply to: Julien Rouhaud (#2)
Re: too may LWLocks

oops its my bad implementation.. I was leaking locks and its fixed now.
Thanks for the help!

-harry

On Thu, Mar 9, 2017 at 1:07 AM, Julien Rouhaud <julien.rouhaud@dalibo.com>
wrote:

Show quoted text

On Wed, Mar 08, 2017 at 03:34:56PM +0530, hariprasath nallasamy wrote:

Hi all
I am building an extension using shared memory hash table and for locking
hash table i am using LWLocks, but the thing was when i try to run some

1k

queries one after other, for each query i am getting one LWLock but on
executing 200th query i am getting the error *ERROR: too many LWLocks
taken*.

But in each query i acquire and release that block. So that lock has to

be

flushed after executing query, but why am i getting this error.?

Is this due to *held_lwlocks *in LWLock.c is fixed only to some number

200

here.
Or am i missing something here.?

The most likely reason is that you have some code path in your extension
where
you don't release the LWLock. Without access to the code we can't do much
more
to help you I'm afraid. You could also try on a postgres build having
LWLOCK_STATS defined.

--
Julien Rouhaud
http://dalibo.com - http://dalibo.org