dlist_check: add check for nodes pointing to themselves

杨磊 <yanglei@halodbtech.com>

From: 杨磊 <yanglei@halodbtech.com>
To: pgsql-hackers <pgsql-hackers@lists.postgresql.org>
Date: 2026-03-17T12:56:15Z
Lists: pgsql-hackers

Attachments

Hi hackers,

I accidentally called the function dlist_push_head consecutively on the same node, 
inserting it into a doubly linked list, which caused an infinite loop. 
After adding the compile parameter -DILIST_DEBUG, an infinite loop occurred in the dlist_check function, 
revealing that the next pointer of the current node was pointing to itself. 
I am attempting to fix this issue with the following patch.

regards,
Lei Yang