By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,526 Members | 1,895 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,526 IT Pros & Developers. It's quick & easy.

Unable to serialize the session state

P: n/a
Abi
We able to generate this error in our test environment and were able to
research this enough to understand that the issue is NOT with an abject that
needs to be serialized but rather as the stack trace suggests that the
server (in the web farm) ran out of memory while attempting to stream data
to an ASP Session State database (SQL Server 2000) .

Our test environment consists of:
- 3 web servers Load Balanced
- SQL Server 2000 Database Cluster
- F5 switch (handles the BIG IP)

We were able to simulate this error from 3 clients each opening 6 unique IE
sessions and retrieving the same data (Search) which expects to return 11000
records ... Not to the page tho! :-). Each of the Clients encountered the
error in at least 4 sessions.

The workaround is obviously not to return the 11000 records unless
absolutely required, however we do need to find a solution to this. It seems
there are others who have encountered such issues before. I'd like to
understand how they were able to resolve this issue, if at all.

Any suggestions/Solutions will be greatly appreciated.

thanks

Abhinav

Server Error in '/' Application.
--------------------------------------------------------------------------------

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.WriteValueToStrea m(Object value,
BinaryWriter writer) +1710
System.Web.SessionState.SessionDictionary.Serializ e(BinaryWriter writer)
+148
System.Web.SessionState.StateClientManager.Seriali ze(SessionStateItem
item, Stream stream) +146
System.Web.SessionState.SqlStateClientManager.Syst em.Web.SessionState.IStateClientManager.Set(String
id, SessionStateItem item, Boolean inStorage) +126
System.Web.SessionState.SessionStateModule.OnRelea seState(Object source,
EventArgs eventArgs) +464
System.Web.SyncEventExecutionStep.System.Web.HttpA pplication+IExecutionStep.Execute()
+60
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +87

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
Version:1.1.4322.2300
Jul 13 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Abi,
Exactly "What" is the actual object with 11000 "records" that is being asked
to be serialized? Is it a DataSet? In 1.1, the DataSet only serializes as XML
and that takes up a huge amount memory and is also quite a slow operation.

You might wish to search MSDN for Ravinder Vuppula's DataSetSurrogate class
which "Flattens out" the DataSet to a more compact and binary serializable
class, or convert your object to something like arraylists, etc.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Abi" wrote:
We able to generate this error in our test environment and were able to
research this enough to understand that the issue is NOT with an abject that
needs to be serialized but rather as the stack trace suggests that the
server (in the web farm) ran out of memory while attempting to stream data
to an ASP Session State database (SQL Server 2000) .

Our test environment consists of:
- 3 web servers Load Balanced
- SQL Server 2000 Database Cluster
- F5 switch (handles the BIG IP)

We were able to simulate this error from 3 clients each opening 6 unique IE
sessions and retrieving the same data (Search) which expects to return 11000
records ... Not to the page tho! :-). Each of the Clients encountered the
error in at least 4 sessions.

The workaround is obviously not to return the 11000 records unless
absolutely required, however we do need to find a solution to this. It seems
there are others who have encountered such issues before. I'd like to
understand how they were able to resolve this issue, if at all.

Any suggestions/Solutions will be greatly appreciated.

thanks

Abhinav

Server Error in '/' Application.
--------------------------------------------------------------------------------

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.WriteValueToStrea m(Object value,
BinaryWriter writer) +1710
System.Web.SessionState.SessionDictionary.Serializ e(BinaryWriter writer)
+148
System.Web.SessionState.StateClientManager.Seriali ze(SessionStateItem
item, Stream stream) +146
System.Web.SessionState.SqlStateClientManager.Syst em.Web.SessionState.IStateClientManager.Set(String
id, SessionStateItem item, Boolean inStorage) +126
System.Web.SessionState.SessionStateModule.OnRelea seState(Object source,
EventArgs eventArgs) +464
System.Web.SyncEventExecutionStep.System.Web.HttpA pplication+IExecutionStep.Execute()
+60
System.Web.HttpApplication.ExecuteStep(IExecutionS tep step, Boolean&
completedSynchronously) +87

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300; ASP.NET
Version:1.1.4322.2300
Jul 13 '06 #2

P: n/a
Abi
The object being serialized is a datatable. Does a datatable also serialize
as XML as well?

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:96**********************************@microsof t.com...
Abi,
Exactly "What" is the actual object with 11000 "records" that is being
asked
to be serialized? Is it a DataSet? In 1.1, the DataSet only serializes as
XML
and that takes up a huge amount memory and is also quite a slow operation.

You might wish to search MSDN for Ravinder Vuppula's DataSetSurrogate
class
which "Flattens out" the DataSet to a more compact and binary serializable
class, or convert your object to something like arraylists, etc.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Abi" wrote:
>We able to generate this error in our test environment and were able to
research this enough to understand that the issue is NOT with an abject
that
needs to be serialized but rather as the stack trace suggests that the
server (in the web farm) ran out of memory while attempting to stream
data
to an ASP Session State database (SQL Server 2000) .

Our test environment consists of:
- 3 web servers Load Balanced
- SQL Server 2000 Database Cluster
- F5 switch (handles the BIG IP)

We were able to simulate this error from 3 clients each opening 6 unique
IE
sessions and retrieving the same data (Search) which expects to return
11000
records ... Not to the page tho! :-). Each of the Clients encountered the
error in at least 4 sessions.

The workaround is obviously not to return the 11000 records unless
absolutely required, however we do need to find a solution to this. It
seems
there are others who have encountered such issues before. I'd like to
understand how they were able to resolve this issue, if at all.

Any suggestions/Solutions will be greatly appreciated.

thanks

Abhinav

Server Error in '/' Application.
--------------------------------------------------------------------------------

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.WriteValueToStrea m(Object value,
BinaryWriter writer) +1710
System.Web.SessionState.SessionDictionary.Serializ e(BinaryWriter
writer)
+148
System.Web.SessionState.StateClientManager.Seriali ze(SessionStateItem
item, Stream stream) +146

System.Web.SessionState.SqlStateClientManager.Sys tem.Web.SessionState.IStateClientManager.Set(Strin g
id, SessionStateItem item, Boolean inStorage) +126
System.Web.SessionState.SessionStateModule.OnRelea seState(Object
source,
EventArgs eventArgs) +464

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

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300;
ASP.NET
Version:1.1.4322.2300

Jul 13 '06 #3

P: n/a
No, a DataTable is not. Put the DataTable inside a new DataSet first.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Abi" wrote:
The object being serialized is a datatable. Does a datatable also serialize
as XML as well?

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:96**********************************@microsof t.com...
Abi,
Exactly "What" is the actual object with 11000 "records" that is being
asked
to be serialized? Is it a DataSet? In 1.1, the DataSet only serializes as
XML
and that takes up a huge amount memory and is also quite a slow operation.

You might wish to search MSDN for Ravinder Vuppula's DataSetSurrogate
class
which "Flattens out" the DataSet to a more compact and binary serializable
class, or convert your object to something like arraylists, etc.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Abi" wrote:
We able to generate this error in our test environment and were able to
research this enough to understand that the issue is NOT with an abject
that
needs to be serialized but rather as the stack trace suggests that the
server (in the web farm) ran out of memory while attempting to stream
data
to an ASP Session State database (SQL Server 2000) .

Our test environment consists of:
- 3 web servers Load Balanced
- SQL Server 2000 Database Cluster
- F5 switch (handles the BIG IP)

We were able to simulate this error from 3 clients each opening 6 unique
IE
sessions and retrieving the same data (Search) which expects to return
11000
records ... Not to the page tho! :-). Each of the Clients encountered the
error in at least 4 sessions.

The workaround is obviously not to return the 11000 records unless
absolutely required, however we do need to find a solution to this. It
seems
there are others who have encountered such issues before. I'd like to
understand how they were able to resolve this issue, if at all.

Any suggestions/Solutions will be greatly appreciated.

thanks

Abhinav

Server Error in '/' Application.
--------------------------------------------------------------------------------

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.WriteValueToStrea m(Object value,
BinaryWriter writer) +1710
System.Web.SessionState.SessionDictionary.Serializ e(BinaryWriter
writer)
+148
System.Web.SessionState.StateClientManager.Seriali ze(SessionStateItem
item, Stream stream) +146

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

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

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300;
ASP.NET
Version:1.1.4322.2300


Jul 13 '06 #4

P: n/a
Abi
Any advantage in moving the datatable to the dataset? You did point out that
the XML serialization is slower and resource hungry. So I'm thinking its
going to get worse!

Being that we are pushing a datatable into session state db are there any
other likely causes?

Appreciate all your input.

thanks

Abhinav

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:81**********************************@microsof t.com...
No, a DataTable is not. Put the DataTable inside a new DataSet first.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Abi" wrote:
>The object being serialized is a datatable. Does a datatable also
serialize
as XML as well?

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in
message
news:96**********************************@microso ft.com...
Abi,
Exactly "What" is the actual object with 11000 "records" that is being
asked
to be serialized? Is it a DataSet? In 1.1, the DataSet only serializes
as
XML
and that takes up a huge amount memory and is also quite a slow
operation.

You might wish to search MSDN for Ravinder Vuppula's DataSetSurrogate
class
which "Flattens out" the DataSet to a more compact and binary
serializable
class, or convert your object to something like arraylists, etc.
Peter

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Abi" wrote:

We able to generate this error in our test environment and were able
to
research this enough to understand that the issue is NOT with an
abject
that
needs to be serialized but rather as the stack trace suggests that the
server (in the web farm) ran out of memory while attempting to stream
data
to an ASP Session State database (SQL Server 2000) .

Our test environment consists of:
- 3 web servers Load Balanced
- SQL Server 2000 Database Cluster
- F5 switch (handles the BIG IP)

We were able to simulate this error from 3 clients each opening 6
unique
IE
sessions and retrieving the same data (Search) which expects to return
11000
records ... Not to the page tho! :-). Each of the Clients encountered
the
error in at least 4 sessions.

The workaround is obviously not to return the 11000 records unless
absolutely required, however we do need to find a solution to this. It
seems
there are others who have encountered such issues before. I'd like to
understand how they were able to resolve this issue, if at all.

Any suggestions/Solutions will be greatly appreciated.

thanks

Abhinav

Server Error in '/' Application.
--------------------------------------------------------------------------------

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.WriteValueToStrea m(Object value,
BinaryWriter writer) +1710
System.Web.SessionState.SessionDictionary.Serializ e(BinaryWriter
writer)
+148

System.Web.SessionState.StateClientManager.Serial ize(SessionStateItem
item, Stream stream) +146

System.Web.SessionState.SqlStateClientManager.Sys tem.Web.SessionState.IStateClientManager.Set(Strin g
id, SessionStateItem item, Boolean inStorage) +126
System.Web.SessionState.SessionStateModule.OnRelea seState(Object
source,
EventArgs eventArgs) +464

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

--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.1.4322.2300;
ASP.NET
Version:1.1.4322.2300



Jul 13 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.