Lose Connection on Session Timeout ASP MVC and Silverlight

Lose Connection on Session Timeout ASP MVC and Silverlight

Postby nickandrew » Thu 20 Dec 2012 23:33

We currently have two types of applications (asp mvc and silverlight) using shared web services. These web services talk to our Data Models which are using (dotConnect for Oracle) linq to Oracle from DevArt.

The issue appears to occur after the app pool idle timeout occurs. Once that happens we can no longer access any of our data models and we will get an error message similar to:

: The type initializer for 'Common.DataModels.CommonDataModel' threw an exception.
Inner Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
at Devart.Data.Linq.CompiledQueryCache.RegisterDataContext(Type dataContextType)
at Common.DataModels.CommonDataModel..cctor()

The question is what would happen with the app pool in IIS 7.5 hits the idle timeout to cause this and how is the recommended way to resolve this?
nickandrew
 
Posts: 6
Joined: Thu 20 Dec 2012 23:25

Re: Lose Connection on Session Timeout ASP MVC and Silverlight

Postby MariiaI » Fri 21 Dec 2012 13:42

Could you please specify the version of dotConnect for Oracle you are using and describe the exact steps to reproduce this issue. If possible, please send us a sample project with which this error could be reproduced.

Also, you could try disabling the query cache. Please remove or comment the next line in the DataContext.Designer.cs file:
Code: Select all
public static CompiledQueryCache compiledQueryCache = CompiledQueryCache.RegisterDataContext(typeof([YourDataContextType]));

For more information about query cache please refer to http://www.devart.com/linqconnect/docs/CompiledQueries.html
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Lose Connection on Session Timeout ASP MVC and Silverlight

Postby nickandrew » Fri 21 Dec 2012 15:53

We are currently using version 3.1.34.0.
I will work on getting a sample project. I would think any simple project that has a web application talking to Web Services that talk to a DataService library which is using DevArt to map to the DB should be able to see this type of behavior.

But here are the steps that we see.

Applications are running on Windows Server 2008 R2. IIS7.5
Backend database is Oracle 11g.
We generate our DataModels from the database using the DevArt generator.
From there we have data services that manipulate the data (normal CRUD operations).
Our connection strings are stored in the web.config.

The issue seems to run fine for some time. Then after some point. Usually first thing in the morning after the IIS app pool hits the idle timeout limit we get the error the next time our application is loaded.

Doing an app pool recycle or an iisreset will allow everything to run and work propertly again until the next time.

Here is one common example of how our data data services look:

ConnectionString:
Code: Select all
<add name="AppConnectionString" connectionString="User Id=*******;
                                                  Password=*******;
                                                  Server=*****;
                                                  Home=***************;
                                                  Persist Security Info=True;
                                                  Validate Connection=True;" />


Code: Select all

public static VW_USER_DETAILS GetUserDetails(string userId)
{
  var context = new CommonDataModel(ConfigurationManager
                                    .ConnectionStrings["AppConnectionString"]
                                    .ConnectionString);

            var user = (from usr in context.VW_USER_DETAILS
                        where usr.USR_ID.ToUpper() == userId.ToUpper()
                              && !usr.LST_EFF_TS.HasValue
                        select usr).FirstOrDefault();

            return user;
}
nickandrew
 
Posts: 6
Joined: Thu 20 Dec 2012 23:25

Re: Lose Connection on Session Timeout ASP MVC and Silverlight

Postby MariiaI » Tue 25 Dec 2012 13:36

Thank you for the additional information. We couldn't reproduce this issue on our environment when performing the tests with an ASP.NET MVC3 application running on the IIS7 with repeated queries (application pool is ASP.NET v4.0, timeout is set to 1 minute).
We have tested it with LinqConnect 3.1.34 and later versions.

Also we are sending you this sample project to the e-mail address you provided in your forum profile. Please make changes to it and send it back to us or send us your sample project, so that we are able to investigate the issue in more details.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Lose Connection on Session Timeout ASP MVC and Silverlight

Postby MariiaI » Tue 25 Dec 2012 14:15

We are unable to send you the letter with the sample project. Our letter is probably blocked by the spam filter and it can not be correctly delivered. We are getting the following message:
Reason: Remote host said: 582 The file attached violates our email policy

Could you please specify another e-mail address, so that we are able to send you our sample.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17

Re: Lose Connection on Session Timeout ASP MVC and Silverlight

Postby nickandrew » Wed 26 Dec 2012 18:22

I have updated my email address please try to send it again.
nickandrew
 
Posts: 6
Joined: Thu 20 Dec 2012 23:25

Re: Lose Connection on Session Timeout ASP MVC and Silverlight

Postby StanislavK » Fri 28 Dec 2012 17:40

Sorry for the delay. We send you a sample project with a simple query performed against a DataContext.

We tried to reproduce the issue in the following way:
- published this application on the local IIS;
- set the idle timeout to 1 minute;
- run the application (at which moment the query is performed for the first time);
- waited till the timeout elapses;
- accessed the published application again.
In our environment, no error occurred.

Please specify if you can reproduce the issue with this application (in which case there should be some differences in the IIS configuration) or after modifying this application (in this case, please describe the changes you made).

Also, did you try updating to the latest version of LinqConnect/dotConnect for Oracle? There were multiple changes since LinqConnect 3.1.34, which could fix this particular issue.
StanislavK
Devart Team
 
Posts: 1710
Joined: Thu 03 Dec 2009 10:48


Return to dotConnect for Oracle