I am having the problem with EndExecuteReader again.
This issue was fixed in the version 3.50, but it came back.
Here is the topic from a year ago:
http://www.crlab.com/forums/viewtopic.p ... cutereader
There is a little difference to it now though, it works fine when you lock the 1st child, but it doesn't work when you lock the second child.
Here is how to reproduce:
1.Create records:
Code: Select all
USE test;
CREATE TABLE test.parenttable (
parentid INT(11) NOT NULL AUTO_INCREMENT,
parentname VARCHAR(20),
PRIMARY KEY (parentid)
)
AUTO_INCREMENT=1
CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE TABLE test.childtable (
childid INT(11) NOT NULL AUTO_INCREMENT,
parentid INT(11) NOT NULL,
childname VARCHAR(20),
PRIMARY KEY (childid),
INDEX childtable_FK1 USING BTREE (parentid),
CONSTRAINT childtable_FK1 FOREIGN KEY (parentid)
REFERENCES parenttable(parentid) ON DELETE CASCADE ON UPDATE CASCADE
)
AUTO_INCREMENT=1
CHARACTER SET utf8 COLLATE utf8_general_ci;
INSERT INTO parenttable(parentname) values("Parent 1");
INSERT INTO parenttable(parentname) values("Parent 2");
INSERT INTO parenttable(parentname) values("Parent 3");
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 1" FROM parenttable t1 WHERE parentid = 1;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 2" FROM parenttable t1 WHERE parentid = 1;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 3" FROM parenttable t1 WHERE parentid = 1;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 4" FROM parenttable t1 WHERE parentid = 1;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 5" FROM parenttable t1 WHERE parentid = 1;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 1-2" FROM parenttable t1 WHERE parentid = 2;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 2-2" FROM parenttable t1 WHERE parentid = 2;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 3-2" FROM parenttable t1 WHERE parentid = 2;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 4-2" FROM parenttable t1 WHERE parentid = 2;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 5-2" FROM parenttable t1 WHERE parentid = 2;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 1-3" FROM parenttable t1 WHERE parentid = 3;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 2-3" FROM parenttable t1 WHERE parentid = 3;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 3-3" FROM parenttable t1 WHERE parentid = 3;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 4-3" FROM parenttable t1 WHERE parentid = 3;
INSERT INTO childtable(parentid, childname) SELECT t1.parentid, "Child 5-3" FROM parenttable t1 WHERE parentid = 3;
Code: Select all
SET AUTOCOMMIT=0;
BEGIN;
SELECT * FROM childtable WHERE childid=2 FOR UPDATE;
4. Run the Test Project that I provided.
Let's try to Select for UPDATE parent with parentid=1. Keep in mind that Child 2 is locked on the client 1.
Once the Form is shown, type 1 in the "Primary Key" field.
Click "Try to Update" button.
(NOTE: my 'innodb_lock_wait_timeout' variable is set to 10 seconds)
After 10 seconds the 'innodb_lock_wait_timeout' occurs, the EndExecuteReader(result) is called, where the Exception should have been raised that the 'lock_wait_timeout' occured.
Instead, it creates the reader and reader.HasRows equals true and reader.Read() is true because there was one row that was fetched.
And only when you try to do reader.Close() it raises "Index was outside the bounds of the array." exception.
// *********************************
If you Lock the Child 1 in step 3, the 'innodb_lock_wait_timeout' willbe caught in EndExecuteReader() call.
Please help us out, our Product was released erlier this week into prduction.
We desperately need the fix for this issue.
I will send the test project to you in a few minutes.
My System is XP Pro SP2, VS2005 C#, MyDirect 4.2.18[/code], MySql Server is 5.0.44 Commercial using innodb storage engin.
Please let me know if you need any help from my side.
Thanks.
Tim