=== Applying patches on top of PostgreSQL commit ID b61a5c4bed7df87120df587731840e51ea7c7525 === /etc/rc.d/jail: WARNING: Per-jail configuration via jail_* variables is obsolete. Please consider migrating to /etc/jail.conf. Sat Aug 23 13:53:19 UTC 2025 On branch cf/5859 nothing to commit, working tree clean === using 'git am' to apply patch ./v4-0001-libpq-Don-t-hang-on-out-of-memory.patch === Applying: libpq: Don't hang on out-of-memory Using index info to reconstruct a base tree... M src/interfaces/libpq/fe-protocol3.c Falling back to patching base and 3-way merge... Auto-merging src/interfaces/libpq/fe-protocol3.c CONFLICT (content): Merge conflict in src/interfaces/libpq/fe-protocol3.c error: Failed to merge in the changes. hint: Use 'git am --show-current-patch=diff' to see the failed patch Patch failed at 0001 libpq: Don't hang on out-of-memory When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort". Unstaged changes after reset: M src/interfaces/libpq/fe-protocol3.c === using patch(1) to apply patch ./v4-0001-libpq-Don-t-hang-on-out-of-memory.patch === patching file src/interfaces/libpq/fe-protocol3.c Hunk #1 FAILED at 1550. Hunk #2 FAILED at 1588. 2 out of 2 hunks FAILED -- saving rejects to file src/interfaces/libpq/fe-protocol3.c.rej Removing src/interfaces/libpq/fe-protocol3.c.rej === using 'git apply' to apply patch ./v4-0001-libpq-Don-t-hang-on-out-of-memory.patch === Applied patch to 'src/interfaces/libpq/fe-protocol3.c' with conflicts. U src/interfaces/libpq/fe-protocol3.c diff --cc src/interfaces/libpq/fe-protocol3.c index 43ad672abce,5683229e32e..00000000000 --- a/src/interfaces/libpq/fe-protocol3.c +++ b/src/interfaces/libpq/fe-protocol3.c @@@ -1593,8 -1550,7 +1593,12 @@@ getBackendKeyData(PGconn *conn, int msg conn->be_cancel_key = malloc(cancel_key_len); if (conn->be_cancel_key == NULL) { ++<<<<<<< ours + libpq_append_conn_error(conn, "out of memory"); + handleFatalError(conn); ++======= + /* continue without cancel key */ ++>>>>>>> theirs return 0; } if (pqGetnchar(conn->be_cancel_key, cancel_key_len, conn)) @@@ -1631,21 -1587,10 +1635,25 @@@ getNotify(PGconn *conn return EOF; /* must save name while getting extra string */ svname = strdup(conn->workBuffer.data); ++<<<<<<< ours + if (!svname) + { + /* + * Notify messages can arrive at any state, so we cannot associate the + * error with any particular query. There's no way to return back an + * "async error", so the best we can do is drop the connection. That + * seems better than silently ignoring the notification. + */ + libpq_append_conn_error(conn, "out of memory"); + handleFatalError(conn); + return 0; + } ++======= ++>>>>>>> theirs if (pqGets(&conn->workBuffer, conn)) { - free(svname); + if (svname) + free(svname); return EOF; }