Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit91c4054

Browse files
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.de
1 parent7e2ffb3 commit91c4054

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

‎src/backend/access/transam/xlogreader.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,9 @@ XLogReaderFree(XLogReaderState *state)
136136
{
137137
intblock_id;
138138

139+
if (state->seg.ws_file!=-1)
140+
close(state->seg.ws_file);
141+
139142
for (block_id=0;block_id <=XLR_MAX_BLOCK_ID;block_id++)
140143
{
141144
if (state->blocks[block_id].data)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp