model-writtenrun 6163 - may be wrong, links go to the source messages. Commit-by-commit LLM analysis is in the Commits dialog.
- Ryan reported that ECPGconnect() could return after connection-parameter allocation failed without releasing connections_mutex, potentially causing deadlock #1.
- Michael Paquier confirmed that the allocation-failure path was incorrect despite being unlikely and promised a fix #2.
- Michael Paquier found that merely unlocking the mutex would leave a freed connection object in the connection list, so his patch moved parameter counting and allocation before mutex acquisition and list manipulation, avoiding additional cleanup #3.
- Michael Paquier recommended backpatching because memory pressure could corrupt application connection state, accepting the loss of a connection-opening log entry on allocation failure #3.
- The patch landed unchanged as fa703b317e, and Michael Paquier closed the thread by confirming backpatches through PostgreSQL 9.6 and thanking Ryan #4.