Welcome Guest Search | Active Topics | Sign In | Register

URGENT Nullreference Exception Options
M. Heinsohn
Posted: Sunday, August 2, 2015 12:18:58 PM
Rank: Member
Groups: Member

Joined: 5/6/2015
Posts: 25
Hi,

your DLL crashes our application. It's running as a service. Yesterday, and whole last week, it runs well, now it crashed every 10-20 min on our production server. Reboot and switching to latest build doesn't help


Code: Visual Basic.NET
Application: XXX
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
Stack:
   at EO.Internal.z.a(e ByRef, IntPtr, UInt32, UInt32)
   at EO.Internal.z.a(Int32, e ByRef)
   at EO.Internal.z.a(Int32)
   at EO.Base.ThreadRunnerBase.d()
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object, Boolean)
   at System.Threading.ExecutionContext.Run(System.Threading.ExecutionContext, System.Threading.ContextCallback, System.Object)
   at System.Threading.ThreadHelper.ThreadStart()


here are the routine where i call your functions

Code: Visual Basic.NET
Private Function FU_GenerateBase64(trans_html As String, trans_width As Integer, trans_height As Integer) As String
    FU_GenerateBase64 = ""
    Try
      Dim loc_stopwatch As New Stopwatch
      Dim Loc_MD5 As New Security.Cryptography.MD5CryptoServiceProvider
      Dim Loc_Bytes() As Byte = System.Text.UTF8Encoding.UTF8.GetBytes(trans_html & trans_width & trans_height)
      Dim Loc_Key As String = Replace(VAR_Global.FU_MakeHEX(Loc_MD5.ComputeHash(Loc_Bytes)), " ", "")
      Dim Loc_TimeOut As Boolean = False
      If Cloc_RenderCache.ContainsKey(Loc_Key) = False Then
        SU_Log(ENU_Log.VollDebug, "Render GXT Start;Width:" & trans_width & ";Height:" & trans_height & ";HTML:" & trans_html & ";Key:" & Loc_Key)
        loc_stopwatch.Start()
        Cloc_WebView.Resize(trans_width, trans_height)
        Cloc_threadRunner.Send(Sub()
                          If Cloc_WebView.LoadHtml(trans_html).WaitOne(3000) = True Then
                            System.Threading.Thread.Sleep(50)
                            Using Loc_Image As Drawing.Image = Cloc_WebView.Capture(True)
                              Using Loc_Bitmap As New Bitmap(Loc_Image)
                                Using ms As New IO.MemoryStream()
                                  Loc_Bitmap.MakeTransparent(Drawing.Color.White)
                                  Loc_Bitmap.Save(ms, Drawing.Imaging.ImageFormat.Png)
                                  ms.Position = 0
                                  FU_GenerateBase64 = System.Convert.ToBase64String(ms.ToArray)
                                End Using
                              End Using
                            End Using
                          Else
                            SU_Log(ENU_Log.Fehler, "Render GXT Timeout 3000 ms; HTML=" & trans_html)
                            Loc_TimeOut = True
                          End If
                        End Sub)
        loc_stopwatch.Stop()
        ' only for caching
        If Loc_TimeOut = False Then
          Cloc_RenderCache.Add(Loc_Key, FU_GenerateBase64)
          If Cloc_RenderCache.Keys.Count > 10 Then Cloc_RenderCache.Remove(Cloc_RenderCache.Keys(0))
          SU_Log(ENU_Log.VollDebug, "Render GXT ENDE Time:" & loc_stopwatch.ElapsedMilliseconds & "ms")
        End If
      Else
        SU_Log(ENU_Log.VollDebug, "Render GXT CACHE;Key:" & Loc_Key)
        FU_GenerateBase64 = Cloc_RenderCache(Loc_Key)
      End If
    Catch ex As Exception
      SU_Log(ENU_Log.Fehler, ex.ToString)
    End Try
  End Function


outside only this

