Force Deadlocks

onki_sabanonki_saban Member Posts: 3
Hi,

I am running on NAV 2009 R2. I want to force my NAS into a deadlock. Any idea how to do this reliably?

Thanks in advance!

Comments

  • bbrownbbrown Member Posts: 3,268
    Can you explain why you want to do this? Is this for the purpose of testing?

    The problem with forcing a deadlock is you have no control over which process will be selected as the victim. It may be your NAS, or it may be the other process. So the behavior may not be what you are expecting.
    There are no bugs - only undocumented features.
  • onki_sabanonki_saban Member Posts: 3
    I want to investigate the behavior of the NAS Windows service when running into a dead lock. I saw some weird behavior where the service automatically stopped or sometimes could not be stopped at all.
  • Marije_BrummelMarije_Brummel Member, Moderators Design Patterns Posts: 4,262
    You can try this trick on my blog but replace the NAS code with a sleep and time well.

    http://nav-skills.com/2015/09/15/tip-53 ... -are-they/

    You can set the deadlock priority to make sure the correct process deadlocks.
  • TvisTvis Member Posts: 70
    If I really want to lock a table, for example the sales line table, I would make a codeunit containing this code:

    sl.LOCKTABLE;
    IF sl.FINDSET THEN
    REPEAT
    UNTIL sl.NEXT = 0;
    IF CONFIRM('XXX') THEN;

    That quite effectively locks that table for testing purposes.
Sign In or Register to comment.