CON-1339 - Support for SQL Based Session State

Created by Warren Buckley 02 May 2017, 14:23:23 Updated by Shola 25 Jan 2018, 23:31:45

Tags: Gold partner

Is duplicated by: CON-1291

Subtask of: CON-1390

This has been raised to us via a customer support ticket that using a SQL based session state does not work for Umbraco Forms.

An example exception message:

Unable to serialize the session state. In 'StateServer' and 'SQLServer' mode, ASP.NET will serialize the session state objects, and as a result non-serializable objects or MarshalByRef objects are not permitted. The same restriction applies if similar serialization is done by the custom session state store in 'Custom' mode.

[SerializationException: Type 'Umbraco.Forms.Core.Providers.FieldTypes.Textfield' in Assembly 'Umbraco.Forms.Core.Providers, Version=4.4.2.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.]

We will need to thoroughly test Umbraco Forms & mark classes where appropriate as [Seriliazable]

Comments

Shola 02 May 2017, 15:06:28

It appears that any out-of-process session mode would have this bug, not just SQLServer. For example, Redis.


Peter Bridger 13 Nov 2017, 11:48:01

I've very keen to see this one fixed, as it prevents Umbraco Forms from using an out of process session state on load balanced websites.

We have a workaround - we have set individual web servers to use in-process session state and used "sticky sessions" to ensure repeat requests are sent to the same web server. However this isn’t ideal and prevents us from reaping the full benefits of a multi-server load balanced environment along with introducing the possibility of session state data loss due to servers being taken out of load.


Warren Buckley 21 Dec 2017, 11:09:12

Just an update on this issue, this is something we will need to schedule in for the new year (due to limited time left of this year)

This is a large t-shirt sized task and will take a large amount of a sprint to go through & update the Forms codebase as needed to get it to work with a SQL Session state or Redis


Warren Buckley 11 Jan 2018, 16:23:19

PR for this is here - https://github.com/umbraco/Forms/pull/175

At first I was unable to test & reproduce this when using a SQL based SessionState, only when I put TextField and other FieldTypes from the Umbraco.Forms.Provider class directly into a Session & tried to retrieve it again.

== Test Notes ==

  • To confirm the issue in a simple template/view have the following code - which will throw a YSOD about serialization
@{
    var field = new Umbraco.Forms.Core.Providers.FieldTypes.Textarea();
    field.Name = "My Field";

    Session["myField"] = field;
}

@{
    var myField = Session["myField"] as Umbraco.Forms.Core.Providers.FieldTypes.Textarea;
    var fieldName = myField.Name;
}

Apply the PR to your codebase & re-run the page with the above code in it's view & ensure no YSOD is thrown


Warren Buckley 12 Jan 2018, 10:26:23

OK updated a few more classes where some were marked as [Serializable] - hopefully should have them all now. Let me know if you think I may have missed anything obvious @Shandem


Shannon Deminick 15 Jan 2018, 03:39:19

tested and looks good!


Shola 25 Jan 2018, 23:31:45

That's awesome news! Any estimation on when it will be available here?: https://our.umbraco.org/projects/developer-tools/umbraco-forms/


Priority: Major

Type: Bug

State: Fixed

Assignee:

Difficulty:

Category:

Backwards Compatible: False

Fix Submitted:

Affected versions: 6.0.0, 4.4.2

Due in version: 6.0.7

Sprint: Sprint 76

Story Points: 3

Cycle: 7