An abnormal ThreadAbortException during multi insert

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for SQLite
Post Reply
virgile
Posts: 1
Joined: Mon 11 Jan 2010 11:47

An abnormal ThreadAbortException during multi insert

Post by virgile » Mon 11 Jan 2010 12:20

Hi,

I'm facing a odd problem during an insert operation on SQLite. My program is based on Quartz.net and SQLite to make statistics at scheduled times.

But during the insert operations the thread is stopped without error excepted an ThreadAbortException exception. I tried to identify the problem with debug mode but the exception is thrown anywhere in the below method.

Code: Select all

public void ExecuteNonQuery(DbQuery[] queries)
        {
            using (SQLiteConnection connexion = new SQLiteConnection("Data Source=" + absolutepath))
            {
                connexion.Open();

                using (SQLiteTransaction dbTrans = connexion.BeginTransaction(System.Data.IsolationLevel.ReadCommitted))
                {
                    try
                    {
                        foreach (DbQuery query in queries)
                        {
                            SQLiteCommand mycommand = connexion.CreateCommand();
                            mycommand.Connection = connexion;
                            mycommand.Transaction = dbTrans;
                            mycommand.CommandText = query.sql;
                            mycommand = this.InjectParameters(query.parameters, mycommand);
                            mycommand.ExecuteNonQuery();
                        }
                        dbTrans.Commit();
                    }
                    catch (Exception exc)
                    {
                        dbTrans.Rollback();
                    }
                    finally
                    {
                        connexion.Close();
                    }
                }
            }
        }

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Wed 13 Jan 2010 16:01

Please ensure that you don't use the non-thread-safe SQLiteConnection component within multithreading environment. ThreadAbortException most probably indicates such a situation.

Otherwise, please send us a small test project reproducing the problem, including the database file and the exact text of insert commands.

Post Reply