Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / ASP.NET / General / August 2007

Tip: Looking for answers? Try searching our database.

Sessions timing out quickly despite very high timeout set in web.config

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Alex - 24 Aug 2007 18:58 GMT
Hello,

We have a large asp.net writtin in VB.Net 2003, and for some reason the
sessions have started timing out very quickly, like 5-10 minutes in some
cases.  In web.config we have the SessionState timeout set at 720 minutes,
but this doesn't seem to help.

What we're seeing is users working in the system just fine, then they'll get
the following error when the application tries to reference the session:

-[Begin Snippet]-------------------------------------
Server Error in '/' Application.

Object reference not set to an instance of an object.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.NullReferenceException: Object reference not set
to an instance of an object.

Source Error:
An unhandled exception was generated during the execution of the current web
request. Information regarding the origin and location of the exception can
be identified using the exception stack trace below.

Stack Trace:
[NullReferenceException: Object reference not set to an instance of an
object.]
  Sigma.DetailsReport.RetrieveData() in
C:\Inetpub\wwwroot\App\Loan\Details.aspx.vb:107
  Sigma.DetailsReport.Page_Load(Object sender, EventArgs e) in
C:\Inetpub\wwwroot\App\Loan\Details.aspx.vb:71
  System.Web.UI.Control.OnLoad(EventArgs e) +67
  System.Web.UI.Control.LoadRecursive() +35
  System.Web.UI.Page.ProcessRequestMain() +750

Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
Version:1.1.4322.2300
-[End Snippet]-------------------------------------

When reviewing the code from the trace, it always is something that
references something in the Session, and my assumption is the session has
expired causing a null to be returned.

I'm fairly new to the world of VB, but being a seasoned web coder of other
languages I'm not sure exactly what to try next.  I'm working on adding code
to detect the timeout and return something other then a .Net error, but this
still won't help the fact that our sessions are timing out in a matter of
minutes when they shouldn't be.

Thanks in advance for any advise or suggestions on this --

Alex
Peter Bromberg [C# MVP] - 24 Aug 2007 19:20 GMT
It might be the Session is expired, or it could just be that the object
attempting to be referenced is null ("Nothing in VB.NET").

I see 2 things you might do to help improve things:
1) Set Option Explicit and Option Strict to "on". This at least attempts to
put you on a level playing field with us C# folks.
2) Wire up your app with unhandled exception handling and logging in your
Application_Error handler in global.asax.
-- Peter
Recursion: see Recursion
site:  http://www.eggheadcafe.com
unBlog:  http://petesbloggerama.blogspot.com
BlogMetaFinder:    http://www.blogmetafinder.com

> Hello,
>
[quoted text clipped - 50 lines]
>
> Alex
bruce barker - 24 Aug 2007 19:23 GMT
check the event log (on the iis box) for recycle events. these will
happen if your site uses too much memory (large sessions, memory leaks,
etc) or has hanging threads.

if your app is not written to gracefully handle a lost session, then you
should not use inproc sessions.

-- bruce (sqlwork.com)

> Hello,
>
[quoted text clipped - 50 lines]
>
> Alex
Alex - 24 Aug 2007 20:07 GMT
Hi Bruce,

Actually I hadn't thought about checking the server event log...  I did so
and noticed several errors like this:

Event Type: Information
Event Source: W3SVC
Event Category: None
Event ID: 1117
Date:  8/24/2007
Time:  12:43:20 PM
User:  N/A
Computer: WEBSERVER01
Description:
A worker process with process id of '3120' serving application pool 'USPool'
has requested a recycle because it reached its private bytes memory limit.

Then about a minute later:

Event Type: Warning
Event Source: W3SVC
Event Category: None
Event ID: 1013
Date:  8/24/2007
Time:  12:44:51 PM
User:  N/A
Computer: WEBSERVER01
Description:
A process serving application pool 'USPool' exceeded time limits during shut
down. The process id was '3120'.

... I take it this would cause sessions to be dropped?  If so, that's
definitely puzzle solved as we've had several times where everyone is
dropped at the same time.  This application was written by a programmer
who's no longer here, and being somewhat new to the world of ASP.Net I'm
trying to fix the problems as they come up.  I'm educating myself on the way
ASP.Net does sessions, and I am finding it's a tricky beast to work with..
Any suggestions on alternatives to using inproc?

Thanks again, and take care --

Alex

> check the event log (on the iis box) for recycle events. these will happen
> if your site uses too much memory (large sessions, memory leaks, etc) or
[quoted text clipped - 60 lines]
>>
>> Alex
George Ter-Saakov - 24 Aug 2007 20:27 GMT
Yea, that is the cause,
Process recycled everything flushed, all sessions gone, Application
initializes fresh new.
Not sure what exactly a problem but looks like memory leak of some kind

George.

> Hi Bruce,
>
[quoted text clipped - 104 lines]
>>>
>>> Alex
Alex - 24 Aug 2007 21:16 GMT
Thanks...  This is definitely what's causing the problem.  We just got calls
from users getting kicked out, and after checking the event logs yet another
recycle.  Now the research to find what's going on.

Thanks again for the info, once we figure out why the pool is recycling, our
problems should be solved.

Take care -- Alex

> Yea, that is the cause,
> Process recycled everything flushed, all sessions gone, Application
[quoted text clipped - 111 lines]
>>>>
>>>> Alex
Juan T. Llibre - 24 Aug 2007 22:57 GMT
Besidess running Scott Guthrie's code to pinpoint the reason
for the recycling of the apps, you should look into using a
different method of maintaining state for your apps.

Maintaining session state with either SQL Server or State Server
will preserve session values across application recycles.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
> Thanks...  This is definitely what's causing the problem.  We just got calls from users getting kicked out, and after
> checking the event logs yet another recycle.  Now the research to find what's going on.
[quoted text clipped - 98 lines]
>>>>>
>>>>> Alex
Juan T. Llibre - 24 Aug 2007 20:04 GMT
You might want to look into what is causing your applications to recycle.

An easy way to do this is to implement Scott Guthrie's
tips for logging ASP.NET application shutdown events :

http://weblogs.asp.net/scottgu/archive/2005/12/14/433194.aspx

By using this diagnostics tool, you can figure out why and when ASP.NET restarts application domains.

Juan T. Llibre, asp.net MVP
asp.net faq : http://asp.net.do/faq/
foros de asp.net, en español : http://asp.net.do/foros/
======================================
> Hello,
>
[quoted text clipped - 39 lines]
>
> Alex

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.