v3-0001-oauth-Report-cleanup-errors-as-warnings-on-stderr.patch
application/x-patch
Filename: v3-0001-oauth-Report-cleanup-errors-as-warnings-on-stderr.patch
Type: application/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: format-patch
Series: patch v3-0001
Subject: oauth: Report cleanup errors as warnings on stderr
| File | + | − |
|---|---|---|
| src/interfaces/libpq-oauth/oauth-curl.c | 8 | 10 |
From 0bc540fbb7e46c7e2988aaec468e6682f3349644 Mon Sep 17 00:00:00 2001
From: Jacob Champion <jacob.champion@enterprisedb.com>
Date: Fri, 30 Jan 2026 16:41:26 -0800
Subject: [PATCH v3 1/6] oauth: Report cleanup errors as warnings on stderr
Using conn->errorMessage for these "shouldn't-happen" cases will only
work if the connection itself fails. Our SSL and password callbacks
print WARNINGs when they find themselves in similar situations, so
follow their lead.
---
src/interfaces/libpq-oauth/oauth-curl.c | 18 ++++++++----------
1 file changed, 8 insertions(+), 10 deletions(-)
diff --git a/src/interfaces/libpq-oauth/oauth-curl.c b/src/interfaces/libpq-oauth/oauth-curl.c
index 691e7ec1d9f..19024f6aaa7 100644
--- a/src/interfaces/libpq-oauth/oauth-curl.c
+++ b/src/interfaces/libpq-oauth/oauth-curl.c
@@ -293,10 +293,8 @@ free_async_ctx(PGconn *conn, struct async_ctx *actx)
* no bugs above. But if we do hit them, surfacing those errors somehow
* might be the only way to have a chance to debug them.
*
- * TODO: At some point it'd be nice to have a standard way to warn about
- * teardown failures. Appending to the connection's error message only
- * helps if the bug caused a connection failure; otherwise it'll be
- * buried...
+ * Print them as warnings to stderr, following the example of similar
+ * situations in fe-secure-openssl.c and fe-connect.c.
*/
if (actx->curlm && actx->curl)
@@ -304,9 +302,9 @@ free_async_ctx(PGconn *conn, struct async_ctx *actx)
CURLMcode err = curl_multi_remove_handle(actx->curlm, actx->curl);
if (err)
- libpq_append_conn_error(conn,
- "libcurl easy handle removal failed: %s",
- curl_multi_strerror(err));
+ fprintf(stderr,
+ libpq_gettext("WARNING: libcurl easy handle removal failed: %s\n"),
+ curl_multi_strerror(err));
}
if (actx->curl)
@@ -324,9 +322,9 @@ free_async_ctx(PGconn *conn, struct async_ctx *actx)
CURLMcode err = curl_multi_cleanup(actx->curlm);
if (err)
- libpq_append_conn_error(conn,
- "libcurl multi handle cleanup failed: %s",
- curl_multi_strerror(err));
+ fprintf(stderr,
+ libpq_gettext("WARNING: libcurl multi handle cleanup failed: %s\n"),
+ curl_multi_strerror(err));
}
free_provider(&actx->provider);
--
2.34.1