How to detect and debug multi-threading problems?

前端 未结 17 1904
陌清茗
陌清茗 2020-11-29 16:12

This is a follow up to this question, where I didn\'t get any input on this point. Here is the brief question:

Is it possible to detect and debug problems co

17条回答
  •  情书的邮戳
    2020-11-29 16:47

    Narrow down on the functions that are being called, and rule out what could and could not be to blame. When you find sections of code that you suspect may be causing the issue, add lots of detailed logging / tracing to it. Once the issue occurs again, inspect the logs to see how the code executed differently than it does in "baseline" situations.

    If you are using Visual Studio, you can also set breakpoints and use the Parallel Stacks window. Parallel Stacks is a huge help when debugging concurrent code, and will give you the ability to switch between threads to debug them independently. More info-

    https://docs.microsoft.com/en-us/visualstudio/debugger/using-the-parallel-stacks-window?view=vs-2019

    https://docs.microsoft.com/en-us/visualstudio/debugger/walkthrough-debugging-a-parallel-application?view=vs-2019

提交回复
热议问题