RE: Trouble with huge amount of State Server Sessions Timed out



Steven,

In regards to your post on 7/24 below. I think I'm having a problem related
to this. I have app running on a windows 2003 web farm and after a couple
hours I get the error below . Even though this app runs OK on my dev machine
and during testing, half way through the day, one of the production servers
eventually seems to raise this. I am storing datasets in sessions but I don't
know how I can determine if this is the problem. If datasets can be a
problem, I'm not sure what I can do as a workaround....

My error...

"Unable to serialize the session state. Please note that non-serializable
objects or MarshalByRef objects are not permitted when session state mode is
'StateServer' or 'SQLServer'.
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.Web.HttpException: Unable to serialize the session
state. Please note that non-serializable objects or MarshalByRef objects are
not permitted when session state mode is 'StateServer' or 'SQLServer'.

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:

[OutOfMemoryException: Exception of type System.OutOfMemoryException was
thrown.]

[HttpException (0x80004005): Unable to serialize the session state. Please
note that non-serializable objects or MarshalByRef objects are not permitted
when session state mode is 'StateServer' or 'SQLServer'.]
System.Web.Util.AltSerialization.WriteValueToStream(Object value,
BinaryWriter writer) +1711
System.Web.SessionState.SessionDictionary.Serialize(BinaryWriter writer)
+148
System.Web.SessionState.StateClientManager.Serialize(SessionStateItem
item, Stream stream) +146

System.Web.SessionState.SqlStateClientManager.System.Web.SessionState.IStateClientManager.Set(String id, SessionStateItem item, Boolean inStorage) +126
System.Web.SessionState.SessionStateModule.OnReleaseState(Object source,
EventArgs eventArgs) +464

System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +87
"
"Steven Cheng[MSFT]" wrote:

> Hi Daniel,
>
> Thanks for the followup. If the compiliation/@debug has already been turned
> off and still encountering out-of-memory exceptions , the problem maybe
> somewhat hard to troubleshoot form the surface. And currently I'm thinking
> the problem maybe something related to the STATEserver session. Something I
> wanted to point out is that storing data in the ASP.NET Session in the
> State Service or SQL Server can be memory intensive depending on the types
> of data being stored. The w3wp.exe process has to serialize the data
> before saving it into session. This can result in 2 - 3 objects being
> created for the serialization process to occur. If this occurs for a
> dataset that is 100 MB in size, it could
> potentially create 200-300 MB of objects to store it in session before the
> request is complete. The following link has some information from one of
> our developers outlining the differences in session and recommendations:
>
> Understanding session state modes + FAQ
> http://www.asp.net/Forums/ShowPost.aspx?tabindex=1&PostID=7504
>
> So is there any particular large objects or non-seriazable objects which
> your application frequently trying to store into out of process session?
>
> BTW, looking at the nature of this issue, it would require intensive
> troubleshooting(memory dump and analysis) which would be done quickly and
> effectively with direct assistance from a Microsoft Support Professional
> through Microsoft Product Support Services. So I also recommend you
> consider opening a regular case for this issue if you feel it urgent and
> critical.
>
> Thanks,
>
> Steven Cheng
> Microsoft Online Support
>
> Get Secure! www.microsoft.com/security
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
>
> --------------------
> | Thread-Topic: Trouble with huge amount of State Server Sessions Timed out
> | thread-index: AcWOmy/8A6WFkmDUQwaXp3P8aixEzg==
> | X-WBNR-Posting-Host: 153.95.95.93
> | From: "=?Utf-8?B?RGFuaWVsIFdhbHplbmJhY2g=?="
> <daniel.walzenbach@xxxxxxxxxxxxxxxx>
> | References: <BC4CC820-BDFF-480B-99DA-D640058676E9@xxxxxxxxxxxxx>
> <QqYcOvbjFHA.3472@xxxxxxxxxxxxxxxxxxxxx>
> <E4B017F0-96CB-45AC-8F3E-5851E48AE24A@xxxxxxxxxxxxx>
> <6YkNMCnjFHA.3120@xxxxxxxxxxxxxxxxxxxxx>
> | Subject: RE: Trouble with huge amount of State Server Sessions Timed out
> | Date: Fri, 22 Jul 2005 01:56:02 -0700
> | Lines: 236
> | Message-ID: <01EBEBFF-9DA6-4AD3-90CE-107B8988AB1B@xxxxxxxxxxxxx>
> | MIME-Version: 1.0
> | Content-Type: text/plain;
> | charset="Utf-8"
> | Content-Transfer-Encoding: 8bit
> | X-Newsreader: Microsoft CDO for Windows 2000
> | Content-Class: urn:content-classes:message
> | Importance: normal
> | Priority: normal
> | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
> | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
> | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
> | Xref: TK2MSFTNGXA01.phx.gbl
> microsoft.public.dotnet.framework.aspnet:113773
> | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> |
> | Steven,
> |
> | thank you for your answer. In fact, to my horror, I had to realize that
> | <compilation debug/> was set to true which I now changed to false.
> | As for your question regarding the server the application is hosted of a
> 2
> | processor xeon with 2 GB RAM and Windows 2003 Server. I checked IIS
> | Application Pool Settings and the only thing which is configured is
> “Recycle
> | worker process (in minutes)� There are no settings configured for
> “Memory
> | recycling� As I already mentioned there is almost always 1GB RAM
> available,
> | only for a couple of times when only 800MB were available. Recycling of
> the
> | process due to lack of memory should definitely not be a problem, at
> least
> | this is what I would have expected�
>
> | Greetings
> |
> | Daniel
> |
> |
> | "Steven Cheng[MSFT]" wrote:
> |
> | > Hi Daniel,
> | >
> | > Thanks for your followup.
> | > Based on my experience, inspite of some code related problems such as
> | > memory leak , we can first try checking some common things which may
> cause
> | > the problem. One most common issue is that when we deploy our release
> | > version app the the server, we haven't changed the "compilation"
> element's
> | > "debug" attrribute to false. Like:
> | >
> | > <compilation debug="false"/>
> | >
> | > So is the certain asp.net webapp's web.config debug mode turned off? If
> | > not, since the ASP.NET runtime won't use batch compilation for the
> pages or
> | > other dynamnic compiled resources, it'll make those compiled pages or
> | > components in separate assemblies and make the memory divdided into
> | > individual sections. Thus, it's possible to cause memory fragment
> that'll
> | > cause allocate large block of memory failed.
> | >
> | > In addition, since the ASP.NET has workprocess recycle setting on
> memory
> | > limitation, that means the runtime will recycle the worker process when
> its
> | > used memory size has exceed a certain configured value. Is your server
> 2k
> | > server or 2003 server and how much is the total physical memory on the
> | > server? For 2k server, the setting is in the <processModel> element
> in
> | > machine.config, For 2003 server(iis6), we can configure it in the IIS's
> | > application pool setting. So you can check whether you've set it memory
> | > limit to a very high value so that the process won't recycle before the
> | > used memory exceed that value.
> | >
> | > Thanks,
> | >
> | > Steven Cheng
> | > Microsoft Online Support
> | >
> | > Get Secure! www.microsoft.com/security
> | > (This posting is provided "AS IS", with no warranties, and confers no
> | > rights.)
> | >
> | >
> | >
> | >
> | >
> | >
> | > --------------------
> | > | Thread-Topic: Trouble with huge amount of State Server Sessions Timed
> out
> | > | thread-index: AcWNzodnGPnjd/QsSXafQ0Wc5DrJGg==
> | > | X-WBNR-Posting-Host: 153.95.95.93
> | > | From: "=?Utf-8?B?RGFuaWVsIFdhbHplbmJhY2g=?="
> | > <daniel.walzenbach@xxxxxxxxxxxxxxxx>
> | > | References: <BC4CC820-BDFF-480B-99DA-D640058676E9@xxxxxxxxxxxxx>
> | > <QqYcOvbjFHA.3472@xxxxxxxxxxxxxxxxxxxxx>
> | > | Subject: RE: Trouble with huge amount of State Server Sessions Timed
> out
> | > | Date: Thu, 21 Jul 2005 01:31:02 -0700
> | > | Lines: 124
> | > | Message-ID: <E4B017F0-96CB-45AC-8F3E-5851E48AE24A@xxxxxxxxxxxxx>
> | > | MIME-Version: 1.0
> | > | Content-Type: text/plain;
> | > | charset="Utf-8"
> | > | Content-Transfer-Encoding: 8bit
> | > | X-Newsreader: Microsoft CDO for Windows 2000
> | > | Content-Class: urn:content-classes:message
> | > | Importance: normal
> | > | Priority: normal
> | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
> | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
> | > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
> | > | Xref: TK2MSFTNGXA01.phx.gbl
> | > microsoft.public.dotnet.framework.aspnet:113562
> | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> | > |
> | > | Hello Steven,
> | > |
> | > | thank you for your reply! As I missed to mention and you most
> probably
> | > | already guessed the application having the problem is configured
> using a
> | > | state server running on exactly the same machine as the application
> is
> | > | running on. This server also hosts another couple of (tiny)
> applications
> | > | which all are configured to manage their session state inProc.
> Therefore
> | > the
> | > | problem I am facing is only specific to this certain application.
> | > |
> | > | What information do you need to track down the problem?
> | > |
> | > | Would you happen to have a documentation of the entries of the
> | > Performance
> | > | monitor? The explanations which come with performance monitor are not
> | > exactly
> | > | ausführlich. I still don’t know for example what Errors
> During
> | > Execution are
> | > | and when the application would be compiled. Where would I get details
> | > about
> | > | this performance counters?
> | > |
> | > | Thank you Steven! Your help is greatly appreciated!
> | > |
> | > | Daniel
> | > |
> | > |
> | > | "Steven Cheng[MSFT]" wrote:
> | > |
> | > | > Hi Daniel,
> | > | >
> | > | > Welcome to ASPNET newsgroup.
> | > | > From your description, you're currently suffering a out-of-memory
> | > excpetion
> | > | > on your webserver that host the ASP.NET application. Also from the
> | > perfmon
> | > | > log, you found that there're huge numbers of StateServer Session
> time
> | > out
> | > | > entries.
> | > | >
> | > | > Well, for the
> | > | >
> | > | > \\FFDS24\ASP.NET v1.1.4322\State Server Sessions Timed Out: 2999
> | > | >
> | > | > \\FFDS24\ASP.NET v1.1.4322\State Server Sessions Total: 3008
> | > | >
> | > | > entries they're only meaningful to server which is configured to
> | > running
> | > | > asp.net state service , providing session state server for other
> remote
> | > | > machines(also local). So is your problem server confgured as state
> | > server?
> | > | >
> | > | > Also, how many asp.net apps are there running on your problem
> server
> | > and
> | > | > can you try isolate the problem to only a particular web app among
> | > them?
> | > | > If we can isolate the problem to a certain web app , it'll be much
> | > helpful
> | > | > for us to look into it futher.
> | > | >
> | > | > Thanks,
> | > | >
> | > | > Steven Cheng
> | > | > Microsoft Online Support
> | > | >
> | > | > Get Secure! www.microsoft.com/security
> | > | > (This posting is provided "AS IS", with no warranties, and confers
> no
> | > | > rights.)
> | > | >
> | > | >
> | > | >
> | > | >
> | > | >
> | > | >
> | > | > --------------------
> | > | > | Thread-Topic: Trouble with huge amount of State Server Sessions
> Timed
> | > out
> | > | > | thread-index: AcWNR7tAoqsBFvieQ/mCzcaOTyN/QA==
> | > | > | X-WBNR-Posting-Host: 153.95.95.93
> | > | > | From: "=?Utf-8?B?RGFuaWVsIFdhbHplbmJhY2g=?="
> | > | > <daniel.walzenbach@xxxxxxxxxxxxxxxx>
> | > | > | Subject: Trouble with huge amount of State Server Sessions Timed
> out
> | > | > | Date: Wed, 20 Jul 2005 09:26:07 -0700
> | > | > | Lines: 30
> | > | > | Message-ID: <BC4CC820-BDFF-480B-99DA-D640058676E9@xxxxxxxxxxxxx>
> | > | > | MIME-Version: 1.0
> | > | > | Content-Type: text/plain;
> | > | > | charset="Utf-8"
> | > | > | Content-Transfer-Encoding: 8bit
> | > | > | X-Newsreader: Microsoft CDO for Windows 2000
> | > | > | Content-Class: urn:content-classes:message
> | > | > | Importance: normal
> | > | > | Priority: normal
> | > | > | X-MimeOLE: Produced By Microsoft MimeOLE V6.00.3790.0
> | > | > | Newsgroups: microsoft.public.dotnet.framework.aspnet
> | > | > | NNTP-Posting-Host: TK2MSFTNGXA03.phx.gbl 10.40.2.250
> | > | > | Path: TK2MSFTNGXA01.phx.gbl!TK2MSFTNGXA03.phx.gbl
> | > | > | Xref: TK2MSFTNGXA01.phx.gbl
> | > | > microsoft.public.dotnet.framework.aspnet:113420
> | > | > | X-Tomcat-NG: microsoft.public.dotnet.framework.aspnet
> | > | > |
> | > | > | Hi,
> | > | > |
> | > | > | I have a web application which sometimes throws an â€Ã
> …“out of
> | > memoryââ�
> | > | > | exception. To get an idea what happens I traced some values using
> | > | > performance
> | > | > | monitor and got the following values (for one day):
> | > | > |
> | > | > | \\FFDS24\ASP.NET Applications(_LM_W3SVC_1_Root_ATV2004)\Errors
> During
> | > | > | Execution: 7
.