Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 754257
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:59:29+00:00 2026-05-14T14:59:29+00:00

We have a system that uses sp_getapplock to create an exclusive mutex any time

  • 0

We have a system that uses sp_getapplock to create an exclusive mutex any time someone opens an order in the GUI. This is used to prevent multiple people from making changes to an order simultaneously.

Sometimes people will open an order and go home, leaving it open. This effectively blocks anyone from being able to make changes to the order. I then get emails, calls and end up doing a kill <spid> in enterprise manager. Obviously I’ve gotten sick of this and want to make a quick self-service webform.

The main problem I’ve run into is that kill requires sysadmin privileges, which I do not want to give to the user that the our website runs as. I have tried sp_releaseapplock but this doesn’t let you release another user’s lock (even when calling it as a sysadmin).

So, finally my question; does anyone know of an alternative method to release a lock that was obtained by another user using sp_getapplock?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T14:59:30+00:00Added an answer on May 14, 2026 at 2:59 pm

    The documentation is pretty clear on this point:

    Locks placed on a resource are associated with either the current transaction or the current session. Locks associated with the current transaction are released when the transaction commits or rolls back. Locks associated with the session are released when the session is logged out. When the server shuts down for any reason, all locks are released.

    Applocks are analogous to Critical Sections – the primary reason for their existence is so that other threads can’t simply override them, unless they have privileges to kill the process that’s holding the lock.

    Have you considered using some form of optimistic concurrency instead? Applocks are intended to be held for less than a second at a time – i.e. the duration of a typical transaction. It’s normally not a good idea to hold onto one for several minutes (or hours) for precisely this reason.

    If you must use applocks this way, and can’t use optimistic concurrency, then I believe your only recourse is to kill the spid that owns the lock.

    If you don’t want to give sysadmin privileges to the user, you could create a Stored Procedure to kill the process WITH EXECUTE AS <admin_user>… keeping in mind, of course, that this opens up a pretty wide security hole, so be very careful who you grant execute permissions to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a WCF service that uses a System.ServiceModel.Syndication.SyndicationFeed to create an RSS feed.
I have written a plugin system that uses an interface and for any plugins
I have a Windows service that uses ImpersonateLoggedOnUser in order to drop the system
So I have this notification system that uses jQuery and PHP. The jQuery checks
We have system here that uses Java JNI to call a function in a
I have a system that uses a meta refresh to a logout page, which
I have an old system that uses XML for it's data storage. I'm going
I have content management system application that uses a polymorphic tree table as the
I have a C# program that uses System.Data.OracleClient to access an oracle database. The
I have an asp.net app that uses System.IO.Path.GetTempFileName() for temporary files. In the production

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.