Devart Forum Index

The time now is Thu 09 Sep 2010 12:41

MySQL dotConnect Lockup/Infinite loop

 
Post new topic   Reply to topic    Devart Forum Index -> dotConnect for MySQL
View previous topic :: View next topic  
Author Message
ngoodwin



Joined: 29 Jul 2009
Posts: 9

PostPosted: Mon 11 Jan 2010 17:12    Post subject: MySQL dotConnect Lockup/Infinite loop Reply with quote

The following code sample creates what seems to be a recursive infinite loop. I suspect that when the connection exception occurs, it tries to close the connection and thus will tries to commit the open transaction, which fails and tries to close the connection, etc.

This happens on version 5.40.44.0. Can you please check if this is fixed in the current newest version? If so i will simply upgrade, however I'd like to avoid the upgrade process if the current version is fixed and just simply wait till a version with this bug fixed is released. Thank you.

Code:

/// <summary>
        /// Reproduce locked table bug for DevART MySQL
        /// </summary>
        private void BugRepro()
        {
            try
            {
                var connectionStringBuilder = new MySqlConnectionStringBuilder
                                              {
                                                      Host = "*",
                                                      UserId = "*",
                                                      Password = "*"
                                              };
                string cs = connectionStringBuilder.ToString();
                string dataBaseName = "devartBugRepro";
                string tableName = "testTable";
                string setupSchema = "CREATE DATABASE `" + dataBaseName
                                     +
                                     @"`;
                    CREATE TABLE  `"
                                     + dataBaseName + "`.`" + tableName
                                     +
                                     @"` (
                      `Id` int(11) NOT NULL auto_increment,
                      `Name` varchar(45) default NULL,
                      PRIMARY KEY  (`Id`)
                    ) ENGINE=InnoDB;";
                string dropSchema = "DROP DATABASE `" + dataBaseName + "`";
                using (var mysqlConn = new MySqlConnection(cs))
                {
                    mysqlConn.Open();
                    using (MySqlCommand cmd = mysqlConn.CreateCommand())
                    {
                        cmd.CommandText = setupSchema;
                        cmd.ExecuteNonQuery();
                        var endSignal = new ManualResetEvent(false);
                        var readySignal = new ManualResetEvent(false);
                        var lockThread =
                                new Thread(
                                        x =>
                                        this.LockDB(endSignal,
                                                    readySignal,
                                                    cs,
                                                    dataBaseName,
                                                    tableName));
                        lockThread.Start();
                        readySignal.WaitOne(); // Wait for thread to signal us to go.
                        cmd.CommandText = "USE " + dataBaseName;
                        cmd.ExecuteNonQuery();
                        using (var itx = mysqlConn.BeginTransaction())
                        {
                            using (var transCmd = mysqlConn.CreateCommand())
                            {
                                transCmd.Transaction = itx;
                                transCmd.CommandText = "INSERT INTO `" + tableName
                                                  +
                                                  "`  (`Id`, `Name`) VALUES (NULL, \"Nick\");";
                                transCmd.ExecuteNonQuery();
                                itx.Commit();
                            }
                        }

                        endSignal.Set();
                        cmd.CommandText = dropSchema;
                        cmd.ExecuteNonQuery();
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception in BugRepro: " + ex);
            }
        }

        /// <summary>
        /// Locks the DB.
        /// </summary>
        /// <param name="endSignal">
        /// The <see cref="ManualResetEvent"/> to end this thread.
        /// </param>
        /// <param name="readySignal">
        /// Signal we have locked the table and are finished.
        /// </param>
        /// <param name="connectionString">
        /// The connection string.
        /// </param>
        /// <param name="dataBaseName">
        /// Name of the database.
        /// </param>
        /// <param name="tableName">
        /// Name of the table.
        /// </param>
        private void LockDB(WaitHandle endSignal,
                            WaitHandle readySignal,
                            string connectionString,
                            string dataBaseName,
                            string tableName)
        {
            try
            {
                using (var mysqlConn = new MySqlConnection(connectionString))
                {
                    mysqlConn.Open();
                    using (MySqlCommand cmd = mysqlConn.CreateCommand())
                    {
                        cmd.CommandText = "USE " + dataBaseName;
                        cmd.ExecuteNonQuery();
                        cmd.CommandText = "LOCK TABLE " + tableName + " WRITE";
                        cmd.ExecuteNonQuery();
                        WaitHandle.SignalAndWait(readySignal, endSignal);
                    }
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine("Exception in LockDB Thread: " + ex);
            }
        }
Back to top
View user's profile Send private message
ngoodwin



Joined: 29 Jul 2009
Posts: 9

PostPosted: Tue 12 Jan 2010 13:47    Post subject: Reproducible in latest version Reply with quote

I have just used the same code sample as above to reproduce this bug in MySql DotConnection version 5.50.62.0. I really need a response soon, this bug is critical. I can't see a way to work around this without this problem being resolved.
Back to top
View user's profile Send private message
ngoodwin



Joined: 29 Jul 2009
Posts: 9

PostPosted: Wed 13 Jan 2010 19:53    Post subject: Reply with quote

I'd really like a reply here. I emailed you guys too and have not heard anything back. Would love to know if this will be fixed or not. This is a huge issue.
Back to top
View user's profile Send private message
Shalex
Devart Team


Joined: 14 Aug 2008
Posts: 1920

PostPosted: Mon 18 Jan 2010 10:44    Post subject: Reply with quote

We are investigating the issue. We will notify you about the results as soon as possible.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
ngoodwin



Joined: 29 Jul 2009
Posts: 9

PostPosted: Tue 19 Jan 2010 15:32    Post subject: Reply with quote

Do you guys have a timeframe? This is causing a critical issue here and we are really interested in a fix.
Back to top
View user's profile Send private message
StanislavK
Devart Team


Joined: 03 Dec 2009
Posts: 554

PostPosted: Wed 20 Jan 2010 14:00    Post subject: Reply with quote

We have fixed the issue. The fix will be available in the nearest build. We plan to release it in the end of the month.

To receive the build before it is released, please contact us:
http://www.devart.com/company/contact.html
If you have an active license, please specify its number. Otherwise, we can send you the trial edition.
Back to top
View user's profile Send private message
ngoodwin



Joined: 29 Jul 2009
Posts: 9

PostPosted: Wed 03 Feb 2010 19:13    Post subject: Reply with quote

Any update on the release of this?
Back to top
View user's profile Send private message
Shalex
Devart Team


Joined: 14 Aug 2008
Posts: 1920

PostPosted: Thu 04 Feb 2010 10:35    Post subject: Reply with quote

We plan to make a new build next week.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
StanislavK
Devart Team


Joined: 03 Dec 2009
Posts: 554

PostPosted: Tue 09 Feb 2010 14:40    Post subject: Reply with quote

The new 5.70.90 Beta build of dotConnect for MySQL is available for download now. It can be downloaded from
http://www.devart.com/dotconnect/mysql/download.html
(trial version) or from Registered Users' Area (for users with active subscription only). For more information, please refer to
http://www.devart.com/forums/viewtopic.php?t=17059.
Back to top
View user's profile Send private message
ngoodwin



Joined: 29 Jul 2009
Posts: 9

PostPosted: Tue 09 Feb 2010 17:07    Post subject: Reply with quote

Any idea when this will be released non-beta? We do not want to put the beta inside of our production release.
Back to top
View user's profile Send private message
StanislavK
Devart Team


Joined: 03 Dec 2009
Posts: 554

PostPosted: Tue 09 Feb 2010 17:22    Post subject: Reply with quote

The build is called Beta because it includes major changes intended to support Entity Framework v4 Beta 2. These changes mostly concern the Devart Entity Developer application. dotConnect for MySQL itself is stable.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Devart Forum Index -> dotConnect for MySQL All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum