forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit91c4054
committed
Fix XLogReader FD leak that makes backends unusable after 2PC usage.
Before the fix every 2PC commit/abort leaked a file descriptor. As thefiles are opened using BasicOpenFile(), that quickly leads to thebackend running out of file descriptors.Once enough 2PC abort/commit have caused enough FDs to leak, any IOin the backend will fail with "Too many open files", asBasicOpenFilePerm() will have triggered all open files known to fd.cto be closed.The leak causing the problem at hand is a consequence of0dc8ead,but is only exascerbated by it. Previously most XLogPageReadCBcallbacks used static variables to cache one open file, but after thecommit the cache is private to each XLogReader instance. There neverwas infrastructure to close FDs at the time of XLogReaderFree, but theway XLogReader was used limited the leak to one FD.This commit just closes the during XLogReaderFree() if the FD isstored in XLogReaderState.seg.ws_segno. This may not be the way tosolve this medium/long term, but at least unbreaks 2PC.Discussion:https://postgr.es/m/20200406025651.fpzdb5yyb7qyhqko@alap3.anarazel.de1 parent7e2ffb3 commit91c4054
1 file changed
+3
-0
lines changedLines changed: 3 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
136 | 136 |
| |
137 | 137 |
| |
138 | 138 |
| |
| 139 | + | |
| 140 | + | |
| 141 | + | |
139 | 142 |
| |
140 | 143 |
| |
141 | 144 |
| |
|
0 commit comments
Comments
(0)