ORM Hangs w3wp.exe process

4 posts, 1 answers
  1. Adam
    Adam avatar
    2 posts
    Member since:
    Nov 2007

    Posted 18 Jan Link to this post

    Hello, I have a stored procedure that I access with OpenAccess.  When I use the ORM and my site gets hit with a lot of traffic the w3wp.exe hangs.  When I access the same stored procedure using a .net dataset everything works fine. Below is some code I used for testing purposes.  Can someone help me figure out my code keeps crashing my website?

    Thanks!

     

    ----------------------------------------------------------------------------------------------------------------------------------------------------

    Imports HOSTEDOHTableAdapters
    Imports System.Diagnostics

    Partial Class speed_test
        Inherits System.Web.UI.Page

        Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
            Dim sw0 As Stopwatch = Stopwatch.StartNew()
            For i = 0 To 10000
                ORM()
            Next
            sw0.Stop()
            Response.Write("Average: " & CStr(sw0.ElapsedMilliseconds \ 10000)) 'w3wp.exe hangs

            Dim sw1 As Stopwatch = Stopwatch.StartNew()
            For i = 0 To 10000
                DataSet()
            Next
            sw1.Stop()
            Response.Write("Average: " & CStr(sw1.ElapsedMilliseconds \ 10000)) 'Average: 12.1238 
        End Sub

        Sub DataSet()
            Dim myAdapter As New oh_GetHostedWebsiteDataTableAdapter
            Dim websites As HOSTEDOH.oh_GetHostedWebsiteDataDataTable = myAdapter.GetData("www.ahlandalpacas.com", 0)
            Dim websiteInfo As HOSTEDOH.oh_GetHostedWebsiteDataRow
            Dim sAccountType As String = ""

            If websites.Rows.Count >= 1 Then
                websiteInfo = websites(0)
                If Not websiteInfo.IsAccountTypeNull Then sAccountType = websiteInfo.AccountType
            End If
        End Sub

        Sub ORM()
            Dim dbContext As New OpenherdORM.EntitiesModel()
            Dim q = dbContext.Oh_GetHostedWebsiteData("www.ahlandalpacas.com", 0)
            Dim sAccountType As String = ""

            If q.Count >= 1 Then
                If Not String.IsNullOrEmpty(q.FirstOrDefault.AccountType) Then sAccountType = q.FirstOrDefault.AccountType
            End If
        End Sub

    End Class

  2. Answer
    Viktor Zhivkov
    Admin
    Viktor Zhivkov avatar
    291 posts

    Posted 21 Jan Link to this post

    Hello Adam,

    My guess is that you might have exhausted your connection pool by creating 10 000 OpenAccessContext instances and not disposing them. In combination with database function or stored procedure you may be leaking open transactions and connections.
    Please add global exception handler to your application, or try/catch block that wraps your Data Access code to see the exact exception. If you are unable to resolve the issue with that additional information, please send us the exception message together with all InnerExceptions so we can analyze it and get better understanding of what is going on.

    Regards,
    Viktor Zhivkov
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
  3. DevCraft banner
  4. Adam
    Adam avatar
    2 posts
    Member since:
    Nov 2007

    Posted 27 Jan in reply to Viktor Zhivkov Link to this post

    Hi Viktor, can you please point out some documentation on how dispose the OpenAccessContext instances or give me a code snippet?

     Thanks,

     Adamn

  5. Viktor Zhivkov
    Admin
    Viktor Zhivkov avatar
    291 posts

    Posted 01 Feb Link to this post

    Hello Adam,

    Here are several links to our documentation that may help you verify if you are disposing your context properly: If you need any further assistance do not hesitate to contact us.

    Regards,
    Viktor Zhivkov
    Telerik
     
    Check out the latest announcement about Telerik Data Access vNext as a powerful framework able to solve core development problems.
Back to Top