Announcement

Collapse
No announcement yet.

crashing esignal when exiting app

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • crashing esignal when exiting app

    Esignal 7.7 Beta 4
    VB.NET

    App runs fine it seems, but when we exit it always crashes the main esignal application with the following error:
    ___________

    Eisignal Layout - ADVANCED CHARTING: winsig.exe - Application Error
    The instruction at "0x77f5b2ab" referenced memory at "0x00000028". The memory could not be "read".
    Click OK to terminate the program.

    ___________

    App sets up two esignal.RequestTimeSales. The crash does not occur in the app that only requests one. We are requesting two by setting up an array variable "tsHandle()": i.e., tsHandle(0) and tsHandle(1).

    This seems to work ok. The "OnTimeSalesChanged" event triggers seemingly reliably passing to it which ever handle's data has changed.

    We separated the closing routines from the closing of the app to try to see where the crashing is occurring.

    To close, we release each handle. No crash to release the handles, but will crash when the app ends.
    We added "RelaseAllTimeSales()" and "ClearSymbolCache(). Still no crash, but still crashes when the app ends.
    We added "esignal=Nothing". Doesn't cause a crash, but esignal main app still crashes when our app ends.

    Even after rebooting the memory addresses specified in the error message are always the same.

    Ideas?

  • #2
    There is another developer that is experiencing this problem.

    Could you attach a snippet of code that causes this crash?

    Comment


    • #3
      code snippet

      Stripped all the jazz we've been putting in to integrate with MSSQL2000 and dynamically build the tsHandle array, etc. This will still crash it.

      One form with two buttons. The esignal connection in made in the form1_load sub. One button calls two instances of RequestTimeSales passing a filter. The other releases the handles.

      The "OnTimeSalesChanged" event just writes the handle to the console and it will/does indicate both handles are being triggered. That trips along nicely.

      Then clicking the button to release the handles stops it and all seems well.

      Close the form (which closes the app) and esignal crashes.

      Here is the code:

      Public Class Form1
      Inherits System.Windows.Forms.Form

      Public WithEvents esignal As IESignal.Hooks
      Dim tsHandle() As Long



      #Region " Windows Form Designer generated code "

      Public Sub New()
      MyBase.New()

      'This call is required by the Windows Form Designer.
      InitializeComponent()

      'Add any initialization after the InitializeComponent() call

      End Sub

      'Form overrides dispose to clean up the component list.
      Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
      If disposing Then
      If Not (components Is Nothing) Then
      components.Dispose()
      End If
      End If
      MyBase.Dispose(disposing)
      End Sub

      'Required by the Windows Form Designer
      Private components As System.ComponentModel.IContainer

      'NOTE: The following procedure is required by the Windows Form Designer
      'It can be modified using the Windows Form Designer.
      'Do not modify it using the code editor.
      Friend WithEvents btnStartCollection As System.Windows.Forms.Button
      Friend WithEvents Button1 As System.Windows.Forms.Button
      <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
      Me.btnStartCollection = New System.Windows.Forms.Button
      Me.Button1 = New System.Windows.Forms.Button
      Me.SuspendLayout()
      '
      'btnStartCollection
      '
      Me.btnStartCollection.Location = New System.Drawing.Point(224, 160)
      Me.btnStartCollection.Name = "btnStartCollection"
      Me.btnStartCollection.Size = New System.Drawing.Size(112, 24)
      Me.btnStartCollection.TabIndex = 0
      Me.btnStartCollection.Text = "&Start Collection"
      '
      'Button1
      '
      Me.Button1.Location = New System.Drawing.Point(224, 208)
      Me.Button1.Name = "Button1"
      Me.Button1.Size = New System.Drawing.Size(112, 32)
      Me.Button1.TabIndex = 4
      Me.Button1.Text = "Release Handles"
      '
      'Form1
      '
      Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
      Me.ClientSize = New System.Drawing.Size(504, 422)
      Me.Controls.Add(Me.Button1)
      Me.Controls.Add(Me.btnStartCollection)
      Me.Name = "Form1"
      Me.Text = "Form1"
      Me.ResumeLayout(False)

      End Sub

      #End Region



      Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
      esignal = New IESignal.Hooks
      ReDim tsHandle(1)
      Dim i As Integer
      For i = 0 To UBound(tsHandle)

      tsHandle(i) = -1
      Next
      esignal.SetApplication("ccochran")
      If esignal.IsEntitled = False Then
      MsgBox("Can not interface with ESignal: " & esignal.GetIsEntitledError)
      End If
      End Sub

      Private Sub btnStartCollection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartCollection.Click
      'this starts the collection


      Dim filter As IESignal.TimeSalesFilter
      filter = New IESignal.TimeSalesFilter
      filter.bFilterPrice = 0
      filter.bFilterQuoteExchanges = 0
      filter.bFilterTradeExchanges = 0
      filter.bFilterVolume = 0
      filter.bQuotes = 0
      filter.bTrades = 1
      filter.lNumDays = 2

      Dim i As Integer
      For i = 0 To 1

      If i = 0 Then
      filter.sSymbol = "ES U4"
      Else
      filter.sSymbol = "ZB U4"
      End If
      tsHandle(i) = esignal.RequestTimeSales(filter)
      If esignal.IsTimeSalesReady(tsHandle(i)) Then
      ' Data already in cache, won't receive event until next "live" tick
      'do something here
      Else
      'indicate request has been sent
      End If

      Next

      End Sub

      Private Sub esignal_OnTimeSalesChanged(ByVal lHandle As Integer) Handles esignal.OnTimeSalesChanged
      'this successfully writes the handles to the console and it is being triggered for both handles
      Console.WriteLine(Now & "-OnTimeSalesChanged-" & lHandle)
      End Sub

      Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
      Dim i As Integer


      For i = 0 To 1
      If tsHandle(i) <> -1 Then
      esignal.ReleaseTimeSales(i)

      End If
      Next i
      esignal.ReleaseAllTimeSales()
      esignal.ClearSymbolCache()
      esignal = Nothing

      End Sub


      End Class

      Comment


      • #4
        I've been seeing this same crash for some time as well. There are some others also. Have sent many of them to you guys via your crash tools.

        Generally I'm always doing mostly the same things programmatically, but at different times can get crashes seemingly at random. All I do is set the link symbol and get history data.

        This is all C++.

        My "solution" was to put the logic to cleanup and restart eSignal in the COM error handler... Works pretty well! Hope that this crash can be tracked down though - as sometimes everything buggers up..

        If there is a debug version you want me to run to track it down, contact me. I haven't been able to attach correctly to the release version to get a call stack for debugging.

        -Jim

        Comment


        • #5
          trimmed down code

          Here is basically the same code but trimmed down quite a bit more. One form and one button. It will crash Esignal app within seconds of closing this vb.net app every time.

          I have been comparing it to the app that GenSpoo posted at this thread http://forum.esignalcentral.com/show...&threadid=9155 and I can not see the significant difference. That app will not crash Esignal.

          Here's the code. I'm also attaching the app.
          -----------
          Public Class Form1
          Inherits System.Windows.Forms.Form
          Public WithEvents esignal As IESignal.Hooks

          Dim tsHandle As Integer


          #Region " Windows Form Designer generated code "

          Public Sub New()
          MyBase.New()

          'This call is required by the Windows Form Designer.
          InitializeComponent()

          'Add any initialization after the InitializeComponent() call

          End Sub

          'Form overrides dispose to clean up the component list.
          Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
          If disposing Then
          If Not (components Is Nothing) Then
          components.Dispose()
          End If
          End If
          MyBase.Dispose(disposing)
          End Sub

          'Required by the Windows Form Designer
          Private components As System.ComponentModel.IContainer

          'NOTE: The following procedure is required by the Windows Form Designer
          'It can be modified using the Windows Form Designer.
          'Do not modify it using the code editor.
          Friend WithEvents btnStartCollection As System.Windows.Forms.Button
          <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
          Me.btnStartCollection = New System.Windows.Forms.Button
          Me.SuspendLayout()
          '
          'btnStartCollection
          '
          Me.btnStartCollection.Location = New System.Drawing.Point(184, 64)
          Me.btnStartCollection.Name = "btnStartCollection"
          Me.btnStartCollection.Size = New System.Drawing.Size(112, 24)
          Me.btnStartCollection.TabIndex = 0
          Me.btnStartCollection.Text = "&Start Collection"
          '
          'Form1
          '
          Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
          Me.ClientSize = New System.Drawing.Size(504, 422)
          Me.Controls.Add(Me.btnStartCollection)
          Me.Name = "Form1"
          Me.Text = "Form1"
          Me.ResumeLayout(False)

          End Sub

          #End Region

          Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
          esignal = New IESignal.Hooks
          tsHandle = -1
          esignal.SetApplication("******USER NAME HERE*****")
          If esignal.IsEntitled = False Then
          MsgBox("Can not interface with ESignal: " & esignal.GetIsEntitledError)
          End If
          End Sub

          Private Sub btnStartCollection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnStartCollection.Click
          'this starts the collection
          Dim filter As IESignal.TimeSalesFilter
          If tsHandle <> -1 Then
          esignal.ReleaseTimeSales(tsHandle)
          End If
          filter = New IESignal.TimeSalesFilter
          filter.bFilterPrice = 0
          filter.bFilterQuoteExchanges = 0
          filter.bFilterTradeExchanges = 0
          filter.bFilterVolume = 0
          filter.bQuotes = 0
          filter.bTrades = 1
          filter.lNumDays = 1
          filter.sSymbol = "ES U4"

          tsHandle = esignal.RequestTimeSales(filter)
          If esignal.IsTimeSalesReady(tsHandle) Then
          ' Data already in cache, won't receive event until next "live" tick
          'do something here
          Else
          'indicate request has been sent
          End If
          End Sub

          Private Sub esignal_OnTimeSalesChanged(ByVal lHandle As Integer) Handles esignal.OnTimeSalesChanged
          'this successfully writes the handle to the console
          If lHandle = tsHandle Then
          Console.WriteLine(Now & "-OnTimeSalesChanged-" & lHandle)
          End If
          End Sub
          Private Sub Form1_Closing(ByVal sender As Object, ByVal e As System.ComponentModel.CancelEventArgs) Handles MyBase.Closing
          If tsHandle <> -1 Then
          esignal.ReleaseTimeSales(tsHandle)
          End If
          End Sub
          End Class
          http://forum.esignalcentral.com/showthread.php?s=&threadid=9155
          Attached Files

          Comment


          • #6
            a clue, a resolution, and a continued question

            If the "OnTimeSalesChanged" event has only

            If lHandle = tsHandle then
            Console.WriteLine(Now & "-otsc-" & lHandle
            End if

            or if there is nothing in the "OnTimeSalesChanged" event, exiting the App will crash Esignal everytime.

            Adding just

            Dim tick As IESignal.TimeSalesData
            tick = esignal.GetTimeSalesBar(lHandle, 0)

            to the "OnTimeSalesChanged" event will prevent the crash.

            This is true for George's app as will.

            I was just doing the console.writeline thing to make sure something was going on and was going to deal with what to do with the results next.

            We were planning on just passing the handle that had changed to another sub running in it's own thread. What do you think the addition of

            Dim tick As IESignal.TimeSalesData
            tick = esignal.GetTimeSalesBar(lHandle, 0)

            is doing and what really needs to be done in the "OnTimeSalesChanged" event to prevent the crash of ESignal on exit? Or can whatever the impact of that is happen in some other way?

            Comment


            • #7
              brief followup to last post

              Dim tick As IESignal.TimeSalesData
              tick = esignal.GetTimeSalesBar(lHandle, 0)

              in the "OnTimeSalesChanged" event is not quite enough. Seems one also has to do something with it, like even just

              Console.WriteLine(Str$(tick.dtTime.Year))

              and then no crashes on exit of app.

              Comment


              • #8
                update next day

                Well, so much for the seeming ability to replicate the crash consistently. Yesterday, we really could. Put in the code, take out the code: no crash, crash.

                Today, even with "the code" described in previous posts, everything was crashing esignal with the same error message as before when the vb.net app was exited. Even George's app posted in the thread http://forum.esignalcentral.com/show...&threadid=9155 was crashing esignal when the app was exited.

                Rebooted and tried George's app, exited and esignal still crashed.

                Gave up on it and went back to our app development on other fronts. Suddenly, nothing is crashing esignal on exit. Even no code in the "OnTimeAndSalesChanged" event. Been about 10 exits of different apps accessing the DesktopAPI and no esignal crash when the apps exit. Even tried some of the apps that were consistently crashing Esignal yesterday (which we saved in that state) and no crashes now.

                Sigh.

                Comment


                • #9
                  Re: update next day

                  Originally posted by cgaylord
                  Sigh.
                  Dontcha just love this job!

                  Comment


                  • #10
                    My hunch is these crashes aren't something specific to the nuances of 3rd party usage - something is going on internal to eSignal which corrupts it occasionally with it's ActiveX management.

                    The crashes I've seen are sometimes when exiting, but also when running normally.

                    Also have gotten a situation where it is still running but consuming all CPU cycles (well about 88%+) a few times.

                    I think whoever tracks it down is gonna need to have eSignal in the debugger when it's being beaten upon by 3rd party, although BoundsChecker might show up something useful.

                    -Jim

                    Comment


                    • #11
                      Crash

                      The crash reported by CGaylord has been identified and resolved. It will be available in the 7.7 Release Candidate scheduled for July 15th. Thanks for your sample code to help us resolve the problem.

                      Comment


                      • #12
                        Wonderful! Thanks for tracking it down. Sounded like a tough one to find, appreciate the effort. Should clear up my problems as well (exact same crash but not specific to shutdown.)


                        -Jim

                        Comment


                        • #13
                          technical explanation for the curious

                          For those interested, it was a race condition between the shutting down of the COM server object instance and and the firing of new time&sales events. That particular one has been fixed for both T&S and history, though of course it was unlikely to happen for history.

                          Thanks again for the report and code.
                          Simon Thornington
                          eSignal Developer

                          Comment

                          Working...
                          X