[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

MrFez

10/17/2006 7:38:00 PM

My system is setup with framework 1.1.4, sql server 2000 and w3k web server.

My app runs with session state set to SQL and most of it runs fine.
Whenever I am dealing with large amounts of data returned (ex: 60000 records)
I'm getting the following error:
"Unable to serialize session state. Please note that non-serializable
objects... are not permitted when session state mode is SQLServer".

There are no non-serializable objects being stored in the database. All
connections are being closed properly.

In a effort to debug this i have tried the following and the app works when:
* a different webserver is pointing to the same database
* the same webserver pointing to a different database
* a smaller result set returned
* when the webserver is rebooted the first 2 or 3 times a large result sets
can be successfully returned.

The only time it doesn't work is when session state is set to "SQLServer" on
a particular webserver using a particular database. When the error starts
happening under these conditions, if I switch to InProc, everything works
again.

The web server the problem is seen on is running multiple web apps.

My web.config session state is:

mode="SQLServer"
stateConnectionString="tcpip=127.0.0.1:42424"
stateNetworkTimeout="600"
sqlConnectionString="data source=<server>;user id=<user>;password=<pwd>"
cookieless="false"
timeout="20"

My machine.config session state is:

mode="InProc"
stateConnectionString="tcpip=127.0.0.1:42424"
stateNetworkTimeout="10"
sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI"
cookieless="false"
timeout="20"/>

Does anyone have any advice?

Thanks.
5 Answers

stepkurt

10/19/2006 4:51:00 PM

0

I wish I could help but I'm looking for answers to the same problem...

We have the exact setup and whenever I try and store a large datatable in
session, we get that error...and datatable should be serializable.

In testing, I changed the stored proc to return only the TOP 1000 and it
works fine. Obviously, this won't be acceptable in the production environment
so I need to find a solution.

Maybe there is there someting else to configure on the database server?

On another note...Right now this database has already inflated to 1GB in
size...with 3 people testing!

What happens to this session database when 1000 users are on there at the
same time? Will it inflate to 10GB and crash the server?

"MrFez" wrote:

> My system is setup with framework 1.1.4, sql server 2000 and w3k web server.
>
> My app runs with session state set to SQL and most of it runs fine.
> Whenever I am dealing with large amounts of data returned (ex: 60000 records)
> I'm getting the following error:
> "Unable to serialize session state. Please note that non-serializable
> objects... are not permitted when session state mode is SQLServer".
>
> There are no non-serializable objects being stored in the database. All
> connections are being closed properly.
>
> In a effort to debug this i have tried the following and the app works when:
> * a different webserver is pointing to the same database
> * the same webserver pointing to a different database
> * a smaller result set returned
> * when the webserver is rebooted the first 2 or 3 times a large result sets
> can be successfully returned.
>
> The only time it doesn't work is when session state is set to "SQLServer" on
> a particular webserver using a particular database. When the error starts
> happening under these conditions, if I switch to InProc, everything works
> again.
>
> The web server the problem is seen on is running multiple web apps.
>
> My web.config session state is:
>
> mode="SQLServer"
> stateConnectionString="tcpip=127.0.0.1:42424"
> stateNetworkTimeout="600"
> sqlConnectionString="data source=<server>;user id=<user>;password=<pwd>"
> cookieless="false"
> timeout="20"
>
> My machine.config session state is:
>
> mode="InProc"
> stateConnectionString="tcpip=127.0.0.1:42424"
> stateNetworkTimeout="10"
> sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI"
> cookieless="false"
> timeout="20"/>
>
> Does anyone have any advice?
>
> Thanks.

Alvin Bruney [ASP.NET MVP]

10/20/2006 11:47:00 AM

0

Looks like you need a to show us a stack trace. Can you reproduce the
problem easily? If you can, post a complete stack dump here. You can run the
application under a debugger and set it to break on all exceptions. When the
exception occurs, copy the stack trace.

--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/b...
-------------------------------------------------------


"MrFez" <MrFez@discussions.microsoft.com> wrote in message
news:E8BA3F98-FE6B-46D0-BD9F-7A5375263151@microsoft.com...
> My system is setup with framework 1.1.4, sql server 2000 and w3k web
> server.
>
> My app runs with session state set to SQL and most of it runs fine.
> Whenever I am dealing with large amounts of data returned (ex: 60000
> records)
> I'm getting the following error:
> "Unable to serialize session state. Please note that non-serializable
> objects... are not permitted when session state mode is SQLServer".
>
> There are no non-serializable objects being stored in the database. All
> connections are being closed properly.
>
> In a effort to debug this i have tried the following and the app works
> when:
> * a different webserver is pointing to the same database
> * the same webserver pointing to a different database
> * a smaller result set returned
> * when the webserver is rebooted the first 2 or 3 times a large result
> sets
> can be successfully returned.
>
> The only time it doesn't work is when session state is set to "SQLServer"
> on
> a particular webserver using a particular database. When the error starts
> happening under these conditions, if I switch to InProc, everything works
> again.
>
> The web server the problem is seen on is running multiple web apps.
>
> My web.config session state is:
>
> mode="SQLServer"
> stateConnectionString="tcpip=127.0.0.1:42424"
> stateNetworkTimeout="600"
> sqlConnectionString="data source=<server>;user id=<user>;password=<pwd>"
> cookieless="false"
> timeout="20"
>
> My machine.config session state is:
>
> mode="InProc"
> stateConnectionString="tcpip=127.0.0.1:42424"
> stateNetworkTimeout="10"
> sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI"
> cookieless="false"
> timeout="20"/>
>
> Does anyone have any advice?
>
> Thanks.


MrFez

10/24/2006 6:49:00 PM

0

Thanks Alvin. The stack trace is below.

I stepped thru the code and the lines of code that write data to session
executes fine.

Page_PreRender passes without any problem and Page_Unload End Sub also
executes. Then the aspx page keeps "loading". After a bit it dumps out the
message below.

The system's got 4GB ram and it only every goes over 2.5GB during the run
(other apps are running on the system). The CPU usage is below 50%. And
it's running Win2003 Enterprise. The database housing the session is also on
this same system.

Do you know if session is written to on after the page unloads or is it only
when the lines of code are executed.

Thanks.
----

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)
System.Web.SessionState.SessionDictionary.Serialize(BinaryWriter writer)
System.Web.SessionState.StateClientManager.Serialize(SessionStateItem
item, Stream stream)

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

System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute() +60
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +87




"Alvin Bruney [MVP]" wrote:

> Looks like you need a to show us a stack trace. Can you reproduce the
> problem easily? If you can, post a complete stack dump here. You can run the
> application under a debugger and set it to break on all exceptions. When the
> exception occurs, copy the stack trace.
>
> --
> ________________________
> Warm regards,
> Alvin Bruney [MVP ASP.NET]
>
> [Shameless Author plug]
> Professional VSTO.NET - Wrox/Wiley
> The O.W.C. Black Book with .NET
> www.lulu.com/owc, Amazon
> Blog: http://www.msmvps.com/b...
> -------------------------------------------------------
>
>
> "MrFez" <MrFez@discussions.microsoft.com> wrote in message
> news:E8BA3F98-FE6B-46D0-BD9F-7A5375263151@microsoft.com...
> > My system is setup with framework 1.1.4, sql server 2000 and w3k web
> > server.
> >
> > My app runs with session state set to SQL and most of it runs fine.
> > Whenever I am dealing with large amounts of data returned (ex: 60000
> > records)
> > I'm getting the following error:
> > "Unable to serialize session state. Please note that non-serializable
> > objects... are not permitted when session state mode is SQLServer".
> >
> > There are no non-serializable objects being stored in the database. All
> > connections are being closed properly.
> >
> > In a effort to debug this i have tried the following and the app works
> > when:
> > * a different webserver is pointing to the same database
> > * the same webserver pointing to a different database
> > * a smaller result set returned
> > * when the webserver is rebooted the first 2 or 3 times a large result
> > sets
> > can be successfully returned.
> >
> > The only time it doesn't work is when session state is set to "SQLServer"
> > on
> > a particular webserver using a particular database. When the error starts
> > happening under these conditions, if I switch to InProc, everything works
> > again.
> >
> > The web server the problem is seen on is running multiple web apps.
> >
> > My web.config session state is:
> >
> > mode="SQLServer"
> > stateConnectionString="tcpip=127.0.0.1:42424"
> > stateNetworkTimeout="600"
> > sqlConnectionString="data source=<server>;user id=<user>;password=<pwd>"
> > cookieless="false"
> > timeout="20"
> >
> > My machine.config session state is:
> >
> > mode="InProc"
> > stateConnectionString="tcpip=127.0.0.1:42424"
> > stateNetworkTimeout="10"
> > sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI"
> > cookieless="false"
> > timeout="20"/>
> >
> > Does anyone have any advice?
> >
> > Thanks.
>
>
>

Alvin Bruney [ASP.NET MVP]

11/9/2006 11:53:00 PM

0

You need to push this one to microsoft. From your stacktrace, it is clearly
having difficulty with an object in the stream. Years ago, I had a similar
problem where the object was actually a very small negative number. The fix
for it was a patch from microsoft. If you can eliminate the possibility that
this is not being caused by funky data, you will have to get support from
Microsoft. They would then instruct you to take a memory dump and they would
examine the dump to see what bit of data is causing the hiccup. By the way,
you can do all this by yourself. But why? It seems to be a framework issue
from what I see infront me.

> Do you know if session is written to on after the page unloads or is it
> only
> when the lines of code are executed.
For stateserver, session is de/serialized and written to after the code
executes but before it unloads.
--
________________________
Warm regards,
Alvin Bruney [MVP ASP.NET]

[Shameless Author plug]
Professional VSTO.NET - Wrox/Wiley
The O.W.C. Black Book with .NET
www.lulu.com/owc, Amazon
Blog: http://www.msmvps.com/b...
-------------------------------------------------------


"MrFez" <MrFez@discussions.microsoft.com> wrote in message
news:8CCBEA6E-8F9C-4287-A33F-B8BAFB083823@microsoft.com...
> Thanks Alvin. The stack trace is below.
>
> I stepped thru the code and the lines of code that write data to session
> executes fine.
>
> Page_PreRender passes without any problem and Page_Unload End Sub also
> executes. Then the aspx page keeps "loading". After a bit it dumps out
> the
> message below.
>
> The system's got 4GB ram and it only every goes over 2.5GB during the run
> (other apps are running on the system). The CPU usage is below 50%. And
> it's running Win2003 Enterprise. The database housing the session is also
> on
> this same system.
>
> Do you know if session is written to on after the page unloads or is it
> only
> when the lines of code are executed.
>
> Thanks.
> ----
>
> 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)
> System.Web.SessionState.SessionDictionary.Serialize(BinaryWriter writer)
> System.Web.SessionState.StateClientManager.Serialize(SessionStateItem
> item, Stream stream)
>
> System.Web.SessionState.OutOfProcStateClientManager.System.Web.SessionState.IStateClientManager.Set(String
> id, SessionStateItem item, Boolean inStorage)
> System.Web.SessionState.SessionStateModule.OnReleaseState(Object source,
> EventArgs eventArgs)
>
> System.Web.SyncEventExecutionStep.System.Web.HttpApplication+IExecutionStep.Execute()
> +60
> System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
> completedSynchronously) +87
>
>
>
>
> "Alvin Bruney [MVP]" wrote:
>
>> Looks like you need a to show us a stack trace. Can you reproduce the
>> problem easily? If you can, post a complete stack dump here. You can run
>> the
>> application under a debugger and set it to break on all exceptions. When
>> the
>> exception occurs, copy the stack trace.
>>
>> --
>> ________________________
>> Warm regards,
>> Alvin Bruney [MVP ASP.NET]
>>
>> [Shameless Author plug]
>> Professional VSTO.NET - Wrox/Wiley
>> The O.W.C. Black Book with .NET
>> www.lulu.com/owc, Amazon
>> Blog: http://www.msmvps.com/b...
>> -------------------------------------------------------
>>
>>
>> "MrFez" <MrFez@discussions.microsoft.com> wrote in message
>> news:E8BA3F98-FE6B-46D0-BD9F-7A5375263151@microsoft.com...
>> > My system is setup with framework 1.1.4, sql server 2000 and w3k web
>> > server.
>> >
>> > My app runs with session state set to SQL and most of it runs fine.
>> > Whenever I am dealing with large amounts of data returned (ex: 60000
>> > records)
>> > I'm getting the following error:
>> > "Unable to serialize session state. Please note that non-serializable
>> > objects... are not permitted when session state mode is SQLServer".
>> >
>> > There are no non-serializable objects being stored in the database.
>> > All
>> > connections are being closed properly.
>> >
>> > In a effort to debug this i have tried the following and the app works
>> > when:
>> > * a different webserver is pointing to the same database
>> > * the same webserver pointing to a different database
>> > * a smaller result set returned
>> > * when the webserver is rebooted the first 2 or 3 times a large result
>> > sets
>> > can be successfully returned.
>> >
>> > The only time it doesn't work is when session state is set to
>> > "SQLServer"
>> > on
>> > a particular webserver using a particular database. When the error
>> > starts
>> > happening under these conditions, if I switch to InProc, everything
>> > works
>> > again.
>> >
>> > The web server the problem is seen on is running multiple web apps.
>> >
>> > My web.config session state is:
>> >
>> > mode="SQLServer"
>> > stateConnectionString="tcpip=127.0.0.1:42424"
>> > stateNetworkTimeout="600"
>> > sqlConnectionString="data source=<server>;user
>> > id=<user>;password=<pwd>"
>> > cookieless="false"
>> > timeout="20"
>> >
>> > My machine.config session state is:
>> >
>> > mode="InProc"
>> > stateConnectionString="tcpip=127.0.0.1:42424"
>> > stateNetworkTimeout="10"
>> > sqlConnectionString="data source=127.0.0.1;Integrated Security=SSPI"
>> > cookieless="false"
>> > timeout="20"/>
>> >
>> > Does anyone have any advice?
>> >
>> > Thanks.
>>
>>
>>


Yehuda Herman

6/27/2008 12:32:00 AM

0

When using the page_load event to open a connection to the database server
you will need to close the connection in the page_unload event, if not
sooner.
Otherwise, as time goes by, you will exhaust the memory and receive the
following error:

Exception of type System.OutofMemoryException was thrown.


Yehuda Herman
Graduate of Software Engineering from Monmouth University, West Long Branch,
NJ.