Memory leak SF BO with DevExpress ASPxDataGridView


Author
Message
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Chan,

I appreciate your comments.  We too appreciate you and your business. 

What is the better approach? Ask before search?

Most definitely.  There is rarely ever a situation where you need to bring back thousands of records.  There is no way for a user to comprehend that many records anyway.  It is always good practice to limit the number of records that are returned.  Not just due to memory, but for user interaction, comphension, and usability.

Grids, in any environment, can be great tools.  But they can also come with a vast amount of overhead.  Also, they are not always the best solution for presenting a user-friendly experience.

In our medical software there are three places that we use grids.  They all have to do with billing and showing transactions associated with an account or billing claims going out.  However, we still limit the number of records that come back.  There is rarely a need to load up tens of thousands (or even hundreds in many cases) unless they are directly related to the task at hand.

Example, we had a patient that had over 6000 transactions (that would translate into about 3000 visits to the doctor or so).  That is CLEARLY not the norm for most environments.  But it was the upper end for sure.  When this was loaded into the grid, we made sure it was optimized for this type of experience.  But this was still too much for the end-user to comprehend.  So we have searches and filters to make the data usable...and limit records as well.  6000 records really isn't that many for a grid on WinForms to handle...but for the web....this would be next to impossible to use.  So we apply a filter or search PRIOR to showing the records while still showing summaries and totals for the full record set.  Make sense?

These are just development techniques that make life better for both the developer as well as the end-user.

ChanKK
ChanKK
StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)
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
ChanKK
StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

BTW, the error posted just now happen to all page that contains save function.
ChanKK
ChanKK
StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Sorry, one more week past. Any update?



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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
ChanKK
StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)
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
ChanKK
StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)
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
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
Agreed.  The Clone should not cause an issue as it creates a unique instance which is then fully autonomous from the other instance.
ChanKK
ChanKK
StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)StrataFrame User (414 reputation)
Group: Forum Members
Posts: 190, Visits: 1.3K
Hi,

Any hint how to troubleshoot on this?



Thank you
Trent Taylor
Trent Taylor
StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)StrataFrame Developer (10K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 6.9K
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.

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search