Re: BUG #17254: Crash with 0xC0000409 in pg_stat_statements when pg_stat_tmp\pgss_query_texts.stat exceeded 2GB. - Mailing list pgsql-bugs

From Juan José Santamaría Flecha
Subject Re: BUG #17254: Crash with 0xC0000409 in pg_stat_statements when pg_stat_tmp\pgss_query_texts.stat exceeded 2GB.
Date
Msg-id CAC+AXB21yF41p4fWgUOkG1PBA-Ezw-8U0Q=Bint9OQ56qyMPYw@mail.gmail.com
Whole thread Raw
In response to BUG #17254: Crash with 0xC0000409 in pg_stat_statements when pg_stat_tmp\pgss_query_texts.stat exceeded 2GB.  (PG Bug reporting form <noreply@postgresql.org>)
Responses Re: BUG #17254: Crash with 0xC0000409 in pg_stat_statements when pg_stat_tmp\pgss_query_texts.stat exceeded 2GB.
List pgsql-bugs
Thanks for the report. 

On Fri, Oct 29, 2021 at 12:52 PM PG Bug reporting form <noreply@postgresql.org> wrote:

The MSDN documentation says that the upper limit of the _read() argument is
INT_MAX (about 2GB), but the size gotten by fstat() exceeds this limit, so I
think we encountered server crash by an exception error.

https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/read?view=msvc-160
> If buffer is NULL, or if buffer_size > INT_MAX, the invalid parameter
handler is invoked.

Until PostgreSQL 13, fstat() failed and returned ERROR when a file was
larger than 2GB, but as a result of improvements to fstat() in PostgreSQL
14, it appears that _read() has exceeded its limit and now causes a crash.

The value of MaxAllocHugeSize is being oversized when _WIN64 is defined [1]. Shouldn't the limit for a slurp be MaxAllocSize?


Regards,

Juan José Santamaría Flecha

pgsql-bugs by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: BUG #17245: Index corruption involving deduplicated entries
Next
From: Kamigishi Rei
Date:
Subject: Re: BUG #17245: Index corruption involving deduplicated entries