bgwriter leaks resources after errors
От | Tom Lane |
---|---|
Тема | bgwriter leaks resources after errors |
Дата | |
Msg-id | 12214.1134064235@sss.pgh.pa.us обсуждение исходный текст |
Список | pgsql-hackers |
I think that bug #2099 http://archives.postgresql.org/pgsql-bugs/2005-12/msg00075.php is probably explained by the observation that the bgwriter fails to call AtEOXact_Files() after an error; therefore, if it gets an error while holding an open DIR pointer, the DIR will never get closed. (There are calls to AllocateDir in the checkpoint code path, eg SimpleLruTruncate.) But while looking at this I realized we have worse problems: there's no mechanism for releasing buffer pins after an error in the bgwriter. So, for example, a write error on a dirty buffer will cause bgwriter to permanently leak a buffer pin. Even if the write problem is later rectified, the buffer will remain pinned indefinitely. Quite aside from the consequences of resource-leakage, this could make it impossible to complete subsequent VACUUMs on the affected relation. That raises it to a "must fix" in my mind. The bug exists in 8.0 and later. The cleanest solution seems to be to make the bgwriter create and use a ResourceOwner, and probably get rid of the special hack in resowner.c that allows CurrentResourceOwner to be NULL. regards, tom lane
В списке pgsql-hackers по дате отправления: