This is a migrated thread and some comments may be shown as answers.

ORM Hangs w3wp.exe process

3 Answers 51 Views
Data Access Free Edition
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Adam
Top achievements
Rank 1
Adam asked on 19 Jan 2016, 04:26 AM

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

3 Answers, 1 is accepted

Sort by
0
Accepted
Viktor Zhivkov
Telerik team
answered on 21 Jan 2016, 03:47 PM
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.
0
Adam
Top achievements
Rank 1
answered on 27 Jan 2016, 02:33 PM

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

 Thanks,

 Adamn

0
Viktor Zhivkov
Telerik team
answered on 01 Feb 2016, 03:07 PM
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.
Tags
Data Access Free Edition
Asked by
Adam
Top achievements
Rank 1
Answers by
Viktor Zhivkov
Telerik team
Adam
Top achievements
Rank 1
Share this question
or