Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread LockSemaphore not respected between servers
Sun, Feb 26 2023 5:07 AMPermanent Link

Norman Rorke

I have two servers accessing the same database. It appears that, unlike the table.Lock function which fails if the same table has already been locked by an application on another server, the table.LockSemaphore function allows two applications to successfully lock the same semaphore if the applications are accessing the target table through different servers.

Can somebody confirm that this is the case.
Sun, Feb 26 2023 2:29 PMPermanent Link

Raul

Team Elevate Team Elevate

<<

I have two servers accessing the same database. It appears that, unlike the table.Lock function which fails if the same table has already been locked by an application on another server, the table.LockSemaphore function allows two applications to successfully lock the same semaphore if the applications are accessing the target table through different servers.

Can somebody confirm that this is the case.
>>

Can you clarify what do you mean by servers - i.e. are they using local or remote sessions ?

Did a quick test and works OK for me when using remote - LockSemaphore fails for any other session (on same or different DBSRVR) against the same DB and table.  

I have one server on 12005 and one on 12007 - app instance A on 12005 uses myTable.LockSemaphore(10)  which succeeds.  App instance 2 on 12007 sees myTable.LockSemaphore(10) as failed. App instance 3 on 12005 also fails (as expected).


Raul
Sun, Feb 26 2023 4:56 PMPermanent Link

Norman Rorke

Raul wrote:

<<

Can you clarify what do you mean by servers - i.e. are they using local or remote sessions ?

Did a quick test and works OK for me when using remote - LockSemaphore fails for any other session (on same or different DBSRVR) against the same DB and table.  

I have one server on 12005 and one on 12007 - app instance A on 12005 uses myTable.LockSemaphore(10)  which succeeds.  App instance 2 on 12007 sees myTable.LockSemaphore(10) as failed. App instance 3 on 12005 also fails (as expected).


Raul

>>

Raul,

Thanks for checking and confirming. I have subsequently debugged and found the issue, my semaphore parameter is calculated dynamically and this is where things went wrong. All sorted now.
Image