Keep getting exception after some time of running

Discussion of open issues, suggestions and bugs regarding LinqConnect – Devart's LINQ to SQL compatible ORM
Post Reply
dilbert
Posts: 68
Joined: Tue 28 Apr 2009 10:11

Keep getting exception after some time of running

Post by dilbert » Sat 09 Jan 2010 14:21

We are using devart connector on our production server (dotConnect for MySQL 5.50.62).

After some time (not regular intervals, e.g. 2 days) the application starts to raise exception in devart classes. Sometimes it happens even right after the application restart. The application never recovers from this error and needs to be restarted.
I can also assure that new datacontext is initialized for each query.

This behaviour not depends on a particular query. It is simply the first query executed on the page. However, the error message is different for different type of query (Single(), ToList() etc.)

Here is the stack trace. The first one for SingleOrDefault() method, the second one for ToList() method:

Code: Select all

Object reference not set to an instance of an object.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
   at Devart.Data.Linq.Provider.DataSourceInfo.TypeSystemProvider.GetProviderType(String typeName)
   at Devart.Data.Linq.Provider.Query.SqlFactory.Default(MetaDataMember member)
   at Devart.Data.Linq.Provider.Query.SqlFactory.a(SqlExpression A_0, MetaDataMember A_1)
   at Devart.Data.Linq.Provider.Query.aq.a(f A_0, MetaType A_1, List`1& A_2, List`1& A_3, SqlExpression& A_4, IList`1 A_5)
   at Devart.Data.Linq.Provider.Query.aq.b(f A_0, MetaType A_1, List`1& A_2, List`1& A_3, SqlExpression& A_4, IList`1 A_5)
   at Devart.Data.Linq.Provider.Query.aq.a(f A_0, IList`1 A_1)
   at Devart.Data.Linq.Provider.Query.bj.a(ITable A_0)
   at Devart.Data.Linq.Provider.Query.bj.j(Expression A_0)
   at Devart.Data.Linq.Provider.Query.bj.a(Expression A_0, LambdaExpression A_1)
   at Devart.Data.Linq.Provider.Query.bj.b(MethodCallExpression A_0)
   at Devart.Data.Linq.Provider.Query.bj.j(Expression A_0)
   at Devart.Data.Linq.Provider.Query.bj.b(Expression A_0, LambdaExpression A_1, Boolean A_2)
   at Devart.Data.Linq.Provider.Query.bj.b(MethodCallExpression A_0)
   at Devart.Data.Linq.Provider.Query.bj.j(Expression A_0)
   at Devart.Data.Linq.Provider.Query.bj.i(Expression A_0)
   at Devart.Data.Linq.Provider.DataProvider.a(Expression A_0)
   at Devart.Data.Linq.Provider.DataProvider.h(Expression A_0)
   at Devart.Data.Linq.DataQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
   at System.Linq.Queryable.SingleOrDefault[TSource](IQueryable`1 source)
   at ...

Code: Select all

