By ChanKK - 3/29/2009
Hi,
I hit the error below if two person access the same page at the same time. Even though I have replaced the latest Business.dll (this time confirmed is replaced) Please advice. Thank you
Server Error in '/FlexHR' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
Source Error:
Line 184: protected override void OnPreRender(EventArgs e)
Line 185: {
Line 186: base.OnPreRender(e);
Line 187:
Line 188: this.ErrorIcon = "../images/ErrorIcon.png";
Source File: C:\FlexHR\Trunk\Mainline\Generic\UI\Web\Strataframe\Forms\BasePage.cs Line: 186
Stack Trace:
[NullReferenceException: Object reference not set to an instance of an object.]
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +143
System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) +11
MicroFour.StrataFrame.Business.TypePropertyCache.GetPropertyInfo(Type OwnerType, String PropertyName) +259
MicroFour.StrataFrame.Business.TypePropertyCache.GetPropertyInfo(Object Owner, String PropertyName) +22
MicroFour.StrataFrame.Business.BusinessLayer.BindDataToWebControl(IWebBusinessBindable ControlToBind, IWebBinding Binding) +196
MicroFour.StrataFrame.Business.BusinessLayer.BindDataToWebControlPrimary(IWebBusinessBindable ControlToBind) +62
MicroFour.StrataFrame.UI.Web.BasePage.BindControls() +150
[UIException: An error occurred while binding data to the web control 'lblDocRef'.]
MicroFour.StrataFrame.UI.Web.BasePage.BindControls() +570
MicroFour.StrataFrame.UI.Web.BasePage.Page_PreRender(Object sender, EventArgs e) +7
System.Web.UI.Control.OnPreRender(EventArgs e) +8679510
Vfs.Generic.UI.Web.Strataframe.Forms.BasePage.OnPreRender(EventArgs e) in C:\FlexHR\Trunk\Mainline\Generic\UI\Web\Strataframe\Forms\BasePage.cs:186
System.Web.UI.Control.PreRenderRecursiveInternal() +80
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +842
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
|
By Trent L. Taylor - 3/30/2009
Well, this doesn't really make any sense on the two user thing. In IIS each session is going to create new instances. The ONLY thing that I could see is if you have something that is shared that you are attempting to bind to which could cause an error like this. Also, based on your exception, I assume that you have your own base page and are inheriting the SF BasePage. If this is the case, the OnPreRender that you are overriding isn't that of our BasePage, but rather that of the .NET Page class (which is what the BasePage inherits from).If you can provide a reproducable sample then that would make it MUCH easier. But based on the details that you have given and looking at the SF source, I cannot see where your point of failure is. On a final thought here, it is extremely rare to have a "multi-user" type of issue when dealing with web applicaitons unless there is something specific within your application or a shared (static) method, property, or class that they are all referencing that is not taking this into account.
|
By ChanKK - 3/31/2009
Hi,
Trent L. Taylor (03/30/2009)
Well, this doesn't really make any sense on the two user thing. In IIS each session is going to create new instances. The ONLY thing that I could see is if you have something that is shared that you are attempting to bind to which could cause an error like this. Also, based on your exception, I assume that you have your own base page and are inheriting the SF BasePage. If this is the case, the OnPreRender that you are overriding isn't that of our BasePage, but rather that of the .NET Page class (which is what the BasePage inherits from). I only have this code in OnPreRender(). protected override void OnPreRender(EventArgs e)
{
base.OnPreRender(e);
this.ErrorIcon = "../images/ErrorIcon.png";
} [quote]If you can provide a reproducable sample then that would make it MUCH easier. But based on the details that you have given and looking at the SF source, I cannot see where your point of failure is.
I tried to create small project, but unable to reproduce.
On a final thought here, it is extremely rare to have a "multi-user" type of issue when dealing with web applicaitons unless there is something specific within your application or a shared (static) method, property, or class that they are all referencing that is not taking this into account.
As you can see the code as above, and also the callstack during exception, we doesn't have any complex code. Also, we really can reproduce it by 2 person access same page at the same time using our application (Click at the same time). If we run it one after one, and just half second delay, the error will not occurred. I am preparing my application and db, but it is huge. It takes time. Hope you can find out something.
Thank you.
|
By Trent L. Taylor - 3/31/2009
This is the first time that I have ever heard of anything like this. And we have a number of SF users with large web applications....so I really feel confident that this is either in the configuration of IIS, permissions, or something within your code. But without the ability to reproduce (small scale preferred) it is going to be impossible to give a straight answer.Also, I don't think that sending me your entire application is the answer here. This would require a lot of investigative work and trying to dissimenate your entire applicaiton which is not something that I am prepared to do at this point. If it happens large scale then you should be able to make it happen small scale as well. Also, if you can't reproduce until you get it into a production environment, that should be a clue as well.
|
By ChanKK - 3/31/2009
Hi,
After whole day debugging and tracing by modify SF source code, I found that, we hit new error which is more "explainable" for me. As we can see the error "An item with the same key has already been added", and I found that, TypePropertyCache.GetPropertyInfo() is a static/shared method. Meanwhile, _Dictionary used by TypePropertyCache is also static/shared. However, I couldn't find any code that ensure thread-safe. Is it a mistake?
Regarding why I hit Object reference is null ... I still unable to find out the cause.
Server Error in '/FlexHR' Application.
--------------------------------------------------------------------------------
An item with the same key has already been added.
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.ArgumentException: An item with the same key has already been added.
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:
[ArgumentException: An item with the same key has already been added.]
System.ThrowHelper.ThrowArgumentException(ExceptionResource resource) +48
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +2668392
System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) +11
MicroFour.StrataFrame.Business.TypePropertyCache.GetPropertyInfo(Type OwnerType, String PropertyName) +505
MicroFour.StrataFrame.Business.TypePropertyCache.GetPropertyInfo(Object Owner, String PropertyName) +45
MicroFour.StrataFrame.Business.BusinessLayer.BindDataToWebControl(IWebBusinessBindable ControlToBind, IWebBinding Binding) +251
MicroFour.StrataFrame.Business.BusinessLayer.BindDataToWebControlPrimary(IWebBusinessBindable ControlToBind) +55
MicroFour.StrataFrame.UI.Web.BasePage.BindControls() +166
[UIException: An error occurred while binding data to the web control 'deDateFrom'.]
Vfs.Generic.UI.Web.Strataframe.Forms.BasePage.OnPreRender(EventArgs e) +322
System.Web.UI.Control.PreRenderRecursiveInternal() +86
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041
Beside, I also hit this error, if not mistaken no other user is running beside myself. As I check _SharedTables is also static/shared and didn't see any code ensure threadsafe in ShareCurrentDataTable().
Server Error in '/FlexHR' Application.
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
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:
[NullReferenceException: Object reference not set to an instance of an object.]
System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add) +455
System.Collections.Generic.Dictionary`2.Add(TKey key, TValue value) +11
MicroFour.StrataFrame.Business.SharedDataTableCollection.AddBusinessObjectTable(BusinessLayer BusinessObject) +243
MicroFour.StrataFrame.Business.BusinessLayer.ShareCurrentDataTable(BusinessLayer BusinessObject) +162
MicroFour.StrataFrame.Business.BusinessBindingSource.CreateShareAndAddBusinessObject(Int32 index) +94
MicroFour.StrataFrame.Business.BusinessBindingSource.get_Item(Int32 index) +115
MicroFour.StrataFrame.Business.Enumerator.get_Current() +34
MicroFour.StrataFrame.UI.Web.Enumerator.get_Current() +9
DevExpress.Web.ASPxClasses.Internal.CommonUtils.ConvertEnumerableToList(IEnumerable source) +98
DevExpress.Web.Data.WebDataProxy.SetDataSource(Object dataSource) +48
DevExpress.Web.ASPxGridView.ASPxGridView.PerformDataBinding(String dataHelperName, IEnumerable data) +48
DevExpress.Web.ASPxClasses.Internal.DataHelper.PerformDataBinding(IEnumerable data) +26
DevExpress.Web.ASPxClasses.Internal.DataHelper.OnDataSourceViewSelectCallback(IEnumerable data) +75
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +29
MicroFour.StrataFrame.UI.Web.WebBusinessBindingSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +8
DevExpress.Web.ASPxClasses.Internal.DataHelper.PerformSelect() +197
DevExpress.Web.ASPxGridView.GridViewDataHelper.PerformSelect() +116
DevExpress.Web.ASPxClasses.Internal.DataContainer.PerformSelect() +118
DevExpress.Web.ASPxClasses.ASPxDataWebControlBase.DataBindCore() +15
DevExpress.Web.ASPxClasses.ASPxDataWebControlBase.DataBind() +138
DevExpress.Web.ASPxGridView.ASPxGridView.DataBind() +157
DevExpress.Web.ASPxClasses.Internal.DataHelperBase.EnsureDataBound(Boolean ensureChildControls) +89
DevExpress.Web.ASPxClasses.Internal.DataContainer.EnsureDataBound() +128
DevExpress.Web.ASPxClasses.ASPxDataWebControlBase.OnPreRender(EventArgs e) +19
Vfs.Generic.UI.Web.DevEx.Controls.BaseGridView.OnPreRender(EventArgs e) +40
System.Web.UI.Control.PreRenderRecursiveInternal() +86
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041
Finally, FYI, I have recompile all SF dll from source code.
Please advice. Thank you
|
By ChanKK - 4/1/2009
Hi,
Please update me if any status, whether SF team is checking on this, fixing it or still think that it is not SF problem. I need to know so that I can plan for next step.
FYI, I am trying to scale down my project in order to reproduce it. It will take me some time. Meanwhile, I would like to get updated ASAP so that I will not waste my time anymore to do something that not helpful.
Thank you
|
By Trent L. Taylor - 4/1/2009
We are trying to reproduce this....as you could suspect...and we seem to have good luck with this towards you for some reason...we cannot reproduce. I am waiting for another developer looking at this and when we know something or need something I will let you know. Thanks.
|
By ChanKK - 4/1/2009
Hi,
Thank you for update.
Just would like to share with you, we found that, the problem can be consistently if we do IISRESET, delete temporary ASP,NET cache and then run the app. Once the problem occurred, try to refresh the screen and the chance to hit the problem would be reduced.
Hope it helps.
Thank you
|
By ChanKK - 4/1/2009
Hi,
I confident that SF Team would fix ALL the similar/potential static/share issue.
Anyhow, I would like to share with you that, I have roughly search thru SF source code and found the following method that MIGHT NOT thread safe.
BusinessLayer
ResetIsSavedOnTransactionFlagOnBusinessObjects
DbDataSourceItem
TransactionBegin
TransactionCommit
TransactionRollback
Currently, we could use Guid as transactionkey as workaround to ensure threadsafe. However, this is not mentioned in any documentation as I know, therefore other developers might hit the same problem again.
DataLayer
RowHasErrors
typepropertycache
SetPropertyValue
|
By StrataFrame Team - 4/2/2009
I've wrapped most of those that needed it in a SyncLock. Several of the places were already using Monitor.Enter() & Exit() to ensure threadsafe saving. I changed all of the ones that are used in a static context. We'll do another build and see if that helps. If it doesn't, then we'll need to figure out how to get this into a reproducible state because the NullReferenceException is being thrown by .NET, not from within our code.
|
By ChanKK - 4/2/2009
Hi,
May I know when would it available for download?
Thank you
|
By Trent L. Taylor - 4/2/2009
We will do another build tomorrow morning.
|
By Trent L. Taylor - 4/4/2009
I will send you a link to a custom build to test this this afternoon. We are building this now.
|
|