possible connection leak in dblink?
| От | Peter Eisentraut |
|---|---|
| Тема | possible connection leak in dblink? |
| Дата | |
| Msg-id | 1308083649.29840.5.camel@vanquo.pezone.net обсуждение исходный текст |
| Ответы |
Re: possible connection leak in dblink?
|
| Список | pgsql-hackers |
With gcc 4.6, I get this warning: dblink.c: In function ‘dblink_send_query’: dblink.c:620:7: warning: variable ‘freeconn’ set but not used [-Wunused-but-set-variable] I don't know much about the internals of dblink, but judging from the surrounding code, I guess that this fix is necessary: diff --git i/contrib/dblink/dblink.c w/contrib/dblink/dblink.c index 19b98fb..e014c1a 100644 --- i/contrib/dblink/dblink.c +++ w/contrib/dblink/dblink.c @@ -634,6 +634,10 @@ dblink_send_query(PG_FUNCTION_ARGS) if (retval != 1) elog(NOTICE, "%s", PQerrorMessage(conn)); + /* if needed, close the connection to the database and cleanup */ + if (freeconn) + PQfinish(conn); + PG_RETURN_INT32(retval);} Otherwise the connection might not get freed. Could someone verify that?
В списке pgsql-hackers по дате отправления: