Hi Mihail, On Mon, Aug 3, 2026 at 8:25 PM Mihail Nikalayeu <[email protected]> wrote: > > Hello, everyone! > > While prototyping with a stress suite, I found memory corruption (and > possibly data corruption) issues related to those changes. > > Issues is related to how the newer bfa3c4f106 affects the old 293e24e507. > > The 293e24e507 caches the metapage as a pointer, but > read_stream_begin_relation may cause that pointer to become freed > because of: > > hashbulkdelete() hash.c:543 > read_stream_begin_relation(READ_STREAM_MAINTENANCE, ...) > read_stream_begin_impl() > read_stream.c:806 > get_tablespace_maintenance_io_concurrency(tablespace_id) > get_tablespace() spccache.c > SearchSysCache1(TABLESPACEOID, ...) ← cold cache → catalog scan > table_open(pg_tablespace) > LockRelationOid(1213) lmgr.c:136 > AcceptInvalidationMessages() ← the flush point > > causing something like: > > ERROR: could not open file "base/5/16388.1" (target block 2139062145): > previous segment is only 66 blocks > CONTEXT: while scanning relation "public.t"
Thanks for reporting this! Sol shares the same opinion here. However the reproducer recipe it cooked is unsatisfactory to me. So it needs more work to be shareable. > The simplest fix is to reorder a few lines of code - attached (with a > test generated by Claude based on my instructions). The same agent reports the fix works. Intuitively + 1 from me. > But probably we should think broader to avoid such issues in the future. The poor agent did a broader audit for all current callers of read streaming and console me they are fine by not getting bitten by the bug. However, its homework still needs to be checked. -- Regards, Xuneng Zhou HighGo Software Co., Ltd.
