[
https://issues.apache.org/jira/browse/DERBY-5073?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13005564#comment-13005564
]
Knut Anders Hatlen commented on DERBY-5073:
-------------------------------------------
To illustrate the point in my previous comment, here's the first deadlock error
when running the attached repro:
A lock could not be obtained due to a deadlock, cycle of locks and waiters is:
Lock : ROW, T, (1,7)
Waiting XID : {182, S} , APP, select x from t where x = 1
Granted XID : {162, X}
Lock : ROW, T, (1,8)
Waiting XID : {162, S} , APP, select x from t where x = 2
Granted XID : {166, X}
Lock : ROW, T, (1,9)
Waiting XID : {166, S} , APP, select x from t where x = 3
Granted XID : {170, X}
Lock : ROW, T, (1,7)
Waiting XID : {170, S} , APP, select x from t where x = 1
. The selected victim is XID : 182.
No one is waiting for tx 182, so aborting it doesn't really resolve the
deadlock, and therefore other transactions will have to be aborted later. Also
note that the data for row (1,7) has been split in two in the output.
> Derby deadlocks without recourse on simultaneous correlated subqueries
> ----------------------------------------------------------------------
>
> Key: DERBY-5073
> URL: https://issues.apache.org/jira/browse/DERBY-5073
> Project: Derby
> Issue Type: Bug
> Components: Services
> Affects Versions: 10.0.2.1, 10.1.2.1, 10.2.2.0, 10.3.3.0, 10.4.2.0,
> 10.5.3.0, 10.6.2.1, 10.7.1.1, 10.8.0.0
> Reporter: Karl Wright
> Attachments: Derby5073.java, derby-5073-1a.diff
>
>
> When the following two queries are run against tables that contain the
> necessary fields, using multiple threads, Derby deadlocks and none of the
> queries ever returns. Derby apparently detects no deadlock condition, either.
> SELECT t0.* FROM jobqueue t0 WHERE EXISTS(SELECT 'x' FROM carrydown t1 WHERE
> t1.parentidhash IN (?) AND t1.childidhash=t0.dochash AND t0.jobid=t1.jobid)
> AND t0.jobid=?
> SELECT t0.* FROM jobqueue t0 WHERE EXISTS(SELECT 'x' FROM carrydown t1 WHERE
> t1.parentidhash IN (?) AND t1.childidhash=t0.dochash AND t0.jobid=t1.jobid
> AND t1.newField=?) AND t0.jobid=?
> This code comes from Apache ManifoldCF, and has occurred when there are five
> or more threads trying to execute these two queries at the same time.
> Originally we found this on 10.5.3.0. It was hoped that 10.7.1.1 would fix
> the problem, but it hasn't.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira