Some NinjaTrader users experience the following error when trying to perform certain actions. These appear to happen most often when submitting live trades. The error messages states, "Unhandled exception: Write lock may not be acquired with read lock helped. This pattern is prone to deadlocks. Please ensure that read locks are released before taking a write lock. If an upgrade is necessary, use an upgrade lock in place of the read lock."
An image of the error is as follows:
One of the first things to try is using a different connection adapter. That is, the connection your computer makes from NinjaTrader to the broker. Contact your broker, and see if they have a different adapter available under the Control Panels / Connections menu. For example, choosing the new Ninjatrader adapter vs. the Ninjatrader Continuum connector may provide better results.
Also make sure that OneDrive isn't backing up your My Documents folder at the same time NinjaTrader is accessing its files in your My Documents folder. Also, make sure that OneDrive hasn't moved your My Documents files to the Microsoft cloud. Check for other knowledge-base articles for more information on that.
For those who continue to experience this error, NinjaTrader support has suggested that the cause may be a low-quality or unstable internet connection. The error could be caused by either the user's setup, by their ISP, or both. One thing that may be helpful as far as testing whether this may be an issue is to double-check that you're using a hardwire connection to your router, rather than using a wireless connection. If you're located a distance away from your router, you may be able to still use a very long ethernet cable to create a hardwire connection. Most ethernet cables have the same type of RJ45 connectors on each end, which look like a large telephone-type connector. Ethernet cables come in different grades, that have different abilities to provide faster data transfer speeds. Most of them can handle 100 feet or more lengths, and some can run much higher, up to 330 feet when using a high-quality cable. Cables are graded with a number, like CAT-5, CAT-6, up to CAT-8, with higher numbers providing faster data transmission speeds. Not sure what cable you now have? Many ethernet cables will have this grade printed on the cable. These cables can usually be plugged into one of a few ports on the back of the router, and on many computers, especially desktops. Laptops may not have a dedicated ethernet connector, so make sure your equipment has an ethernet port before ordering a cable. If your laptop or desktop doesn't have an ethernet connector, Ethernet-to-USB-C adapters can be found that are less than $25.
Ultimately, you want to ensure that you have a fast connection - the exact amount needed depends on how many charts you have and what you're trying to do. It may be more important that the responsiveness of your connection be good vs the download speed. That is, you want the round trip commands to happen sufficiently fast or they could get out of sync. Using a wired connection takes a lot of unknowns out of the equation to help assure the most responsive connection possible.
NinjaTrader support has provided the following suggestions if encountering this error:
- Shut down NinjaTrader and Restart your modem/router
- If you have an antivirus/firewall installed, you will want to add NinjaTrader to its exceptions list.
The following describe common reasons that contribute to connection stability
- ISP issues
- Hardware firewall changing IP addresses frequently
- Dynamic IP addresses changing frequently intraday. This usually happens once a week but you may want to check with your ISP. If they do change daily, requesting a static IP address may help.
- Broker/market data servers may be experiencing temporary downtime
- Connection Losses: Additional steps you may take to troubleshoot your connection losses:
- Ensure that your computer is not turning off your Network Adapter to conserve power:
-- Right-click on your Start button
-- Select 'Device Manager'
-- Expand 'Network Adapters
-- Right-click on your Network Adapter and select Properties > Power Management
-- Uncheck 'Allow the computer to turn off this device to save power'option
-- Click 'OK' to save the changes
-- Do this for all Network Adapters
- Clear your DNS
-- Open the Command Prompt. See http://www.howtogeek.com/235101/10-ways-to-open-the-command-prompt-in-windows-10/ for more info
-- In the command prompt, run this command: ipconfig /flushdns
- Turning off any VPN Network Software
- If you are not already using a wired connection, and the option is available to you, connect to the internet using an ethernet cable. Wireless connections are significantly more unreliable.
- Ensure exceptions have been added into any firewall/antivirus/backup programs for the Documents > "NinjaTrader 8" folder.
If the above steps do not help, contact your ISP and let them know you are experiencing a highly unstable connection. An issue of connectivity may exist on their end.