Invalid Viewstate & Error 500 in version 2.0

If you are having a problem using Fortress, post a message here.

Moderator: SourceGear

Post Reply
cs
Posts: 126
Joined: Mon Apr 11, 2005 5:20 am

Invalid Viewstate & Error 500 in version 2.0

Post by cs » Wed Aug 12, 2009 4:26 am

I am seeing intermittent errors in Fortress.log file. This is coinciding with users being kicked from Fortress.

Examples below:

2009-08-11 23:34:49.448 MyServer.MyDomain.local (10.0.0.1)-MyUserName : Server error 500 Invalid viewstate. Client IP: 10.0.0.1 Port: 55855 User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 3.5.21022; .NET CLR 1.1.4322; MS-RTC EA 2; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.2) ViewState: /wEPDwUKLTM2MDg2Mjc4MQ9kFgJmD2QWAmYPZBYEAgEPZBYCAgkPFgIeBGhyZWYFDGZhdkljb25GLmljb2QCAw9kFgICAQ8WAh4HZW5jdHlwZQUTbXVsdGlwYXJ0L2Zvcm0tZGF0YRYIAgMPZBYGAgEPDxYCHgRUZXh0BQdyaGFycmlzZGQCBw9kFgICAQ8PFgIeC05hdmlnYXRlVXJsBRZIZWxwLmFzcHg/aGlkPVNob3dJdGVtZGQCDQ9kFgICAw9kFgJmD2QWAgIBDw9kFgQeB29uRm9jdXMFF2RvY3VtZW50Lmhhc0ZvY3VzPXRoaXM7HgZvbkJsdXIFF2RvY3VtZW50Lmhhc0ZvY3VzPW51bGw7ZAIFD2QWBAIBDxYCHwIFDEl0ZW0gRGV0YWlsc2QCAw9kFgICAQ8QDxYIHghDc3NDbGFzcwUNcHJvamVjdHN3aXRjaB4MQXV0b1Bvc3RCYWNrZx4LXyFEYXRhQm91bmRnHgRfIVNCAgJkEBUsC19JVCAtIEFkbWluCV9JVCAtIERTQwlfSVQgLSBEU0kSX0lUIC0gRFNJIC0gQ29uZmlnFV9JVCAtIERTSSAtIFRlbGVwaG9ueQlfSVQgLSBEU0wSX0lUIC0gRFNMIC0gQ29uZmlnFV9JVCAtIERTTCAtIFRlbGVwaG9ueQ1fSVQgLSBHZW9ob2xtDl9JVCAtIE9mZnNob3JlGl9JVCAtIE9mZnNob3JlIC0gRFNJIEltYWdlGl...[Invalid viewstate: Missing field: __VIEWSTATE6. at System.Web.UI.Page.get_RequestViewStateString()]

and:

2009-08-12 11:08:17.870 10.0.0.196 (10.0.0.196)-MyUserName : Server error 500 Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at MantisControlsLib.LinkNotationViewer.LoadControls(Boolean escape) at MantisControlsLib.LinkNotationViewer.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

How can we fix this?

The sgvault.log file has no errors.

mskrobul
Posts: 490
Joined: Wed Jan 14, 2004 10:22 am
Location: SourceGear
Contact:

Re: Invalid Viewstate & Error 500 in version 2.0

Post by mskrobul » Wed Aug 12, 2009 9:53 am

There are a many things that can cause view state issues. Some causes are: Application Pool Recycling, Session Timeout, Firewalls truncating it etc., etc. Here is a KB article that may help trouble shoot the issue http://support.microsoft.com/kb/555353

Do your users see the issue after an idle period? If so then it is probably the result of a session timeout.

Fortress 2.0 is much more complex than previous versions of Fortress so the view state is larger on some pages and firewalls can cause problems with large view states. The maxPageStateFieldLength is a setting in web.config that addresses the firewall issue. Look for the following entry in your Fortress web.config file:
<pages buffer="true" enableSessionState="true" autoEventWireup="true" maxPageStateFieldLength="8192" maintainScrollPositionOnPostBack="true">

If the maxPageStateFieldLength value if present in web.config cuts the view state in chunks so instead of one big view state you have lots of smaller ones. You can try increasing or decreasing the maxPageStateFieldLengh value and see if that helps. Or if a firewall isn't an issue you may try removing that value altogether.
Mary Jo Skrobul
SourceGear

cs
Posts: 126
Joined: Mon Apr 11, 2005 5:20 am

Re: Invalid Viewstate & Error 500 in version 2.0

Post by cs » Wed Aug 12, 2009 10:18 am

This issue is reproducable for me when moving between items/views and is not tied into any idle timeouts or similar.

I have changed the setting to 65536 and will monitor. Setting to 32768 made no difference.

mskrobul
Posts: 490
Joined: Wed Jan 14, 2004 10:22 am
Location: SourceGear
Contact:

Re: Invalid Viewstate & Error 500 in version 2.0

Post by mskrobul » Wed Aug 12, 2009 10:36 am

If this is a reproducible error and not just intermittent can you give me the exact steps (what page you are on, what buttons you are clicking etc. etc) to reproduce the error?

Thanks!
Mary Jo Skrobul
SourceGear

cs
Posts: 126
Joined: Mon Apr 11, 2005 5:20 am

Re: Invalid Viewstate & Error 500 in version 2.0

Post by cs » Thu Aug 13, 2009 2:30 am

Steps I can do to reproduce:

