Re: Crash in virtual file descriptor FDDEBUG code

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Greg Nancarrow <gregn4422(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Crash in virtual file descriptor FDDEBUG code
Date: 2020-11-17 00:47:03
Message-ID: 866303.1605574023@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Greg Nancarrow <gregn4422(at)gmail(dot)com> writes:
> While investigating a possible file-descriptor issue, I enabled the
> FDDEBUG code in src/backend/storage/file/fd.c, only to find that it
> resulted in a crash as soon as it was invoked.

Yeah, I can imagine that code doesn't get tested often.

> I've attached a small patch that corrects the issue.

Thanks, will push.

BTW, while looking at this I started to cast an unfriendly eye on the
_dump_lru() debug function that's hidden under that symbol. That seems
like it's spending a lot of cycles to give you information that will
very possibly be incomplete (since its 2K buffer would fill up fast).
And it could very easily turn into an infinite loop if there were
anything actually wrong with the LRU chain. So I'm not seeing where
the cost-benefit ratio is there.

Maybe we should change it to just print the first and last entries
and the number of entries --- which it could count using a loop that
knows there shouldn't be more entries than the size of the VFD
array, so as to prevent infinite-looping if the chain is corrupt.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message k.jamison@fujitsu.com 2020-11-17 00:52:46 RE: Cache relation sizes?
Previous Message tsunakawa.takay@fujitsu.com 2020-11-17 00:39:35 RE: Cache relation sizes?