Author Topic: IOCP - 64-bit IPv6 Echo Server Stress Test  (Read 3770 times)

Raistlin

  • Member
  • ****
  • Posts: 501
Re: IOCP - 64-bit IPv6 Echo Server Stress Test
« Reply #15 on: February 22, 2018, 04:36:25 PM »
I thought I'd post this PM between myself and LiaoMi [The master of debugging if you ask me] - Hope he does'nt mind.... :shock:
LiaoMi 's sound advice and links saved me from hours of frustration. RE: multi-thread debugging
Perhaps we can prod him into creating a tutorial on debugging - ex. code tracing, watches, etc.

Quote
Hi Raistlin,

to debug synchronization processes, you need to study the synchronization method in detail, then choose the architecture for the implementation of the process, if possible make your debugging functions, the goal is to simplify and intercept the main methods of work during the synchronization. Because IOCP already has such a multithreading, then the message model should be simplified in order to achieve simple debugging of the basic ideas of IOCP, and only then create an algorithmic add-on, where you can often find errors.

This difficult task should be solved by the programmer =) To do this, you can make a mind map, with all the synchronization queues. I doubt that on this topic, there are specific articles and books, since synchronization errors include different areas of modeling and system work.

For simplicity, you can develop debugging logging functions .. so that debugging is written directly to the log file, this will help to find the error.

Link http://www.drdobbs.com/cpp/multithreaded-debugging-techniques/199200938?pgno=2 - Multithreaded Debugging Techniques - Extending your Application: Using Trace Buffers
Two categories of bugs are often found in multithreaded applications: synchronization bugs and performance bugs. Synchronization bugs include race conditions and deadlocks that cause unexpected and incorrect behavior. Performance bugs arise from unnecessary thread overhead due to thread creation or context switch overhead, and memory access patterns that are suboptimal for a given processor's memory hierarchy. The application returns the correct results, but often takes too long to be usable. This chapter focuses on debugging synchronization bugs that cause applications to fail.

In order to find the cause of these types of bugs, two pieces of information are needed:

Which threads are accessing the shared resource at the time of the failure.
When the access to the shared resource took place.
In many cases, finding and fixing synchronization bugs involves code inspection. A log or trace of the different threads in the application and the pattern in which they accessed the shared resources of the code helps narrow down the problematic code sections. One simple data structure that collects this information is the trace buffer.
Are you pondering what I'm pondering? It's time to take over the world ! - let's use ASSEMBLY...