Code: Visual Basic.NET
Private Cloc_threadRunner As New EO.WebBrowser.ThreadRunner()
	Private WithEvents Cloc_WebView As New EO.WebBrowser.WebView
	Private Cloc_RenderCache As New Dictionary(Of String, String)

	Public Sub New()
		EO.WebBrowser.Runtime.AddLicense( _
		  XXX
		Cloc_WebView = Cloc_threadRunner.CreateWebView
	End Sub


without looking in your sources i don't know why this error occurs
eo_support
Posted: Sunday, August 2, 2015 3:06:55 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

We can't tell exactly what it is just be looking at the code. Can you isolate the problem into a test app and send the test app to us? You can find more instructions on how to send test app to us here:

http://www.essentialobjects.com/forum/test_project.aspx

Thanks!
M. Heinsohn
Posted: Monday, August 3, 2015 4:31:52 AM
Rank: Member
Groups: Member

Joined: 5/6/2015
Posts: 25
Sorry,

at the moment i could not isolate the problem in an standalone application. It crashed in customer environment not on my test machines.

The colleagues have installed dotnet 4.5 just for testing and at the moment it doen't crash.
eo_support
Posted: Monday, August 3, 2015 10:15:49 AM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Unfortunately we can't do much before we can reproduce it and see exactly what it is. So please try to reproduce it.

Thanks!
M. Heinsohn
Posted: Tuesday, August 4, 2015 3:31:23 AM
Rank: Member
Groups: Member

Joined: 5/6/2015
Posts: 25
Sorry, thats not possible. It has crashed only in customer enviroment. And at the moment it runs. Don't know why the install of the dotnet 4.5 help, but it's running.
eo_support
Posted: Wednesday, August 5, 2015 5:54:40 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

Please let us know if you see it occuring again. Make sure you capture the stack trace as well as log information. You can find more information on how to capture the log information here:

http://www.essentialobjects.com/doc/common/collect_logs.aspx

Once you have those information, you can email them to us. See here for our email address:

http://www.essentialobjects.com/forum/test_project.aspx

Once we have those, we will take a look and see what we can find.

Thanks!
M. Heinsohn
Posted: Thursday, August 6, 2015 4:45:12 AM
Rank: Member
Groups: Member

Joined: 5/6/2015
Posts: 25
yes it occurs, only once 1-2 days. I will try to get more log information.
M. Heinsohn
Posted: Thursday, August 27, 2015 9:45:13 AM
Rank: Member
Groups: Member

Joined: 5/6/2015
Posts: 25
Hi,

at the moment i don't have more log but i've another issue about this. The EO Dll starts a Child with rundl32 for each seperate thread i have. Thats ok. But the memory Usage not. Here is a Screenshot.
For explanation what i have done. It shows the memory usage with Process Explorer. My Application "E3_Framework.exe" starts some threads, each one with its own EO.Webbrowser & EO.Threadrunner object and each renders with following code (Changed to my old one cause the threadrunner call has no more call without timeout)
Code: Visual Basic.NET
Private Function FU_GenerateBase64(trans_html As String, trans_width As Integer, trans_height As Integer) As String
    FU_GenerateBase64 = ""
    Try
      Dim loc_stopwatch As New Stopwatch
      Dim Loc_MD5 As New Security.Cryptography.MD5CryptoServiceProvider
      Dim Loc_Bytes() As Byte = System.Text.UTF8Encoding.UTF8.GetBytes(trans_html & trans_width & trans_height)
      Dim Loc_Key As String = Replace(VAR_Global.FU_MakeHEX(Loc_MD5.ComputeHash(Loc_Bytes)), " ", "")
      Dim Loc_TimeOut As Boolean = False
      If Cloc_RenderCache.ContainsKey(Loc_Key) = False Then
        SU_Log(ENU_Log.VollDebug, "Render GXT Start;Width:" & trans_width & ";Height:" & trans_height & ";HTML:" & trans_html & ";Key:" & Loc_Key)
        loc_stopwatch.Start()
        Cloc_WebView.Resize(trans_width, trans_height)
        If Cloc_threadRunner.Send(Sub()
                            Try
                              If Cloc_WebView.LoadHtml(trans_html).WaitOne = True Then
                                System.Threading.Thread.Sleep(50)
                                Using Loc_Image As Drawing.Image = Cloc_WebView.Capture(True)
                                  Using Loc_Bitmap As New Bitmap(Loc_Image)
                                    Using ms As New IO.MemoryStream()
                                      Loc_Bitmap.MakeTransparent(Drawing.Color.White)
                                      Loc_Bitmap.Save(ms, Drawing.Imaging.ImageFormat.Png)
                                      ms.Position = 0
                                      FU_GenerateBase64 = System.Convert.ToBase64String(ms.ToArray)
                                    End Using
                                  End Using
                                End Using
                              Else
                                SU_Log(ENU_Log.Fehler, "Render GXT LoadHtml; HTML=" & trans_html)
                                Loc_TimeOut = True
                              End If
                            Catch ex As Exception
                              Loc_TimeOut = True
                              SU_Log(ENU_Log.Fehler, "Render GXT ERROR=" & ex.ToString & "; HTML=" & trans_html)
                            End Try
                          End Sub, 3000) = True Then
          SU_Log(ENU_Log.Fehler, "Render GXT ThreadRunner Timeout; 3000 ms; HTML=" & trans_html)
          Loc_TimeOut = True
        End If
        loc_stopwatch.Stop()
        ' Damit nur 10 gespeichert werden
        If Loc_TimeOut = False Then
          Cloc_RenderCache.Add(Loc_Key, FU_GenerateBase64)
          If Cloc_RenderCache.Keys.Count > 10 Then Cloc_RenderCache.Remove(Cloc_RenderCache.Keys(0))
          SU_Log(ENU_Log.VollDebug, "Render GXT ENDE Time:" & loc_stopwatch.ElapsedMilliseconds & "ms")
        End If
      Else
        SU_Log(ENU_Log.VollDebug, "Render GXT CACHE;Key:" & Loc_Key)
        FU_GenerateBase64 = Cloc_RenderCache(Loc_Key)
      End If
    Catch ex As Exception
      SU_Log(ENU_Log.Fehler, ex.ToString)
    End Try
  End Function


I have manualy started rendering in a loop. With the last one i made a clear log with the Process Explorer. I started about every 1 second 3 objects to render. In a loop so the content is evertime the same. I've tried this ca. one minute and the memory usage goes up and never goes down. Even after 30 min no change. On customer Machine there are more rundll32.exe entrys than Threads i have created and many of them goes > 500mb (Machine crashed cause to much memory usage). Looks like there is an leak. I've tested with EO.Total 2015.2.37.0 on customer Machine runs EO.Total 2015.2.10.0 but has the same problems.
eo_support
Posted: Thursday, August 27, 2015 1:37:58 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,071
Hi,

It's normal that you have more rundll32.exe than the number of threads you have. Chrome uses multiple processes for different purposes. For example, it uses a dedicated process for GPU.

We are not aware of any memory leak in the latest build. If you suspect a memory leak, you can try to isolate the problem into a test project and send us the test project. Once we have that we will be happy to investigate further. See here for instructions on how to send test code to us:

http://www.essentialobjects.com/forum/test_project.aspx

Build 2015.2.37.0 does handle memory better than earlier 2015 builds. So you might want to stay on that build.

Thanks!
M. Heinsohn
Posted: Tuesday, September 1, 2015 9:30:42 AM
Rank: Member
Groups: Member

Joined: 5/6/2015
Posts: 25
Hi,

it looks its stable and goes between 200mb and 450mb regardles and for each thread i have one extra rundll thread. I've forgotten the disposing after i closed my thread.


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.