Ticket T525575
Visible to All Users

Application hangs intermittently when explicit transactions are used

created 8 years ago

[DevExpress Support Team: CLONED FROM T493126: Updater ExecuteNonQueryCommand doesn't work with 16.2.5 ObjectSpace]
I ran into another issue with this new ObjectSpace provider under 17.1.3.17146

using explicit transactions (in a unit of work) causes XPO object selects (using GetObjectByKey, for instance) to hang intermittently when trying to retrieve referenced objects.  Very difficult to re-produce, however, when I went back to the previous objectspace I had this problem went away.

Show previous comments (5)
Dennis Garavsky (DevExpress) 8 years ago

    Hello Randy,

    Since the contents of the lcUpdateService and lcUpdateWhere variables are unknown, it is difficult to provide more diagnostics at this stage. For now, we can only guess that there is a  deadlock.

    In general, it all looks like you do not need the OptimisticLocking field and a related XPO feature at all here. To completely disable optimistic locking for required persistent classes, decorate them with the [OptimisticLocking(false)] attribute.

      lcUpdateService:

      C#
      "UPDATE Service SET OptimisticLockField = OptimisticLockField + 1, Status = 20, UpdateWebDocsData = 1, UpdatedBy = '331df34a-eea5-4213-b05a-a248ae0058ef', DateUpdated = '06/28/2017'"

      lcUpdateServiceRecording:

      C#
      "UPDATE ServiceRecording SET DatePrinted = '06/28/2017', InitialDatePrinted = '06/28/2017', DateSigned = '06/28/2017', CreateCheck = 0 "

      lcUpdateWhere:

      C#
      "WHERE Oid = 205"

      Yes, there is a deadlock situation because it seems that the ObjectSpace I'm using to insert a new ServiceRecordingHistory object can be on a different SPID than my UnitOfWork if I am using pooling.  Question, for a Winform XAF application is pooling going to provide much of a performance boost?

      I do not want to decorate ServiceRecording (derived from Service) with the OptimisticLocking(false) attribute because normally, outside this process, I want OptimisticLocking to occur so I need a way to dynamically "force" the updates to succeed in this piece of code.  I still want to update OptimisticLockField, however, because I don't want end-user updates to override what I just committed if they happen to be trying to save the same object after my update is committed.  But I also need these updates to be atomic with the Insert of the new ServiceRecordingHistory object.  I suppose I could always create the insert statement and use ExecuteNonQuery for that as well, its just not as convenient as using the XPO objects for this.

      Anatol (DevExpress) 8 years ago

        In WinForms, a single application's instance uses the same Data Layer and Data Store for the most operations. So, pooling is helpful there only in specific cases - in particular, when the InstantFeedback mode is used. This mode requires thread-safe operations with business objects, and if the application's XPObjectSpaceProvider is not thread-safe, a separate Data Layer is created for these calls. Without pooling, this would require opening two database connections, while with pooling, the same connection instance is used. So, if you are using Instant Feedback in some List Views, check if their performance remains at an appropriate level after pooling is disabled.
        Let me know if you need further assistance with this issue.

        Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.

        Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.