* Andres Freund (and...@2ndquadrant.com) wrote:
> It seems slightly cleaner to just move the pqsecure_destroy(); to the
> end of that function, based on a boolean. But if you think otherwise, I
> won't protest...

Hmm, agreed; I had originally been concerned that the SIGPIPE madness
needed to be around the pqsecure_destroy() call, but I can't see why
that would be.

I've run through a few times w/ the attached and haven't seen the
deadlock.  Will continue testing, of course.

Heikki, any thoughts regarding this change?  Any concerns about
back-patching it?

        Thanks,

                Stephen
diff --git a/src/interfaces/libpq/fe-secure.c b/src/interfaces/libpq/fe-secure.c
new file mode 100644
index 3bd0113..ca2c5e4 100644
*** a/src/interfaces/libpq/fe-secure.c
--- b/src/interfaces/libpq/fe-secure.c
*************** close_SSL(PGconn *conn)
*** 1545,1551 ****
  		SSL_shutdown(conn->ssl);
  		SSL_free(conn->ssl);
  		conn->ssl = NULL;
- 		pqsecure_destroy();
  		/* We have to assume we got EPIPE */
  		REMEMBER_EPIPE(spinfo, true);
  		RESTORE_SIGPIPE(conn, spinfo);
--- 1545,1550 ----
*************** close_SSL(PGconn *conn)
*** 1565,1570 ****
--- 1564,1572 ----
  		conn->engine = NULL;
  	}
  #endif
+ 
+ 	if (conn->ssl)
+ 		pqsecure_destroy();
  }
  
  /*

Attachment: signature.asc
Description: Digital signature

Reply via email to