The deadlock between RangeS-S and RangeI-N

Hi Experts , We are getting deadlocks in ranges-s and range1-N lock types, do you have any suggestion to avoid the kay range deadlocks. below given is the deadlock graph,
<deadlock>
<victim-list>
  <victimProcess id="process2e93b3708"/>
</victim-list>
  <process-list>
   <process id="process2e93b3708" taskpriority="0" logused="2376" waitresource="OBJECT: 7:509960893:17 " waittime="1164" ownerId="1271085938"
transactionname="trans" lasttranstarted="2015-02-04T14:00:38.883" XDES="0x18f71f640" lockMode="X" schedulerid="8" kpid="108668" status="suspended"
   spid="78" sbid="2" ecid="0" priority="0" trancount="2" lastbatchstarted="2015-02-04T14:00:38.883" lastbatchcompleted="2015-02-04T14:00:38.883"
clientapp=".Net SqlClient Data Provider" hostname="RMCPSM03020" hostpid="704" loginname="olmo16556" isolationlevel="serializable (4)" xactid="1271085938"
currentdb="8" lockTimeout="4294967295" clientoption1="671090784" clientoption2="128056">
    <executionStack>
     <frame procname="" line="188" stmtstart="14528" stmtend="18172" sqlhandle="0x0300080037dbf7648e94760033a400000100000000000000">
     </frame>
    </executionStack>
    <inputbuf>
Proc [Database Id = 8 Object Id = 1693965111]    </inputbuf>
   </process>
   <process id="process74664a748" taskpriority="0" logused="4560" waitresource="KEY: 7:72057595643363328 (ffffffffffff)" waittime="1178" ownerId="1271085958"
transactionname="trans" lasttranstarted="2015-02-04T14:00:38.887" XDES="0x5f48f45e0" lockMode="RangeI-N" schedulerid="18" kpid="12532" status="suspended"
   spid="68" sbid="2" ecid="0" priority="0" trancount="2" lastbatchstarted="2015-02-04T14:00:38.887" lastbatchcompleted="2015-02-04T14:00:38.887"
clientapp=".Net SqlClient Data Provider" hostname="RMCPSM03020" hostpid="704" loginname="olmo16556" isolationlevel="serializable (4)" xactid="1271085958"
currentdb="7" lockTimeout="4294967295" clientoption1="673187936" clientoption2="128024">
    <executionStack>
     <frame procname="" line="273" stmtstart="19774" stmtend="27910" sqlhandle="0x030007003517ef742e389e007fa200000100000000000000">
     </frame>
     <frame procname="" line="145" stmtstart="11104" stmtend="11362" sqlhandle="0x0300080037dbf7648e94760033a400000100000000000000">
     </frame>
    </executionStack>
    <inputbuf>
Proc [Database Id = 8 Object Id = 1693965111]    </inputbuf>
   </process>
  </process-list>
  <resource-list>
   <objectlock lockPartition="17" objid="509960893" subresource="FULL" dbid="7" objectname="" id="lock36a1d2700" mode="IX" associatedObjectId="509960893">
    <owner-list>
     <owner id="process74664a748" mode="IX"/>
    </owner-list>
    <waiter-list>
     <waiter id="process2e93b3708" mode="X" requestType="wait"/>
    </waiter-list>
   </objectlock>
   <keylock hobtid="72057595643363328" dbid="7" objectname="" indexname="" id="lock348222900" mode="RangeS-S" associatedObjectId="72057595643363328">
    <owner-list>
     <owner id="process2e93b3708" mode="RangeS-S"/>
    </owner-list>
    <waiter-list>
     <waiter id="process74664a748" mode="RangeI-N" requestType="wait"/>
    </waiter-list>
   </keylock>
  </resource-list>
</deadlock>
Shivraj Patil.

