ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
Hi,
I am facing memory leak problem when using SF BusinessObject and DevExpress ASPxDataGridView.
I have simple test project, which only has one BO, bind to ASPxDataGridView. It does nothing complicated, just load all records in Page_Load if not IsPostBack.
I found that, the memory usage would become double when I just "refresh" the page. I also used dotTrace profiler and found that # of BO instances keep increasing. I suspect it is the same issue with the post http://forum.strataframe.net/Topic20903-8-1.aspx.
I have prepared sample project and the dotTrace memory profiler files for your reference. MemoryLeak1.dtm is first load memory snapshot and MemoryLeak2.dtm is 2nd snapshot after refresh.
As the file size > 30MB, please download it from http://www.visualsolutions.com.my/blog/chankk/WebApplication6.zip
Hope you could get back to me as soon as possible! It is very urgent!
Thank you
|
|
|
ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
Hi, Any status? Beside, as promised I have downloaded the latest SF setup and try again. It hit another error. By using the setup 1.6.6.9 which dated 5th, Apr, it is working fine. However, once we setup 1.6.6.9 dated 17th, Apr, the following error occurred. Now, we have reverted back to 4th, Apr one and now is working fine. Please advice Server Error in '/FlexHR' Application.
--------------------------------------------------------------------------------
This SqlTransaction has completed; it is no longer usable.
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.InvalidOperationException: This SqlTransaction has completed; it is no longer usable.
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:
[InvalidOperationException: This SqlTransaction has completed; it is no longer usable.]
System.Data.SqlClient.SqlTransaction.ZombieCheck() +831309
System.Data.SqlClient.SqlTransaction.Rollback() +88
MicroFour.StrataFrame.Data.DbDataSourceItem.TransactionEnd(String TransactionKey, Boolean IsCommit) +445
MicroFour.StrataFrame.Data.DbDataSourceItem.TransactionRollback(String TransactionKey) +9
MicroFour.StrataFrame.Data.DataLayer.TransactionRollback(String DataSourceKey, String TransactionKey) +45
MicroFour.StrataFrame.Business.BusinessLayer.TransactionRollback(String DataSourceKey, String TransactionKey) +5
Vfs.Generic.UI.Web.Strataframe.Forms.DataEntryBasePage.Save(Boolean transactional, String transactionKey) +1315
Vfs.Generic.UI.Web.ExtendedControls.MaintenanceToolbar.HandleMenuItemClick(Object source, MenuItemEventArgs e) +562
DevExpress.Web.ASPxMenu.ASPxMenuBase.OnItemClick(MenuItemEventArgs e) +107
DevExpress.Web.ASPxMenu.ASPxMenuBase.RaisePostBackEvent(String eventArgument) +325
DevExpress.Web.ASPxClasses.ASPxWebControl.System.Web.UI.IPostBackEventHandler.RaisePostBackEvent(String eventArgument) +10
System.Web.UI.Page.RaisePostBackEvent(IPostBackEventHandler sourceControl, String eventArgument) +13
System.Web.UI.Page.RaisePostBackEvent(NameValueCollection postData) +175
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +1565
--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.3053; ASP.NET Version:2.0.50727.3053
|
|
|
ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
Hi,
BTW, the error posted just now happen to all page that contains save function.
|
|
|
ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
Sorry, one more week past. Any update?
Thank you
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 7K
|
Chan, We have not reproduced your memory leak as we had mentioned in the previous comment on this topic. In regards to your error posted about saving...I think that at this point you may be a little "gun-shy" as this has not changed in the framework in some type. You are more than welcome to give me steps to reproduce this, but this hasn't changed, Chan. As I mentioned in my previous post, we cannot reproduce a memory leak nor is there an issue with the transactional saves. You may forget that we are not only framework developers, but also use the framework in developing a major medical application. The version to which you are saying you are receiving an error regarding transactions is pushed out into the field and we use transactions heavily in all of our transaction posting. So I am VERY confident in this code. I think that you have a cross section of assemblies from different versions or something with your structures or SPROCs that could potentially be cuasing this. As you well know, StrataFrame is a framework for developers which means that many times when an error occurs it has nothing to do with the framework but something within the environment or code that has been developed. This is always a balancing act to find out exactly where an issue may be occuring. If you can provide steps to reproduce this then we will most definitely do so. Otherwise there is nothing I can do to help.
|
|
|
ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
Hi, As mentioned in PM, the actual problem of Save transaction is "object reference is not set" during DataLayer.Save(). After some debugging, I found that if my web form contains more than one BO and I save all of them in a loop (within transaction), the 2nd BO.Save() will be failed. It is caused by the connection and transaction object is null at the point of code as below. '-- UpdateRow
'-- Set the connection
If Me.CanConnectDirectly Then
If QueryInfo.IsTransactional Then
loCommand.Transaction = CType(Me.Transactions(QueryInfo.TransactionKey), SqlTransaction)
loCommand.Connection = CType(Me.Transactions(QueryInfo.TransactionKey).Connection, SqlConnection) The cause of both references are null, I suppose, is caused by this code
'-- Get a clone to avoid thread locking
loCommand = loCommand.Clone()
'-- Some code here
'-- Dispose of the cloned command
loCommand.Connection = Nothing
loCommand.Dispose()
As I see the cloned command object is assigned back to same variable. Then, the command.Connection is set to null as clean up. What do you think? Please advice. Thank you
|
|
|
ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
Hi,
After further thinking, don't feel loCommand = loCommand.Clone() can cause this problem. hmmm...
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 7K
|
Agreed. The Clone should not cause an issue as it creates a unique instance which is then fully autonomous from the other instance.
|
|
|
ChanKK
|
|
Group: Forum Members
Posts: 190,
Visits: 1.3K
|
Hi,
Any hint how to troubleshoot on this?
Thank you
|
|
|
Trent Taylor
|
|
Group: StrataFrame Developers
Posts: 6.6K,
Visits: 7K
|
Well, this thread is getting a bit ambiguous. I was just commenting on your Clone comment. In regards to the core of your issue, are you referring the SqlTransaction error? The error, which you have already learned, is going to be specific to something that you are doing within your code. So the questions to work through are: - When are you creating a transaction?
- Is it possible for the same code to be called at the same time?
- Are the objects in question specific to a session or the application?
- Are you using shared data tables?
- If you turn off transactions do your issues go away?
These are types of things that you need to be asking yourself. Only you know your exact code and what you have done at this point. This code is going to be related to your specific application. So I would begin to work through these questions.
|
|
|