I have rebased the patch and tried to run pgbench.
I see memory corruptions, attaching the valgrind report for the same.
First interesting callstack in valgrind report is as below.
==77922== For counts of detected and suppressed errors, rerun with: -v
==77922== Use --track-origins=yes to see where uninitialised values come from
==77922== ERROR SUMMARY: 15 errors from 7 contexts (suppressed: 2 from 2)
==77873== Source and destination overlap in memcpy(0x5c08020, 0x5c08020, 4)
==77873== at 0x4C2E1DC: memcpy@@GLIBC_2.14 (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==77873== by 0x773303: GetSnapshotData (procarray.c:1698)
==77873== by 0x90FDB8: GetTransactionSnapshot (snapmgr.c:248)
==77873== by 0x79A22F: PortalStart (pquery.c:506)
==77873== by 0x795F67: exec_bind_message (postgres.c:1798)
==77873== by 0x798DDC: PostgresMain (postgres.c:4078)
==77873== by 0x724B27: BackendRun (postmaster.c:4237)
==77873== by 0x7242BB: BackendStartup (postmaster.c:3913)
==77873== by 0x720CF9: ServerLoop (postmaster.c:1684)
==77873== by 0x720380: PostmasterMain (postmaster.c:1292)
==77873== by 0x67CC9D: main (main.c:223)
==77873==
==77873== Source and destination overlap in memcpy(0x5c08020, 0x5c08020, 4)
==77873== at 0x4C2E1DC: memcpy@@GLIBC_2.14 (in /usr/lib64/valgrind/vgpreload_memcheck-amd64-linux.so)
==77873== by 0x77304A: GetSnapshotData (procarray.c:1579)
==77873== by 0x90FD75: GetTransactionSnapshot (snapmgr.c:233)
==77873== by 0x795A2F: exec_bind_message (postgres.c:1613)
==77873== by 0x798DDC: PostgresMain (postgres.c:4078)
==77873== by 0x724B27: BackendRun (postmaster.c:4237)
==77873== by 0x7242BB: BackendStartup (postmaster.c:3913)
==77873== by 0x720CF9: ServerLoop (postmaster.c:1684)
==77873== by 0x720380: PostmasterMain (postmaster.c:1292)
==77873== by 0x67CC9D: main (main.c:223)