Corrupted Double-Linked List: 0xB4A12BB8 problem solved

tags: Those pits developed by Linux  C language

Program main function

The main function of the process is to regularly train information about the subordinate devices added to the device. Suddenly found in some cases, the lower-level device information that will occur in some cases has been incorrect. However, this issue occasionally occasionally occasionally Plus your own blind self-confidence has always thought that there is no problem, I have not paying attention to this problem. Today, the stable recovery condition of this problem is found, and the process of resolving this bug in detail.

Process process

After the BUG recovery, use Strace to track the discovery that will always have problems when the Web gets the following device information is incorrect:


That is, the Web caused by the deadlock problem, which has not been able to get the correct device information when getting a lower device.
After final positioning, this problem is found to be due to the previously created a global array crosstree caused by the number of times of failure to obtain subordinate device information. The rough code is as follows:

int g_supportChNum=32;
int g_chNum=64;
char *g_subDevInfoGetFailTime=NULL;
g_subDevInfoGetFailTime = (char *)malloc(sizeof(g_subDevInfoGetFailTime) *g_supportChNum);
.....
int i=0;
for(i=0;i<g_chNum;i++){
	if(0 != com_getSubDevInfo(i))
		 g_subdevinfogetfailtime [i] = 1; // i = 62 get failed
}

Since the previous mistakes assigned to an array of length 32. However, this device is a device that supports 64 channels. There is a channel where the subordinate device gets failed is at 61 channels.
This has an obvious g_subdevinfogetfailtime that only assigns 32-byte space. In the event of acquiring failure, the 62th byte is operational G_SUBDEVINFOGETFAILTIME [61], which leads to the problem of memory and offshore. In turn, thread death Lock.

Intelligent Recommendation

Double pointer to solve the problem of linked list

1. Find the midpoint of the linked list Use fast and slow pointers to find in one traversal: slow pointers go one step at a time, fast pointers go two steps at a time, and fast and slow pointers start...

Double pointer solves the common problem of linked list

Double pointer solves the common problem of linked list Get countdown king elements Get an element in an intermediate position Decades if the linked list has a ring, and the length of the ring is dete...

List (Double Linked List)

List (Double Linked List) List (Double Linked List) is a linear linked list structure whose data consists of several nodes, each of which includes a fast information (that is, actually stored data), a...

[Data Structure]-Linked List Problem Solved by Fast and Slow Pointers

Speaking of the singly linked list in the data structure, we can think of a lot of questions about this structure. This article mainly summarizes several problems about solving with the same method-fa...

More Recommendation

Joseph's problem is solved with a circular single -linked list with no head nodes

Problem Description: There are n individuals sitting around a round table, and now the number of people from S, the number of people who count it to M, and then start the number of people from the nex...

Linked list-double linked list

Article Directory Overview Specific code implementation Overview If you understand the basic operations of singly-linked lists, I believe there is no problem with double-linked lists. The only differe...

Double-linked list of linked list

Unlike single-link tables, the double-linked list is more than a variable that points to the previous address domain. Therefore, you can sequentially traverse the linked list, or you can reverse it. A...

Python double pointer problem - array merging, binary search, single linked list and double linked list implementation examples

''' double pointer problem The biggest advantage of pointers is that they can effectively use fragmented memory space. This section focuses on three issues: 1) Array merge: merge two ordered arrays 2)...

Double-linked list, circular double-linked list

Noob, I hope to communicate with you and learn together...

Copyright  DMCA © 2018-2026 - All Rights Reserved - www.programmersought.com  User Notice

Top