Announcement

Collapse
No announcement yet.

Partner 728x90

Collapse

Access Violation Exception

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

    Access Violation Exception

    I get this Exception fairly frequently in my rendering, but I have not been able to trace it back to a root-cause hence why I've not reported it yet.

    Does anyone else experience this? (see attachment)
    Attached Files

    #2
    Hi reach4thelasers,

    Thanks for your post.

    May I have you create a barebones sample that is able to reproduce the error and attach this to your next post?

    From the code this appears to be a drawing tool. Are you experiencing any errors using the drawing tools that are included with NT8?
    Chelsea B.NinjaTrader Customer Service

    Comment


      #3
      There was something very similar reported and fixed on an internal build using NTEIGHT-9004, however the scope was specific to a system Draw method. Not sure if your error is related, but if you can give us a reproducible scenario we can test to see if that fix mentioned above caught your case too
      MatthewNinjaTrader Product Management

      Comment


        #4
        Unfortunately I am not able to make a simple strategy that reproduces the bug. And it causes Ninjatrader to Fatally Crash. It happens often. I've written a few posts about the difficulty I have cleanly setting-up and tearing down strategy instances. I do not understand what is going on, I'm at a loss to explain it. I'm doing the most ridiculous paranoid **** making everything disposable and setting all object references to null in the Terminated state. But still I cannot get my strategies to die.

        Every time I start Ninjatrader afresh I get this printed in the output window from debug lines I am printing in my strategy constructor and state change method:

        Instance 63836698 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 45987144 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 46542816 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 40002167 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 65269000 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 781490 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 18073649 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 23870783 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 51778601 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 6723028 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 61721454 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 16752150 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 14045102 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 54521116 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 37221702 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 30633708 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 50739909 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 27723260 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 1936488 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 9750705 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 56193951 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 18234082 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 41357958 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 11723605 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 2804588 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 37264704 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 35320911 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 24774088 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 16021084 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 1467780 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 25770355 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 57505274 State transition to: SetDefaults
        ctor: New instance of strategy constructed
        Instance 35320911 State transition to: Configure
        And every time I run my strategy and close Ninjatrader a new one gets added to the list. Its like the old strategies are being saved to disk and are being brought back from the dead. They are not even listed in the strategy window any more - I removed them, but still they print out debug info when they are resurrected from the dead. I think there is some kind of object identity confusion, and my rendering classes which have a reference to the strategy instance that created them are trying to render to a resurrected strategy instance which no longer has permission to render and it goes BOOM!
        Last edited by reach4thelasers; 10-26-2015, 12:56 AM.

        Comment


          #5
          Further to my previous post. What is the Cache folder for? It contains a number of Reflection.dat files.

          Comment


            #6
            Originally posted by reach4thelasers View Post
            Whatever is going on it doesn't seem to be compatible with the kind of strategy I am making, I'm not sure what else I can do to get around this unless you have any ideas.
            Sounds like the database is corrupted to some level.

            Have you had these unable to insert indexes in the log tab?

            2015-10-24 20:20:22:466 ERROR: Error on committing DB changes: System.Data.SqlServerCe.SqlCeException (0x80004005): A duplicate value cannot be inserted into a unique index. [ Table name = Strategies,Constraint name = PK__Strategies__00000000000003AB ] at System.Data.SqlServerCe.SqlCeCommand.ProcessResult s(Int32 hr) at System.Data.SqlServerCe.SqlCeCommand.ExecuteComman dText(IntPtr& pCursor, Boolean& isBaseTableCursor) at System.Data.SqlServerCe.SqlCeCommand.ExecuteComman d(CommandBehavior behavior, String method, ResultSetOptions options) at System.Data.SqlServerCe.SqlCeCommand.ExecuteNonQue ry() at NinjaTrader.NinjaScript.StrategyBase.DbAdd() at NinjaTrader.Cbi.DB.DBThread()

            Comment


              #7
              No But I get this error in the Log tab when it goes boom...

              Time Category Message
              26/10/2015 04:25:32 Default A direct X error has occured while rendering the chart: HRESULT: [0x88990012], Module: [SharpDX.Direct2D1], ApiCode: [D2DERR_WRONG_FACTORY/WrongFactory], Message: Objects used together must be created from the same factory instance.

              Comment


                #8
                I managed to make a strategy that reproduces the AccessViolation issue.

                Load the strategy on a chart, when the random text starts rendering, if it doesn't crash by itself, wiggle the lower scroll bar or the mouse wheel a few times.

                I've reproduced this by looping many times over throwing loads of rendering calls at the chart. Obviously this is extreme use. However i am seeing the issue with reasonably normal rendering when I have my strategy loaded on many charts simultaneously - so it would appear that this issue arises when there is lots of rendering either spread across many charts/strategies or a huge amount on just one.

                and the wiggling of the scrollbar is a sure-fire way to get it to happen for me. I can have my strategy rendering statically on 5 or 6 charts. The minute I move the scrollbar it crashes. I think the scrollbar queues up a load of its own calls to render which compounds the problem.
                Attached Files

                Comment


                  #9
                  Hi reach4thelasers,

                  I tested your script. While the script definitely overloads my CPU, I am not able to reproduce the error.

                  I made a video of the test. Can you let me know if I am taking the proper steps to test this?

                  http://screencast.com/t/rmMOeilK0M
                  Chelsea B.NinjaTrader Customer Service

                  Comment


                    #10
                    Weird... might be worth trying it on a very-high resolution monitor and on windows 10. And I'm not sure why but it paints a lot more frequently for me. From your demo it was painting once every second or there abouts - mine is pretty much in realtime - I can't find the chart refresh setting just now but try changing that and see if you can make the issue manifest itself.

                    In the mean time I will have a think about it. This bug was a huge issue for me - but I've solved it by preventing any rending from happening until TickCount % 200 == 0 - ie. every 200 ticks.

                    Comment


                      #11
                      I see your using DrawText(). We made a lot of changes/fixes to this object in B6. I recommend making sure your on B6 and if you still run into an issue please let us know as if it was a new bug. Since the scope of changes to fix various use cases in DrawText would cause us to start over in B6 and could be why Chelsea doesn't run into issue if he had B6 installed.

                      Comment


                        #12
                        There's a Beta 6?!

                        Comment


                          #13

                          Comment

                          Latest Posts

                          Collapse

                          Topics Statistics Last Post
                          Started by elirion, Today, 01:36 AM
                          0 responses
                          3 views
                          0 likes
                          Last Post elirion
                          by elirion
                           
                          Started by gentlebenthebear, Today, 01:30 AM
                          0 responses
                          3 views
                          0 likes
                          Last Post gentlebenthebear  
                          Started by samish18, Yesterday, 08:31 AM
                          2 responses
                          9 views
                          0 likes
                          Last Post elirion
                          by elirion
                           
                          Started by Mestor, 03-10-2023, 01:50 AM
                          16 responses
                          389 views
                          0 likes
                          Last Post z.franck  
                          Started by rtwave, 04-12-2024, 09:30 AM
                          4 responses
                          34 views
                          0 likes
                          Last Post rtwave
                          by rtwave
                           
                          Working...
                          X