Bug #50107 MySQL connector/net throws IndexOutOfRange error when missing a stored procedure
Submitted: 6 Jan 2010 16:34 Modified: 8 Feb 2010 21:52
Reporter: Fred Kuipers Email Updates:
Status: No Feedback Impact on me:
Category:Connector / NET Severity:S3 (Non-critical)
Version: OS:Windows
Assigned to: Assigned Account CPU Architecture:Any
Tags: mysql connector .net cluster

[6 Jan 2010 16:34] Fred Kuipers
We're running a MySQL cluster (ndb-7.0.8) on Windows Server 2003. We had a node fail and upon updating our connection string to point to another node in the cluster, we got the following error:

Message="There is no row at position 0."
  at System.Data.RBTree`1.GetNodeByIndex(Int32 userIndex)
  at System.Data.RBTree`1.get_Item(Int32 index)
  at System.Data.DataRowCollection.get_Item(Int32 index)
  at MySql.Data.MySqlClient.StoredProcedure.Resolve()
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)
  at MySql.Data.MySqlClient.MySqlCommand.ExecuteDbDataReader(CommandBehavior behavior)

After some investigation, I found this relavent bug: http://bugs.mysql.com/bug.php?id=20938

We have since created the stored procedures on every node in the cluster and solved the original problem, but I believe the connector is not properly handling the error from the cluster node. I expected a message saying that a stored procedure could not be found on the server.

Connection string in use:
Database=<databaseName>;Server=<hostip>;User Id=<username>;Password=<secret>;use procedure bodies=false

How to repeat:
To reproduce:
- Set up a mysql cluster > 1 node. Create a table with a simple Stored procedure to get all records from that table -- but create this stored procedure on only 1 node.
- Write a simple .NET program that uses the mysql .NET connector to call the stored procedure.
- Test on each node in the cluster. 
- On nodes that do not have the stored procedure defined, see the above error.

This may also be the case if there is no cluster and the SP is simply missing.

Suggested fix:
Expected Behavior: A mysql error message saying the procedure is not defined and not an IndexOutOfRangeException. (If possible, can we make note that the stored procedure must be defined on every node in the cluster if we can tell it's a cluster node?)
[6 Jan 2010 16:42] Fred Kuipers
Correction: the mysql cluster was running on a Linux server, the .NET program that was attempting to use the cluster was running on Windows Server 2003 or Windows Vista (SP2).
[8 Jan 2010 21:52] Reggie Burnett
I went all the back to 5.1.0 and tried to reproduce this.  I had my mysqld on ubuntu 9.10 with my client prog on windows 7 x64.  I got a mysql exception with proper message.  Please explain how to reproduce this.
[9 Feb 2010 0:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".