xTuple.com xTupleU Blog & News Customer Support

Cannot acquire lock

using Windows 5.1

On the core vendor list screen, we have the following:

  1. Click on any vendor
  2. Close the vendor
  3. Quickly click on the vendor again

then we get the message “Cannot acquire lock”

Is this a database issue ?
or because I have custom tabs in the vendor screen; I am not closing my custom tabs?

I have tried to refresh the PG Lock screen but never see any locks.

Thank you
Bob

This is a client-side timing issue. The application releases the lock while cleaning up after the Vendor window closes. As you noted there’s a brief delay. I’m surprised that delay is long enough for a person to catch.

For folks monitoring the database, look for a lock type of “advisory” when querying the pg_locks view. We use Postgres advisory locks to limit access in the desktop client:

PostgreSQL provides a means for creating locks that have application-defined meanings. These are called advisory locks , because the system does not enforce their use — it is up to the application to use them correctly.

This is strange Gil, I only see two advisory locks on the dev database that I use.
They are both on the database itself and no tables.
When I open a vendor, no additional advisory locks are created in pg_catalog.pg_locks

Can you tell me where in the code,that this check is made? I do have the source to analyse.
The other reason is ; we have custom screens and we would like to implement this check in our custom screens.

Thank you

Bob

Thanks, Gil. I am seeing advisory locks in our development database. How do these get released?

There is an advisory lock for the client session. I don’t remember why.

For everything else search the code for the AppLock class.