1) Close all browsers (IE 8)
2) Launch Fortress
3) Enter any item number into the search box at the top right and click Search
4) I get kicked to Fortress login screen

The 'Remember login on this machine' setting is always forgotten.

The above happens frequently and also in ordinary use of the web client doing various random tasks.

Changing the above setting to 65536 had no effect by the way.

mskrobul
Posts: 490
Joined: Wed Jan 14, 2004 10:22 am
Location: SourceGear
Contact:

Re: Invalid Viewstate & Error 500 in version 2.0

Post by mskrobul » Thu Aug 13, 2009 9:43 am

Hmmm...we haven't been able to reproduce that in house.

What version if IE are you using? Does this only happen in IE?

The information for Remember Login is stored in a cookie (as is authentication info etc.). Do you have IE configured to restrict cookies? Cookies need to be enabled (at least for the Fortress site) in order for Fortress to work.
Mary Jo Skrobul
SourceGear

cs
Posts: 126
Joined: Mon Apr 11, 2005 5:20 am

Re: Invalid Viewstate & Error 500 in version 2.0

Post by cs » Fri Aug 14, 2009 6:50 am

This happens to all users on multiple computers. Behaviour is seen in IE 7 and 8.

Please note this also happens when running the web client on the Fortress server. This is when logged in to Fortress as any user including Admin.

Here is an example of the Error 500's from Fortress.log:

2009-08-13 18:00:36.230 MyProxyServer (10.0.0.1)-MyUserName : Server error 500 Failed to load viewstate. The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request. For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request. at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.AddedControl(Control control, Int32 index) at System.Web.UI.ControlCollection.Add(Control child) at MantisControlsLib.LinkNotationViewer.LoadControls(Boolean escape) at MantisControlsLib.LinkNotationViewer.UpdateText(String text, Boolean escape) at Mantis.ItemDetailsControl.Display() at Mantis.ItemDetailsControl.LoadStuff(Int32 tabindex) at Mantis.ItemDetailsControl.ButtonSave_Click(Object sender, EventArgs e) at System.Web.UI.WebControls.Button.OnClick(EventArgs e) at System.Web.UI.WebControls.Button.RaisePostBackEvent(String eventArgument) at System.Web.UI.WebControls.Button.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) at System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

cs
Posts: 126
Joined: Mon Apr 11, 2005 5:20 am

Re: Invalid Viewstate & Error 500 in version 2.0

Post by cs » Fri Aug 14, 2009 6:51 am

Another type of error 500 from fortress.log:

2009-08-14 11:58:30.226 MyProxyServer (10.0.0.1)-MyUserName : Server error 500 Object reference not set to an instance of an object. at Mantis.QueryUpControl.Repeater1_ItemCreated(Object sender, RepeaterItemEventArgs e) at System.Web.UI.WebControls.Repeater.OnItemCreated(RepeaterItemEventArgs e) at System.Web.UI.WebControls.Repeater.CreateItem(Int32 itemIndex, ListItemType itemType, Boolean dataBind, Object dataItem) at System.Web.UI.WebControls.Repeater.CreateControlHierarchy(Boolean useDataSource) at System.Web.UI.WebControls.Repeater.CreateChildControls() at System.Web.UI.Control.EnsureChildControls() at System.Web.UI.WebControls.Repeater.get_Controls() at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Control.LoadChildViewStateByIndex(ArrayList childState) at System.Web.UI.Control.LoadViewStateRecursive(Object savedState) at System.Web.UI.Page.LoadAllState() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

cs
Posts: 126
Joined: Mon Apr 11, 2005 5:20 am

Re: Invalid Viewstate & Error 500 in version 2.0

Post by cs » Fri Aug 14, 2009 6:57 am

The errors in the fortress.log and the constant kicking from Fortress may not be related. There are much less errors in the fortress.log than the amount of times everyone is kicked.

By the way the kicking occurs regardless if a proxy server is used.

mskrobul
Posts: 490
Joined: Wed Jan 14, 2004 10:22 am
Location: SourceGear
Contact:

Re: Invalid Viewstate & Error 500 in version 2.0

Post by mskrobul » Fri Aug 14, 2009 9:00 am

Can you send me entire sgfortress log file? You can use the email button to email me directly. So if you go to the server machine and use the http://localhost/fortress url you get the same bahavior?

Have you tried making maxPageStateFieldLength a smaller number?

When OS is your server running on? Are you running the 3.5 framework or 3.5 sp1 of the .net framework on the server machine?
Mary Jo Skrobul
SourceGear

cs
Posts: 126
Joined: Mon Apr 11, 2005 5:20 am

Re: Invalid Viewstate & Error 500 in version 2.0

Post by cs » Fri Aug 14, 2009 9:08 am

Using http://localhost/Fortress on the server demonstrates the kicking issue.

I have tried the following settings for the web.config parameter with no success:

1024
2048
8192
32768
65536

After each time I have changed the setting I have recycled the Vault app pool in IIS.

I will send you the full log file.

I am using .NET Framework 3.5 SP0 on Windows 2003 Server Standard SP2.

I am currently installing the .NET Framework 3.5 SP1.

cs
Posts: 126
Joined: Mon Apr 11, 2005 5:20 am

Re: Invalid Viewstate & Error 500 in version 2.0

Post by cs » Fri Aug 14, 2009 9:41 am

.NET 3.5 SP1 installed and rebooted. The kicking issue is still present on http://localhost/Fortress. I am kicked after a half dozen random clicks around Fortress.

Post Reply