Frequent restart of kernel in Spyder

subha
I am using websocket in my algo trades. But I encounter this error frequently and need to re-run my program everytime.
Not sure if I can raise this issue in this forum. If not can you please suggest any other technical forums.

Windows fatal exception: code 0xc0000374
Thread 0x00005568 (most recent call first):
File "C:\Users\Deepak\anaconda3\Lib\threading.py", line 320 in wait
File "C:\Users\Deepak\anaconda3\Lib\queue.py", line 171 in get
File "C:\Users\Deepak\anaconda3\Lib\site-packages\twisted\_threads\_threadworker.py", line 46 in work
File "C:\Users\Deepak\anaconda3\Lib\threading.py", line 975 in run
File "C:\Users\Deepak\anaconda3\Lib\threading.py", line 1038 in _bootstrap_inner
File "C:\Users\Deepak\anaconda3\Lib\threading.py", line 995 in _bootstrap



Thread 0x00003854 (most recent call first):
File "C:\Users\Subha\anaconda3\Lib\site-packages\mysql\connector\connection_cext.py", line 661 in cmd_query
File "C:\Users\Subha\anaconda3\Lib\site-packages\mysql\connector\opentelemetry\context_propagation.py", line 74 in wrapper
File "C:\Users\Subha\anaconda3\Lib\site-packages\mysql\connector\cursor_cext.py", line 374 in execute
  • rakeshr
    Windows fatal exception: code 0xc0000374
    You can try out these steps.
  • ANL
    0xc0000374 signifies a heap corruption error, indicating a problem with how memory is managed in the application.

    So, it may be caused by memory or thread mismanagement in your code.

    It seems you are using Spyder IDE from Anaconda Env on Windows. I would say it is not good for your development process. Windows is a very bad OS for development and the worst in the world. If your code is good and running on Windows, then it will squeeze all your program efficiency.

    What I would suggest:

    1. Uninstall Anaconda env from Windows and install the standalone Spyder IDE with the latest version of Python. (Python version and IDE version should match) and then update the kernel if it is an old version.

    2. Upgrade all libraries you are using currently, or you can purge and reinstall all with a newer version.

    3. Then check in the code to see if you mismanaged any threads or check for issues within Twisted, MySQL Connector, or your Python code that could be causing memory corruption.

    4. Check for any third party library conflicts or incompatibilities between libraries that might be contributing to the problem.

    5. If the above steps have not solved your issue, then cut the code that uses threads and parts that consume more memory, then run the code so you can diagnose the issue on the terminal.


    I would suggest staying away from Windows if you want to develop a system seriously. Windows will create overhead. Linux is the best choice for development, and it is the best OS in the world.
  • subha
    Rakesh, can you please suggest how to use the above steps.
    I am using web socket callback events which uses calculations in on_ticks method. As mentioned in one of your response I have moved the calculation part into a separate thread(deamon thread approach).

    Restarting of kernel has considerably reduced with that change, but now I am getting this error (Windows fatal exception: code 0xc0000374) & one with mysql database error(Unhandled error - command out of sync, Mysql connection not available)
Sign In or Register to comment.