“损坏的双链表"是什么意思 [英] What does 'corrupted double-linked list' mean

查看:359
本文介绍了“损坏的双链表"是什么意思的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近从我的PHP中收到以下错误:

I've recently gotten the following error from my PHP:

WARNING: [pool www] child 42475 said into stderr: "*** glibc detected *** php-fpm: pool www: corrupted double-linked list: 0x00000000013fe680 ***"

我对这个问题不太感兴趣,对修复它也不太感兴趣. 但是我对理解此错误损坏的双链表"的实际含义非常感兴趣,因为我之前从未见过.我相信知道双向链接列表是什么,但是我未能生成触发此错误的程序.

I'm not very bothered by this issue, and not very interested in fixing it. But I'm very interested in understanding what this error 'corrupted double-linked list' actually means, because I haven't seen it before. I believe to know what a double-linked list is, but I failed to produce a program that triggers this error.

有人可以提供我一小段代码,让我编译和执行glibc时说损坏的双向链接列表"吗?

Could somebody provide me a short snippet of code that causes the glibc to say 'corrupted double-linked list' when I compile and execute it?

推荐答案

我自己已经找到问题的答案:)

I have found the answer to my question myself:)

所以我不了解glibc如何区分Segfault和损坏的双向链接列表,因为根据我的理解,从glibc的角度来看,它们应该看起来像是同一件事. 因为如果我在程序中实现了一个双向链接列表,那么glibc怎么可能知道这是一个双向链接列表,而不是其他任何结构?可能不会,所以这就是为什么我感到困惑的原因.

So what I didn't understand was how the glibc could differentiate between a Segfault and a corrupted double-linked list, because according to my understanding, from perspective of glibc they should look like the same thing. Because if I implement a double-linked list inside my program, how could the glibc possibly know that this is a double-linked list, instead of any other struct? It probably can't, so thats why i was confused.

现在,我已经在glibc的代码中查看了malloc/malloc.c,并且看到了以下内容:

Now I've looked at malloc/malloc.c inside the glibc's code, and I see the following:

1543 /* Take a chunk off a bin list */
1544 #define unlink(P, BK, FD) {                                            \
1545   FD = P->fd;                                                          \
1546   BK = P->bk;                                                          \
1547   if (__builtin_expect (FD->bk != P || BK->fd != P, 0))                \
1548     malloc_printerr (check_action, "corrupted double-linked list", P); \
1549   else {                                                               \
1550     FD->bk = BK;                                                       \
1551     BK->fd = FD;                                                       \

所以现在这突然变得有意义了. glibc之所以知道这是一个双向链接列表,是因为该列表是glibc本身的一部分.我一直很困惑,因为我认为glibc可以某种方式检测到某些程序正在构建一个双向链接列表,而我不明白它是如何工作的.但是,如果它正在谈论的这个双向链接列表是glibc本身的一部分,那么它当然可以知道它是双向链接列表.

So now this suddenly makes sense. The reason why glibc can know that this is a double-linked list is because the list is part of glibc itself. I've been confused because I thought glibc can somehow detect that some programming is building a double-linked list, which I wouldn't understand how that works. But if this double-linked list that it is talking about, is part of glibc itself, of course it can know it's a double-linked list.

我仍然不知道是什么触发了此错误.但是至少我了解损坏的双链表和Segfault之间的区别,以及glibc如何知道该结构应该是双链表:)

I still don't know what has triggered this error. But at least I understand the difference between corrupted double-linked list and a Segfault, and how the glibc can know this struct is supposed to be a double-linked list:)

这篇关于“损坏的双链表"是什么意思的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