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

Ninja not shutting down correctly -- a background task remains

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

    Ninja not shutting down correctly -- a background task remains

    I have a lot of custom code, mostly indicators, but a couple of AddOns that provide an architectural base.

    (like loading internal configuration / arrays from an external database, etc)

    Ninja shuts down normally, that is all the workspaces are saved, the connection disconnected, et cetera.

    But a Ninjatrader background task does not terminate and I need to terminate it manually with Windows Task Manager.

    Is there any advice on how I can debug this?

    Thanks

    #2
    Hello, thanks for writing in. The cause of this could be many things, it may be un-released resources such as not unsubscribing from an event method in the terminated state. It would take a trial and error approach to find the cause of this by excluding one addon/indicator at a time and seeing if the problem goes away. Start with your addons as it may be the most likely cause.
    Chris L.NinjaTrader Customer Service

    Comment


      #3
      Ok, thanks, will try that

      Comment


        #4
        No luck yet....what about using Visual Studio....do you think that would indicate what resources might not be released?

        Comment


          #5
          Hi, I have never used visual studio to do this, I could not say if its possible to detect using Visual Studio.
          Chris L.NinjaTrader Customer Service

          Comment


            #6
            I would suggest to look closely at that AddOn code, and especially if you are starting any threads or timers, look at how they shut down and make sure they are able to shut down properly. You might have to add some logging in order to understand the sequence of events when it's attempting to dispose them.
            Bruce DeVault
            QuantKey Trading Vendor Services
            NinjaTrader Ecosystem Vendor - QuantKey

            Comment


              #7
              yes, I'm starting both a thread and a timer...will check there first...thx

              Comment


                #8
                I'm having the same issue. I didn't have this issue prior to the forced upgrade to 8.0.28 for CQG users. I never had this issue on 8.0.26 (which is what I upgraded from because 8.0.27 gave me nothing but issues as well).

                And because 8.0.28 keeps freezing and deadlocking, I have to exit the program, go into task manager to end task, then reopen the program. I have to do this 4-6x each 1.5 hour trading session. As a scalper, this is a detriment to my trading style and strategy. I miss trades so much because of this.

                Comment


                  #9
                  Hi trader123456789, If you are running any third-party addons, you will need to reduce these one at a time to see which one may be causing this issue. Start by opening up a new workspace and closing the old one, and do not run any of your third-party addons. If it still happens after this, you will need to remove your addons one at a time until this does not happen.
                  Chris L.NinjaTrader Customer Service

                  Comment


                    #10
                    well, I scanned my code for all Timer and Threads and made sure they shut down correctly....but Ninja still hangs and shows as an inactive task in Task Manager....

                    if I try to shut it down with a batch file, it says it cannot find the task, but it is in task manager...

                    taskkill /IM Ninjatrader.exe /F


                    this does not happen in Windows 8.1, it has the same exact code....only happens on my trader computer...which is Windows 10...

                    ???

                    Comment


                      #11
                      Hi, Windows 8 in not supported by Microsoft or NinjaTrader anymore. If you would like to try a new environment, this would likely resolve the issue but you would need to reinstall all of your scripts:

                      Close all running applications.

                      Navigate to your Documents folder > Right-click on the 'NinjaTrader 8' folder > Rename > rename the folder to 'NinjaTrader 8 OLD'. DO NOT delete this folder.

                      Once completed, download and run the latest NinjaTrader installer from your account page:



                      This will generate a brand new "NinjaTrader 8" folder in the Documents. This is where all your user data is stored, just uninstalling from the Control Panel will not modify this folder. To revert back to your old installation, rename "NinjaTrader 8" to "NinjaTrader 8PREV" and rename "NinjaTrader 8OLD" back to "NinjaTrader 8" NinjaTrader looks for a folder called "NinjaTrader 8" in the documents to operate.
                      Chris L.NinjaTrader Customer Service

                      Comment


                        #12
                        well,l the problem is in Windows 10...

                        Windows 8.1 works OK...

                        will try a re-install of NT

                        but I already have the latest Ninja 8.1 version

                        Comment


                          #13
                          well, nothing worked

                          EXCEPT I moved my trading to a NEW Windows 10 computer...and this problem no longer exists there....

                          evidently no problem with the code, some config issue in the old Windows 10 machine it seems

                          Comment


                            #14
                            Hello llanqui,

                            Based on the last few posts it sounds like some common item you are using is causing a file to be locked when the platform is exiting. That can include third party items or software that you use on your PC which accesses the documents directory. If you see the problem come up again please do the following steps so we can eliminate items you have imported.
                            1. Exit NinjaTrader and kill the task using Task manager
                            2. Navigate to your Documents folder > Right-click on the 'NinjaTrader 8' folder > Rename > rename the folder to 'NinjaTrader 8 OLD'. DO NOT delete this folder.​
                            3. Download and run the latest NinjaTrader installer from your account page:

                            This will generate a brand new "NinjaTrader 8" folder in the Documents.

                            At this point test the clean install multiple times using the same steps that you previously did and make sure the task is closed when you close the platform.
                            • If the task is exited that points to a problem in your user folder and some item that is not shutting down correctly, that would include third party indicators addons or items you may have created.
                            • If the task still does not exit that points to something on your PC using the files. If you have sync software or any type of scanning software running on the documents directory that may be the reason, you need to exclude the documents directory from any kind of sync/scanning software or not have that software running while NinjaTrader is open.

                            Once you have tested this a few times and confirm if something in the user folder was at fault or something on the PC you can revert back to your existing data using the following steps:
                            1. Exit NinjaTrader and kill the task using Task manager
                            2. rename "NinjaTrader 8" to "NinjaTrader 8 clean
                            3. rename "NinjaTrader 8 OLD" back to "NinjaTrader 8"

                            NinjaTrader looks for a folder called "NinjaTrader 8" in the documents to operate.
                            JesseNinjaTrader Customer Service

                            Comment

                            Latest Posts

                            Collapse

                            Topics Statistics Last Post
                            Started by 00nevest, 04-27-2024, 02:27 PM
                            3 responses
                            27 views
                            0 likes
                            Last Post 00nevest  
                            Started by Newtrader101, Today, 07:36 AM
                            0 responses
                            1 view
                            0 likes
                            Last Post Newtrader101  
                            Started by 21laienoch, Today, 07:25 AM
                            0 responses
                            6 views
                            0 likes
                            Last Post 21laienoch  
                            Started by burtoninlondon, 04-28-2024, 12:38 AM
                            1 response
                            16 views
                            0 likes
                            Last Post burtoninlondon  
                            Started by MacDad, 02-25-2024, 11:48 PM
                            8 responses
                            175 views
                            0 likes
                            Last Post NinjaTrader_Erick  
                            Working...
                            X