Announcement

Collapse

Looking for a User App or Add-On built by the NinjaTrader community?

Visit NinjaTrader EcoSystem and our free User App Share!

Have a question for the NinjaScript developer community? Open a new thread in our NinjaScript File Sharing Discussion Forum!
See more
See less

Partner 728x90

Collapse

trying to read write protected memory

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

    trying to read write protected memory

    I am a NinjaTrader partner and selling products to customers.

    Can you tell me how that could happens :

    One of my customer is getting problem with following error message :
    Error on calling 'OnRender' method: Attempted to read or write protected memory. This is often an indicaton that other memory is corrupted.
    And obviously NinjaTrader crashes.

    The problem is that I am not getting these errors on my PC as well as other customers' PC using the same indicator ?

    How can it be possible. What should I do to keep him as a satisfied customer

    Thanks

    #2
    Hello blar58,

    Thank you for your post.

    I would recommend they get in contact with NinjaTrader Platform Support first if they have not already.
    I would also ask them if this only occurs when using your product.

    The message you detail could be caused by a number of items and is not necessarily related to your custom scripts/assemblies.

    Can you have the user contact us at platformsupport[at]ninjatrader[dot]com?

    I look forward to assisting you further.

    Comment


      #3
      Yes it comes from my indicator because because it is a message originating from my indicator code.

      Comment


        #4
        I will ask him to send you trace and log files too ?

        Comment


          #5
          Originally posted by blar58 View Post
          I will ask him to send you trace and log files too ?
          Yes, please do.

          Comment


            #6
            I asked him to send you the email with log and trace files.

            Could I stay in the loop please to know what's going on

            Thanks

            Comment


              #7
              Hello blar58,

              Thank you for your response.

              Please send me an email at platformsupport[at]ninjatrader[dot]com with 'ATTN: Patrick H' in the subject line and reference this thread as well as the user email so I can tie the two tickets together.

              I look forward to assisting you and the user further.

              Comment


                #8
                same issue

                I have the same problem & pointed to my indicator ....

                Comment


                  #9
                  I have the same issue and I am blindly looking for a fix.

                  The error message does not give an indicator name, nor a line number. The only thing of interest in the LOG or TRACE files is this:

                  PHP Code:
                  2018-06-12 09:03:27:352 ERRORIndicator ''Error on calling 'OnRender' method on bar 1507Attempted to read or write protected memoryThis is often an indication that other memory is corrupt
                  I've tried to make sure all Brushes that I use are "frozen" (brush.Freeze()) just in case that is causing the issue. Perhaps if I create a "stroke" that is using a brush, there could be an issue?

                  What other objects can cause this type of error? I'm assuming it has something to do with multi-threading and one thread is using an object that isn't defined for another thread?

                  Is there something that is not being correctly disposed that should? Perhaps something that should NOT be disposed that I am?

                  Perhaps an issue with a "foreach" loop where an object is being modified?

                  Just any help to help isolate this issue and what object types could even cause this issue. Or, a definitive way to determine which indicator is even causing the issue. I've been dealing with it for over a year!

                  Any help is greatly appreciated!
                  Last edited by neoikon; 06-12-2018, 08:28 AM.

                  Comment


                    #10
                    This can also happen if your DX brushes or strokes are null. If you are using R14 of NT then note that State.Configure is called AFTER the first OnRenderTargetChanged(). This means that if you are initializing and setting up your brushes in State.Configure and converting them in OnRenderTargetChanged(), your brushes/strokes will be null.

                    Comment


                      #11
                      Thank you so much for the reply. I will go through and double check that all RenderTarget, Brushes, ToDXBrush, etc have extra null checks throughout my code. I'm not explictly using OnRenderTargetChanged(), however.

                      I would expect an actual error about something being null, but I guess when you're talking about memory management and multi-threads, these things aren't consistant this way.

                      What is frustrating is that it is very random. I could go many days without an issue or it could happen multiple times in one morning. It's very hard to pinpoint and reproduce.

                      If you can think of any other objects to search for or check, please let me know! Thanks again!

                      Comment


                        #12
                        Hello neoikon,

                        Thank you for your post.

                        Please send me your log and trace files so I may look into this error furter.

                        You can do this by going to the Control Center-> Help-> Mail to Platform Support.

                        Ensuring 'Log and Trace Files' is checked will include these files. This is checked by default.

                        Please list 'ATTN: Patrick H' in the subject line and reference this thread in the body of the email.

                        I look forward to assisting you further.

                        Comment


                          #13
                          There seem to be 3 situations/errors that I've seen

                          PHP Code:
                          2018-06-12 09:03:27:352 ERRORIndicator ''Error on calling 'OnRender' method on bar 1507Attempted to read or write protected memoryThis is often an indication that other memory is corrupt
                          PHP Code:
                          2018-06-15 10:36:47:964 ERRORIndicator ''Error on calling 'OnRender' method on bar 1512External component has thrown an exception
                          Or there is no error at all and NinjaTrader just crashes. Hitting "debug" shows the error:

                          PHP Code:
                          Unhandled exception at 0x00007FF82724842B (ntdll.dllin NinjaTrader.exe0xC0000374A heap has been corrupted (parameters0x00007FF8272AC6E0). 
                          They all seem "corrupted memory" related.

                          NT Tech support suggested running "netsh winsock reset" from a command line, which didn't seem to do anything for my situation, but perhaps it can help others.

                          Any help in trying to isolate where this error could be coming from or any steps on how to debug/use an external debug tool, etc is greatly appreciated!

                          Thank you
                          Last edited by neoikon; 06-15-2018, 10:29 AM.

                          Comment


                            #14
                            Unfortunately these errors could originate from a number of places, some which you might not even think of as being problematic. I am sure you have done this, but just in case.... place Print statement throughout your code and isolate the line on which you crash. The other alternative that has worked effectively for me in these situations is to debug using VisualStudio (VS). When I ran my indicator code via VS, it rightaway pinpointed the problem line and the error - it was generally a Null Exception error and few times an Index out of Range error. Hope this helps.

                            Comment


                              #15
                              Originally posted by Zeos6 View Post
                              Unfortunately these errors could originate from a number of places, some which you might not even think of as being problematic. I am sure you have done this, but just in case.... place Print statement throughout your code and isolate the line on which you crash. The other alternative that has worked effectively for me in these situations is to debug using VisualStudio (VS). When I ran my indicator code via VS, it rightaway pinpointed the problem line and the error - it was generally a Null Exception error and few times an Index out of Range error. Hope this helps.

                              Thank you for the reply. I typically debug using many, many Print() statements. The problem is I'm not sure which of my few dozen indicators is causing the issue (since the error statement doesn't point to any one in particular.) I am suspecting one indicator in particular, but I can't be sure. Unfortunately, it's over 5000 lines long.

                              I've been grasping at straws at what it could be. I'm to the point of evaluating the usage of "string.empty" versus "String.empty" versus "" to see if that can be problematic with multithreading.

                              Is something like this problemmatic? (where you pass a new Stroke in-line)
                              PHP Code:
                              MyFunction(var1, new Stroke(myBrush)); 
                              I've started to go through and create variables first before passing the Stroke to the function, just in case that is a hidden threat.

                              I use VS for my development, but mainly as just an editor. I haven't had much success using it to debug, however. Are there any tutorials out there?

                              Thanks again!
                              Last edited by neoikon; 06-15-2018, 02:15 PM.

                              Comment

                              Latest Posts

                              Collapse

                              Topics Statistics Last Post
                              Started by Christopher_R, Today, 12:29 AM
                              0 responses
                              9 views
                              0 likes
                              Last Post Christopher_R  
                              Started by sidlercom80, 10-28-2023, 08:49 AM
                              166 responses
                              2,235 views
                              0 likes
                              Last Post sidlercom80  
                              Started by thread, Yesterday, 11:58 PM
                              0 responses
                              3 views
                              0 likes
                              Last Post thread
                              by thread
                               
                              Started by jclose, Yesterday, 09:37 PM
                              0 responses
                              8 views
                              0 likes
                              Last Post jclose
                              by jclose
                               
                              Started by WeyldFalcon, 08-07-2020, 06:13 AM
                              10 responses
                              1,415 views
                              0 likes
                              Last Post Traderontheroad  
                              Working...
                              X