'Examples of deadlocks in APEX
For a school assignment I need to simulate a deadlock in the UI of my APEX application. I know how a deadlock works and why it occurs, but I cannot figure out how someone would simulate a deadlock in an APEX application.
Keep in mind, I don't mean the SQL editor in APEX, but the actual app builder.
When would one start a transaction and how would it occur that a started transaction would run long enough for another transaction to cause a deadlock.
Hope someone could help me because I really do not know how I would simulate such a case.
Thanks.
Solution 1:[1]
Setup:
create table T as select 0 x from dual union select 1 x from dual;
Then on a button press, have the following PLSQL code:
delete from t where x = :item;
dbms_session.sleep(30);
delete from t where x = (1-:item);
Then fire up two APEX sessions:
- Session1: Set :item to 0 and click the button
- Session 2: Set :item to 1 and click the button
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Connor McDonald |