model-writtenrun 1120 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Dmitriy Kuzmin reported that exceeding temp_file_limit during backward cursor fetching caused a subsequent rollback to crash on PostgreSQL 14 and 15, supplying a reproducer and backtrace in #1.
- Tom Lane traced the crash to dumptuples() freeing tuples without recording progress before a possible write error, leaving a persistent Portal holdStore vulnerable to double-free during cleanup, and supplied the initial fix in #2.
- Tom explained in #3 that newer allocator headers masked the double-free by allowing freelist corruption, and supplied two detection alternatives: a debug-build requested_size check and a method-ID change that also worked in production builds.
- David Rowley supplied benchmarking tooling and measured roughly 6.5% overhead for the method-ID approach in #4; Tom confirmed measurable overhead on other machines, abandoned that approach, and extended the requested_size checks to realloc, generation, and slab allocation in #5.
- Tom's aligned-allocation experiment showed that freed header clobbering already detected misuse in typical debug builds in #6, and David agreed that obtaining the underlying context information would make separate aligned-allocation checks unattractive in #7.
- David reviewed and tested the expanded detection patch, identifying that GenerationFree would assert after its warning in #8; Tom proposed ERROR for all detected double-free cases in #9, and David agreed in #10.
- Tom retained WARNING for sentinel-byte corruption because small overwrites can affect only padding in #11, while David requested an explanation of the different severities in #12 and Tom accepted in #13.
- Tom committed the allocator work as a26ac902f6, using #5 with ERROR diagnostics and explanatory comments, then announced the push in #14; the change was backpatched through PostgreSQL 16.
- Returning to the original bug in #14, Tom supplied a revised tuplestore patch that also protected grow_memtuples() and tuplestore_trim() against inconsistent state after errors, while noting that older branches might require further inspection.
- The revised tuplestore patch from #14 subsequently landed unchanged apart from base differences as 7cd23aad2a and was backpatched through PostgreSQL 14; its commit message explains that the expensive reproducer was omitted because it did not fail on recent branches, leaving both fixes landed after the thread's final message.