Index was outside the bounds of the array.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
   at Devart.Data.Linq.Provider.DataSourceInfo.TypeSystemProvider.GetProviderType(String typeName)
   at Devart.Data.Linq.Provider.Query.SqlFactory.Default(MetaDataMember member)
   at Devart.Data.Linq.Provider.Query.SqlFactory.a(SqlExpression A_0, MetaDataMember A_1)
   at Devart.Data.Linq.Provider.Query.aq.a(f A_0, MetaType A_1, List`1& A_2, List`1& A_3, SqlExpression& A_4, IList`1 A_5)
   at Devart.Data.Linq.Provider.Query.aq.b(f A_0, MetaType A_1, List`1& A_2, List`1& A_3, SqlExpression& A_4, IList`1 A_5)
   at Devart.Data.Linq.Provider.Query.aq.a(f A_0, IList`1 A_1)
   at Devart.Data.Linq.Provider.Query.bj.a(ITable A_0)
   at Devart.Data.Linq.Provider.Query.bj.j(Expression A_0)
   at Devart.Data.Linq.Provider.Query.bj.a(Expression A_0, Expression A_1, LambdaExpression A_2, LambdaExpression A_3, LambdaExpression A_4)
   at Devart.Data.Linq.Provider.Query.bj.b(MethodCallExpression A_0)
   at Devart.Data.Linq.Provider.Query.bj.j(Expression A_0)
   at Devart.Data.Linq.Provider.Query.bj.b(Expression A_0, LambdaExpression A_1, as A_2)
   at Devart.Data.Linq.Provider.Query.bj.b(MethodCallExpression A_0)
   at Devart.Data.Linq.Provider.Query.bj.j(Expression A_0)
   at Devart.Data.Linq.Provider.Query.bj.d(Expression A_0, Expression A_1)
   at Devart.Data.Linq.Provider.Query.bj.b(MethodCallExpression A_0)
   at Devart.Data.Linq.Provider.Query.bj.j(Expression A_0)
   at Devart.Data.Linq.Provider.Query.bj.i(Expression A_0)
   at Devart.Data.Linq.Provider.DataProvider.a(Expression A_0)
   at Devart.Data.Linq.Provider.DataProvider.h(Expression A_0)
   at Devart.Data.Linq.DataQuery`1.i()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at ...
Thanks for the attention in advance.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Tue 12 Jan 2010 16:28

Thank you for the report, we will investigate the situation.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Thu 14 Jan 2010 09:23

The problem is probably caused by the usage of our components in multi-threaded environment.
Devart.Data.Linq.DataContext is not a thread-safe class (just as System.Data.Linq.DataContext).
Please let me know if the problem is reproducible in a single-threaded environment.

dilbert
Posts: 68
Joined: Tue 28 Apr 2009 10:11

Post by dilbert » Thu 14 Jan 2010 13:00

Thank you for your answer.

However, I do not think the problem is connected to multithreading. We do not use it.

It is not easy to simulate this behaviour. After some observation we have found out some other details. The problem happens only after session is lost (honestly, i'm not sure why - may be application is restarted or recycled for any reason). But the exception raises very rarely (1-2 times per day), if the application is properly restarted or updated it runs properly.

I really assume that problem is in the connection between mysql and devart connector. Can you please clarify which object has null reference in the method GetProviderType?

I have really no idea which workaround can be used for this situation because datacontext is created just for the query and disposed right after it, like here:

Code: Select all

using (DBContext db = new DBContext(_connectionString) 
{
     user = db.Users.Where(u => u.Username.Equals(_username)).SingleOrDefault();
}

I would appreciate any suggestion.

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Fri 15 Jan 2010 08:59

Unfortunately, we are unable to reproduce the problem.
Could you please create a small test project reproducing the situation?

[email protected]
Posts: 43
Joined: Wed 17 Sep 2008 11:31

Post by [email protected] » Thu 04 Feb 2010 10:34

Hello

We have the same problem on our production server. It currently happens about 50 times a day.

In my case, i think it has to do with Multi-Threading. Because our Application runs as a WCF Service, a lot of requests can happen at the same time.

I created a Test-Case using a Background-Worker. There I can sometimes reproduce the Problem. It does not happen every time i start a debug session. Sometimes I need about 10 attempts until the error occurs.

The Test-Project can be downloaded here:
http://www.yousendit.com/download/S1VEa ... M21Ga1E9PQ

Thanks for your help, how we can fix this problem.
________
NEW JERSEY MARIJUANA DISPENSARY
Last edited by [email protected] on Thu 17 Feb 2011 05:24, edited 1 time in total.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 08 Feb 2010 12:25

Thank you for your test project. We have resolved the problem with sharing a static resource between several threads. This fix is not included to the upcoming build of new beta version. I will post here when an appropriate build is available.

Shalex
Site Admin
Posts: 9543
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Fri 19 Feb 2010 10:36

New build of dotConnect for Oracle 5.55.97 Beta is available for download now.
It can be downloaded from http://www.devart.com/dotconnect/oracle/download.html (trial version) or from Registered Users' Area (for users with valid subscription only).
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=17143 .

djenka
Posts: 5
Joined: Wed 19 May 2010 11:08

mysql

Post by djenka » Wed 19 May 2010 11:10

when will be this fixed for mysql

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 19 May 2010 12:30

This problem is fixed since the 5.70.97 build of dotConnect for MySQL.
I recommend you to upgrade to the latest 5.70.124 build of dotConnect for MySQL.

djenka
Posts: 5
Joined: Wed 19 May 2010 11:08

Post by djenka » Wed 19 May 2010 12:39

tnx,
i have licence for dotConnect for MySQL Professional 5.50.79,
meaning that i should renew, yes?

AndreyR
Devart Team
Posts: 2919
Joined: Mon 07 Jul 2008 13:16

Post by AndreyR » Wed 19 May 2010 15:41

For purchase and upgrading related questions please contact our sales (sales * devart * com).

djenka
Posts: 5
Joined: Wed 19 May 2010 11:08

Post by djenka » Thu 20 May 2010 08:54

i have posted some question through support channel but i have no response till now

Post Reply