Shivraj, below is an example of using sp_getapplock to serialize access to the stored procedure.  I generally recommend this only as a last resort to avoid deadlocks since it will allow only one execution of the proc at a time.  Query and index
tuning are a better way to mitigate deadlock likelihood, if possilble.  You mention there is no explicit SERIALIZABLE.  Does that include the application code?
ALTER PROC dbo.usp_DeadlockProneCode
AS
SET XACT_ABORT ON;
DECLARE @return_code int;
BEGIN TRANSACTION;
EXEC @return_code = sp_getapplock
@Resource = 'dbo.usp_DeadlockProneCode'
, @LockMode = 'Exclusive'
, @LockOwner = 'Transaction';
IF @return_code < 0
BEGIN
RAISERROR('Unexpected return code %d from sp_getapplock', 16, 1, @return_code);
IF @@TRANCOUNT > 0 ROLLBACK;
RETURN @return_code;
END;
--deadlock prone code here
EXEC @return_code = sp_releaseapplock
@Resource = 'dbo.usp_DeadlockProneCode';
COMMIT TRANSACTION;
RETURN @return_code;
GO
Dan Guzman, SQL Server MVP, http://www.dbdelta.com

Similar Messages

  • What is the diffrence between a javabean and  EJB

    hi!
    what is the diffrence between a javabean and entreprise jvaabeans! i mean which are the uitilization featires of eaxh one !

    i am seeking for a solution for my problem , in fact i ma trying to implement and develop an application with java that allows a certain range of IP adresses to be connected to a database server in order to extract the suitable data from the server .
    let me explain mor ethe suitation , in fact what i am loking for is to use javabeans to grant my application much more consistence and pertinence : si i am asking if it could be possible to use javabeans in my case especially if i am not trying to developp a web application but a cleint /server one allowing some services.
    The application is in fact dealing with a stock exchange market and what i am trying to do is to grant particilar registrated customers to have the informations that they need ( portofolio, currency's status, market indicators, .) also drawing some charts decribing rates, variations, and others specefic financial caracterestics .So , if we consider that this application is not a web application ( no HTTP request and no servers like apache or others ) how it is possible to use javabeans and not EJB to build the application? i mean what could be suitable and preferable to rely on and dvelop to ensure a good java application !!
    if you need more details to help you find the answer for me don't hesitate to answer me back !!
    Someone here gave me that answer
    use RMI to code the services and (Updateable) Value Objects to pass the information between tiers.
    RMI is an all-java distributed component framework (ie. EJB, CORBA, DCE/RPC, DCOM, etc.), that is very suitable for developing non-containerized multi-tier applications. Refer to the RMI trail in the Java Tutorial as a starting point for coding RMI solutions (http://java.sun.com/docs/books/tutorial/index.html). Under this scenario you would code the database access service as an RMI service (server-side). Client/server communication should be facilitated through the use of JavaBeans/classes that wrap the information being passed (customer information, portfolio details, market information, etc.) - these are refered to as 'Updateable Value Objects' (a design pattern). Graphing and charting would be handled in your client from the information received from the (RMI) server. GUI JavaBeans can be used to provide this functionality as well as other client-side services. There are numerous "shrink-wrapped" components for GUIs available on the market just peruse any Java magazine to find them.
    but how comes? how can i do it !! and where can i find more information please about 'Updateable Value Object "
    thanks

  • Question the relationship between AR invoice and Outgoing payment

    Dear All,
    Does anyone the know the the relationship between AR invoice and Outgoing payment? because I would like to print the report in specific date range. For example, today is 02 July 2009. I want to print "AR invoice as at 31 Mar 2009", by using SQL. It seems like date back.
    From Samson

    Hi Samson,
                      Even i haven't done much r n d  bout this but what i came to know is that, there might be a scenario where you may want to make a payment to your customer. In this case we can use the Outgoing payment for the same. The system doesnt stop you from doin so. I have seen this in SAP B1 2005B, PL34.
    Regards,
    Joseph

  • What is the Difference between S/N and SINAD?

    Hey,
    can any one give me the answer for the following question.
    What is the difference between S/N and SINAD?

    S/N measures the difference typically between the signal (or full scale input range) and the thermal noise floor, usually in dB.
    SINAD is similar except for the fact that it also takes into account spurs in the frequency domain. So SINAD should always be <= S/N. SINAD is similar to Spurious-Free Dynamic Range (SFDR).
    Dynamic range is a term sometimes used for these concepts, but dynamic range is vague in that it doesn't make clear whether spurs should be taken into account. SFDR eliminates that ambiguity, as well as S/N or SNR.
    Regards,
    Andy Hinde
    National Instruments

  • The difference between chapter markers and dvd studio pro markers

    Does anyone know what is the difference between chapter markers and dvd studio pro markers? I can not find anywhere on Google. Also in the tutorials I have seen, suggesting DVD Studio Pro markers, but it did not mention the chapter markers.
    Thanks,

    "Adding Chapter and Compression Markers to Your Sequence
    Once you have your edited sequence or program finished, you can add markers to the sequence for use on DVD. Markers are reference points you can place within clips or sequences that identify specific frames. There are two kinds of markers you can add that directly relate to authoring a DVD—chapter markers and compression markers.
    • Chapter markers allow DVD authoring applications to create a navigable chapter list for your exported QuickTime movie. Chapter markers force MPEG keyframes (known as I-frames) at their location, since the DVD specification requires an I-frame at each chapter point.
    • Compression markers identify areas of abrupt change and include two types: those that are automatically inserted by Final Cut Pro at all edit points, and those you manually place in the clip or sequence. Like chapter markers, compression markers force I-frames at their location, although in this case it is for better quality encoding, and they are not used to create a chapter list.
    Note: When you export a QuickTime movie, you have an option to export various kinds of markers, including compression, chapter, or DVD Studio Pro markers. *When you choose to export DVD Studio Pro markers, Final Cut Pro actually exports chapter markers and all compression markers.* This includes compression markers you set manually, as well as ones created automatically by Final Cut Pro at edit and transition points."
    From the Final Cut Pro User Manual.
    So, JS was right the first time

  • The difference between an iphone and an ipod touch?

    i want to know if the difference between an iphone and an ipod touch is just that the iphone is like a phone that has internet and is a phone. or what else is it?

    The iPhone includes the same as an iPod Touch but also includes a phone, a camera, and a GPS radio.
    In addition to having internet access via wi-fi, the iPhone also has internet access via the cellular network, so as long as you have cellular reception with the iPhone, you have access to the internet in addition to having access via an available wi-fi network.

  • The difference between system restore and last good known configuration

    hi,
    what is the difference between system restore  and last good known configuration.
    in which situation you use system restore ,and in which situation you use last good known configuration.
    very short answer wil be enough.
    thanks
    johan
    h.david

    Last Known Good Configuration deals only with Starting Windows eg. a bad registry or incorrect driver is preventing Windows to start.It recovers the registry settings of HKEY_LOCAL_MACHINE\System\CurrentControlSet
    While System Restore uses restore points to return your system files and settings to an earlier point in time without affecting personal files. Restore points are created automatically every week, and just before significant system events, such as the installation
    of a program or device driver. You can also create a restore point manually.You can undone system restore but there is no such option in Last Known Good Configuration.
    Last Known Good Configuration is disabled in Windows 8 or,Windows 8.1 by default.
    Try using Last Known Good Configuration if you can't start Windows, but it started correctly the last time you turned on the computer.
    Try using System Restore to return the system to an earlier point in time when things worked correctly.
    S.Sengupta, Windows Entertainment and Connected Home MVP

  • What is the difference between Topic Keywords and Index File Keywords?

    What is the difference between Topic Keywords and Index File Keywords? Any advantages to using one over the other? Do they appear differently in the generated index?
    RH9.0.2.271
    I'm using Webhelp

    Hi there
    When you create a RoboHelp project you end up with many different ancillary files that are used to store different bits of information. Many of these files bear the name you assigned to the project at the time you created it. The index file has the project name and it ends with a .HHK file extension. (HHK meaning HTML Help Keywords)
    Generally, unless you change RoboHelp's settings, you add keywords to this file and associate topics to the keywords via the Index pod. At the time you compile a CHM or generate other types of output, the file is consulted and the index is built.
    As I said earlier, the default is to add keywords to the Index file until you configure RoboHelp to add the keywords to the topics themselves. Once you change this, any keyword added will become a META tag in the topic code. If your keyword is BOFFO, the META tag would look like this:
    <meta name="MS-HKWD" content="BOFFO" />
    When the help is compiled or generated, the Index (.HHK) file is consulted as normal, but any topics containing keywords added in this manner are also added to the Index you end up with. From the appearance perspective, the end user woudn't know the difference or be able to tell. Heck, if all you ever did was interact with the Index pod, you, as an author wouldn't know either. Well, other than the fact that the icons appear differently.
    Operationally, keywords added to the topics themselves may hold an advantage in that if you were to import these topics into other projects, the Index keywords would already be present.
    Hopefully this helps... Rick

  • What is the diffrence between sap events and application events

    Hi all,
    what is the diffrence between sap events and application events.Can any one tell me with examples.
    regards,

    Hi,
    Look at this,
    <b>System Events (Default)</b>
    The event is passed to the application server, but does not trigger the PAI. If you have registered an event handler method in your ABAP program for the event (using the SET HANDLER statement), this method is executed on the application server.
    Within the event handler method, you can use the static method SET_NEW_OK_CODE of the global class CL_GUI_CFW to set a function code and trigger the PAI event yourself. After the PAI has been processed, the PBO event of the next screen is triggered.
    The advantage of using this technique is that the event handler method is executed automatically and there are no conflicts with the automatic input checks associated with the screen. The disadvantage is that the contents of the screen fields are not transported to the program, which means that obsolete values could appear on the next screen. You can work around this by using the SET_NEW_OK_CODE method to trigger field transport and the PAI event after the event handler has finished.
    <b>Application Events</b>
    The event is passed to the application server, and triggers the PAI. The function code that you pass contains an internal identifier. You do not have to evaluate this in your ABAP program. Instead, if you want to handle the event, you must include a method call in a PAI dialog module for the static method DISPATCH of the global class CL_GUI_CFW. If you have defined an event handler method in your ABAP program for the event (using the SET HANDLER statement), the DISPATCH method calls it. After the event handler has been processed, control returns to the PAI event after the DISPATCH statement and PAI processing continues.
    The advantage of this is that you can specify yourself the point at which the event is handled, and the contents of the screen fields are transported to the application server beforehand. The disadvantage is that this kind of event handling can lead to conflicts with the automatic input checks on the screen, causing events to be lost.
    Hope u understood.
    Thanks&Regards,
    Ruthra.R

  • What is the diffrence between SAP View and CAD View ?

    What is the diffrence between SAP View and CAD View ?
    What is the main purpose of SAP View
    and
    What is the main purpose of CAD View
    On SAP help i found
    SAP View is used for :The SAP view displays the SAP structure (document-based structure) for the active CAD object, or another document info record (header document), with a single-level or multilevel document structure in a tree structure. You can variably configure the fields using the layout editor.
    CAD View is used for :The CAD view displays the document-based structure of the currently active CAD object, such as the structure of an assembly. The CAD system determines the complete (multilevel) structure and copies it either completely or in stages to the SAP system, in accordance with the default explosion level.
    BUT I did not understand it well
    Can someone explain this with an example
    THanks
    Raj

    Hello Raj,
    SAP View  can be further described as the view that is based on what is existing already in the SAP system. This view is generally used by SAP purchasing, MM people etc
    CAD view is nothing but the replication of the model tree view in the SAP system. This is used by the design engineer and this view replicates only the parts that are actively displayed on the CAD tool window.
    hope this helps. Let me know if you have further questions else please close the message.
    regards
    N K

  • What is the Diffrence between Oracle 11 and 11i

    What is the Diffrence between Oracle 11 and Oracle11i ?.
    With Rgds
    Arun J.Isaac

    Oracle 11i is internet based and run with java platform where we can see the applets downloading alongwith oracle forms and it refreshes all the jar files in oracle default directory.
    Oracle 11 is not intergrated with Java its an Oracle standalone platform.
    Regards,
    Arumugam S.

  • What is the difference between Video-out and mirroring?

    What is the difference between Video-out and mirroring? I can't get iPhone 4 video to work on my TV screen
    I have just bought an MD098ZM/A (Apple 30-pin Digital AV Adapter). I am struggling to get it to show a picture on my TV. I know I'm doing something right because the audio is coming out of my TV speakers but no picture on the TV screen.
    I have used the same HDMI channel (on the TV side) with the same cable and my thunderbolt port (MacBook Air) without any trouble - and on the same app (BBC iPlayer download then full-screen mode).
    Now I note that the packaging for the MD098ZM/A says video-out on iPhone 4 but mirroring only on iPhone 4S. I only have an iPhone 4 (not the 4S). Now if the lack of iPhone 4 support for mirroring means that I can't play video material out to my TV, then in what sense is there any video-out capability at all?
    There is only safety and warranty paperwork in the Apple adapter packaging - no help information. And I haven't found further guidance online either.
    I do note somewhere online that it suggests that basic non-mirroring video-out (for this adapter) only works with some external TV sets. Any way of finding out which? I'm using a Sanyo CE32LD90-B LCD TV if it helps.
    So far not doing very well.

    Now found these but have had to give up on this adapter!
    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf
    http://support.apple.com/kb/HT4108

  • What is the difference between jsp :include and server side include

    what is the difference between jsp :include and server side include(request dispatcher include method)????
    i understand that both request dispatcher include method and jsp:include take dynamic data,so when would one use request dispatcher include and when jsp:include.
    Is the usage interchangeable?i believe jsp include is used only for jsp/html but include directive can be used to include servlets ,jsp and html....correct me if i m wrong and
    do suggest if u hav ny other diff in this context...

    The difference really is: in what format do you want your inclusions? If your environment has many Java developers and only a few designers that focus mainly on, say, Flash, that might push you more towards the server-side include() directive. Or, if you have a large set of pages that receive dynamic content that is displayed in a consistent fashion (such as a workflow header area on a page).
    If, on the other hand, you have more web designers, there may be a greater desire to deal in markup rather than Java code. Java developers themselves might prefer to view markup (JSP) that more resembles the eventual output than something occuring in Java code.
    Finally, there are considerations of tiering. While it is totally possible to (and I have previously) implement 'view classes' that render markup or generate layout templates, JSP's offer, IMO, a subtle, psychological advantage. By forcing a developer to work in a different format, markup versus Java source, the separation on view from controller and model becomes a bit easier. It is still possible to make mistakes, but if a developer at some point notices, "Wait, I'm in a JSP, should I be importing a java.sql class?", then the choice to use JSP includes has paid off in spades.
    - Saish

  • Whats the difference between arrayCollection = null and arrayCollection.removeAll()?

    Whats the difference between arrayCollection = null and
    arrayCollection.removeAll()?

    In arrayCollection = null; statement you're setting this
    reference to null and potentially making it available for garbage
    collection. I say 'this reference' and potentially because, as you
    may know, there might be other references to this array collection
    object that won't be affected by this statement and hence it won't
    be GC'ed.
    arrayCollection.removeAll() says that I want to empty this
    array collection for all the reference that we pointing to it. That
    is, remove all the objects from the collection -- and of course
    make them 'potentially' available for the GC -- the size of the
    array collection would be reduced down to zero and all the
    references would be pointing to a valid but empty collection.
    Hope this helps.
    ATTA

  • What is the difference between Session timeout and Short Session timeout Under Excel Service Application -- session management?

    Under Excel Service Application --> session management; what is the difference between Session timeout and Short Session timeout?

    Any call made from the API will automatically be set to the “Session Timeout” period, no matter
    what. Calls made from EWA (Excel Web Access) will get the “Short Session Timeout” period assigned to it initially.
    Short Session Timeout and Session Timeout in Excel Services
    Short Session Timeout and Session Timeout in Excel Services - Part 2
    Sessions and session time-outs in Excel Services
    above links are from old version but still applies to all.
    Please remember to mark your question as answered &Vote helpful,if this solves/helps your problem. ****************************************************************************************** Thanks -WS MCITP(SharePoint 2010, 2013) Blog: http://wscheema.com/blog

Maybe you are looking for

  • Issue with F-92 incorrect accumluated deprecaition calculated in the sale

    We have discovered that SAP processes the disposal in a correct way but very strange. We found that although it does not do what appears to be a correct entry for accumulated depreciation at the time of the disposal (f-92) it proceeds to do a follow

  • Wanting One-Way Sync of Contacts and Calendars

    Hi: I'm a long-time happy user of MobileMe. Just got my mom an iPod Touch so that she can carry her contact list around with her instead of paper printouts of phone lists. I've set up a new user on my computer, transferred all her contacts to Address

  • Low Disk Space in the installation drive

    Dear all, One of our test server, is running out of space in the installation drive. Do we have any standard jobs/Tcodes to reduce/shrink the disk space of installation drive. Please share your inputs, Regards, Younus

  • Streaming from my mac to apple tv

    I have home sharing turned on but can't stream from my mac to my apple tv

  • Which iMac?

    I'm buying a new iMac for home. I want it to last as long as possible so my inclination is to spend a bit more on upgraded specs. I do some video conversion for Apple TV and some low-level photoshop and InDesign. RAM: I currently have a 2010 macbook