Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Chart Crashing Bug - Reproducible test case

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

    Chart Crashing Bug - Reproducible test case

    I've made a BollingerRainbowCrasher indicator and have repeatedly been able to reproduce the issue in under a minute using the following steps. I hope this works because I literally spent 9 hours on this.

    I've had two issues lately (possibly related). 1 is charts freezing, and 2 is "Ninjatrader has stopped working". This test case is able to reproduce the former.

    Steps to reproduce:

    - Open 3 charts with 2000 bars (enough to give the chart some work)
    - Link all 3 charts to the same Instrument Link colour at the top right
    - Add the BollingerRainbowCrasher indicator to all three charts.
    - Choose all test options on the indicator settings except "RandomlyThrowException"
    - Put Sunglasses on and press ok
    - Open the indicator settings on one chart and enable the "RandomlyThrowException" option. It will load partially rendered with a log to the output about the error.

    Normal use will cause the bug to manifest eventually but by stress-testing it can apppear within a minute. You need to seriously abuse the instrument selector to get the series-linked charts stuck in a deadlock.

    - Select an instrument on chart 1, and even before its done loading that, quickly flip it to another.
    - Then jump to the other two charts and flip each of them to different instruments before they have finished loading.
    - keep going round flipping instruments as fast as you can.

    Very quickly the Charts become Frozen and the CPU is zero. The chart threads are deadlocked - each one is waiting for the other to finish waiting.
    Attached Files
    Last edited by reach4thelasers; 05-05-2017, 10:26 AM.

    #2
    Hello reach4thelasers.

    Thank you for taking the time to create a test case that can be used to recreate charting issues.

    I have been able to reproduce the issues described and I have forwarded the test case to the development team for further analysis.

    I will update this post/thread with more information as it comes in.

    Thanks again for taking the time to help improve NinjaTrader.
    JimNinjaTrader Customer Service

    Comment


      #3
      Oh that's great Jim. I was worried after all that work you were going to tell me you couldn't reproduce it. I hope your engineers can fix it fast. I had three crashes in a row when I loaded Ninjatrader so I thought I would knuckle down and investigate as it seemed like we were getting nowhere closer to a fix.

      I expect the solution is to use a shared cancellation token between all linked charts, and before a new instrument change happens a cancellation request is issued for any in-progress requests.

      I noticed that Linked charts were really fast in this version despite not being robust; so it would be great to keep this performance but improve the concurrency control. I think cancelling prior requests rather than queuing them up is the best way to achieve that.

      Have a great weekend.

      Comment


        #4
        Here's a reproducible test case for the "Ninjatrader Has Stopped Working" issue. A market analyzer column with a simple unhandled exception is all it takes.

        Steps to reproduce:

        - Open a clean workspace
        - Create a new Market analyzer
        - Add a bunch of instruments
        - Add the attached "Bugs / BuggyMarketAnalyzer" Column to the market analyzer.

        Bedtime reading for your engineers:

        Sometimes, under not reproducible circumstances, my WPF application crashes without any message. The application simply close instantly. Where is the best place to implement the global Try/Catch b...
        Attached Files

        Comment


          #5
          Hello reach4thelasers,

          Thanks for the additional report!

          I have submitted another issue tick to be reviewed by the development team.

          As of now, these tickets are being tracked with following the ID's for further investigation.

          Charting Crash - TS-1068

          Market Analyzer Crash - TS-1070

          Please let me know if I may be of further assistance.
          JimNinjaTrader Customer Service

          Comment


            #6
            No worries, Glad I could help. I'm rolling back to 8.0.4.0 now.

            Comment


              #7
              Hey Jim... Here's another one for you.

              I think the latest crashing issue has been so problematic for me because one of my indicators was throwing an exception that I've never been able to trace. The deadlocked charts seems to coincide with an exception being thrown.

              Anyway I have now traced the issue with my indicator and in doing so found another bug. Its my BetterAutoScale indicator; its an improved version of Ninjatraders built-in auto-scale.

              When the indicator is loaded from a chart template. Ninjatrader supplies erroneous ChartBars.ToIndex and ChartBars.FromIndex values - they are equal to each other, which clearly is not valid. This causes an exception to be thrown in the OnCalculateMinMax Method.

              Steps to Reproduce:

              - Open a clean chart and add the BetterAutoscale indicator
              - The scale should shift to a better perspective
              - Right click the chart and save a new template with the indicator on
              - Right click and load the same template back onto the chart
              - Observe the better autoscale has stopped working and there is an error in the logs about OnCalculateMinMax - The calculation results in unrenderable values.
              - Right click and choose "Reload Ninjascript"
              - Observe that the indicator is working ok now

              It seem the problem is only when loading from a template.

              Now:
              - Uncomment the line //if (ChartBars.ToIndex == ChartBars.FromIndex) return; from the OnCalculateMinMax method and repeat the above steps. By including an edge-case to catch the erroneous Bar Indicies, the problem is resolved.

              There are many posts on this forum about the "OnCalculateMinMax - unrenderable values" issue. I suspect that they are all most likely caused by the same bug.
              Attached Files

              Comment


                #8
                Hello reach4thelasers,

                Sorry for the delayed response.

                I have reported this matter for further investigation.

                Currently the OnCalculateMinMax() issue is being tracked with ticket ID TS-1080. I will update this thread as more information becomes available for these issues.

                Thanks!
                JimNinjaTrader Customer Service

                Comment


                  #9
                  Originally posted by reach4thelasers View Post
                  When the indicator is loaded from a chart template. Ninjatrader supplies erroneous ChartBars.ToIndex and ChartBars.FromIndex values.
                  It seems the problem is only when loading from a template.
                  This reminds me of a situation I ran into when loading a chart template vs. opening a workspace. Apparently, when loading a template, ChartControl is null in OnRenderTargetChanged(). When opening a workspace or adding the indicator to a chart, ChartControl is not null. To work around this anomaly, I added fallback code:
                  Code:
                  _dxbrush_asktext    = ChartControl != null ? ChartControl.Properties.ChartText.ToDxBrush(RenderTarget)
                                          : Brushes.Gray.ToDxBrush(RenderTarget);

                  Comment


                    #10
                    Hello everyone,

                    I have some additional information regarding the issues reported in this thread.

                    Some OnRender() errors have been split into separate issues.
                    • Failed to call OnRender() for chart object 'Ray'. "External component has thrown an exception." Ticket ID: NTEIGHT-11613
                    • Error on calling 'OnRender' method: Attempted to read or write protected memory. Ticket ID: NTEIGHT-11661
                    • Kill Chart threads by dividing by 0 in OBU Ticket ID: NTEIGHT-11664
                    • Null reference causes Market Analyzer to crash Ticket ID: NTEIGHT-11676
                    • ChartBars.ToIndex == ChartBars.FromIndex in OnCalculateMinMax() Ticket ID: NTEIGHT-11675


                    These tickets may be described differently as they are reviewed and solutions are developed. You can note these ticket ID's in the Release Notes for the version of NinjaTrader 8 that includes the fixes and documented solutions for these items.

                    Release Notes - https://ninjatrader.com/support/help...ease_notes.htm

                    Your diligence in helping to improve NinjaTrader is highly appreciated by our staff. Thanks!
                    JimNinjaTrader Customer Service

                    Comment

                    Latest Posts

                    Collapse

                    Topics Statistics Last Post
                    Started by Irukandji, Today, 04:58 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post Irukandji  
                    Started by fitspressoburnfat, Today, 04:25 AM
                    0 responses
                    2 views
                    0 likes
                    Last Post fitspressoburnfat  
                    Started by Skifree, Today, 03:41 AM
                    1 response
                    4 views
                    0 likes
                    Last Post Skifree
                    by Skifree
                     
                    Started by usazencort, Today, 01:16 AM
                    0 responses
                    1 view
                    0 likes
                    Last Post usazencort  
                    Started by kaywai, 09-01-2023, 08:44 PM
                    5 responses
                    604 views
                    0 likes
                    Last Post NinjaTrader_Jason  
                    Working...
                    X