Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDaby-0008EI-Rf for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Feb 2014 14:16:27 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1WDabx-00044c-4e for pgsql-bugs@arkaria.postgresql.org; Wed, 12 Feb 2014 14:16:25 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDabo-0003n9-3e for pgsql-bugs@postgresql.org; Wed, 12 Feb 2014 14:16:16 +0000 Received: from smtprelay0045.b.hostedemail.com ([64.98.42.45] helo=smtprelay.b.hostedemail.com) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1WDabh-0001w1-RJ for pgsql-bugs@postgresql.org; Wed, 12 Feb 2014 14:16:13 +0000 Received: from filter.hostedemail.com (b-bigip1 [10.5.19.254]) by smtprelay03.b.hostedemail.com (Postfix) with ESMTP id EAF151A73B5; Wed, 12 Feb 2014 14:16:07 +0000 (UTC) X-Session-Marker: 616C76686572726540616C76682E6E6F2D69702E6F7267 X-Spam-Summary: 50, 0, 0, , d41d8cd98f00b204, alvherre@alvh.no-ip.org, :::, RULES_HIT:41:355:379:599:800:967:968:973:982:988:989:1260:1277:1311:1312:1313:1314:1345:1359:1437:1515:1516:1518:1519:1534:1542:1593:1594:1595:1596:1711:1730:1747:1777:1792:2393:2525:2560:2563:2682:2685:2693:2828:2859:2895:2899:2901:2933:2937:2939:2942:2945:2947:2951:2954:3022:3138:3139:3140:3141:3142:3354:3865:3866:3867:3868:3870:3871:3874:3934:3936:3938:3941:3944:3947:3950:3953:3956:3959:4250:4321:4605:4659:5007:6119:6261:7903:8957:9025:9121:10004:10226:10400:10848:11232:11256:11257:11658:11876:11914:12050:12295:12438:12517:12519:12740:13095:13161:13221:13229:13891:13894:13895:21067, 0, RBL:none, CacheIP:none, Bayesian:0.5, 0.5, 0.5, Netcheck:none, DomainCache:0, MSF:not bulk, SPF:fn, MSBL:0, DNSBL:none, Custom_rules:0:0:0 X-HE-Tag: top85_528fc6e2c2031 X-Filterd-Recvd-Size: 3017 Received: from eldon.alvh.no-ip.org (pc-211-245-160-190.cm.vtr.net [190.160.245.211]) (Authenticated sender: alvherre@alvh.no-ip.org) by omf11.b.hostedemail.com (Postfix) with ESMTPA; Wed, 12 Feb 2014 14:16:07 +0000 (UTC) Received: by eldon.alvh.no-ip.org (Postfix, from userid 1000) id 5C85D1FC9; Wed, 12 Feb 2014 11:16:07 -0300 (CLST) Date: Wed, 12 Feb 2014 11:16:07 -0300 From: Alvaro Herrera To: dvitek@grammatech.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #9190: Could not fsync file "pg_clog/0000": Bad file descriptor. Message-ID: <20140212141607.GJ6342@eldon.alvh.no-ip.org> References: <20140211222906.2717.71884@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20140211222906.2717.71884@wrigleys.postgresql.org> User-Agent: Mutt/1.5.21 (2010-09-15) X-Pg-Spam-Score: -1.9 (-) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-bugs Precedence: bulk Sender: pgsql-bugs-owner@postgresql.org dvitek@grammatech.com wrote: > We had a postgres panic a few weeks ago. Here is a relevant fragment of the > postgres log: > > [2014-01-27 04:57:37 EST 3756] WARNING: pgstat wait timeout > ... > ... > ... > [2014-01-27 04:55:36 EST 5804] ERROR: could not access status of > transaction 0 > [2014-01-27 04:55:42 EST 5804] DETAIL: Could not fsync file "pg_clog/0000": > Bad file descriptor. I noticed that SimpleLruFlush calls SlruInternalWritePage() to write all pages, and stores the file descriptors in fdata, with the intention of fsyncing the files later; SlruInternalWritePage in turn calls SlruPhysicalWritePage. If the physical write fails, SlruInternalWritePage will dutifully close all the files, *but fdata is not updated to remove the file descriptors*. This might lead to the "bad file descriptor" error (but see below). Really, what we should be reporting is the failure to do the writes, I think. There is something broken about this system that makes the writes fail (something which can probably be learnt about in the kernel log, if there is such a thing on Windows), but this part seems our bug. The "status of transaction 0" part of the error message should surprise no one, since InvalidTransactionId is what SimpleLruFlush uses in its failure report. This does nothing to explain or help with the PANIC, however; nor why things seem to have continued running after a PANIC for two minutes. > [2014-01-27 09:21:04 EST 3080] PANIC: could not fsync file "pg_xlog/xlogtemp.3080": Bad file descriptor > [2014-01-27 09:23:01 EST 5404] LOG: WAL writer process (PID 3080) exited with exit code 3 > [2014-01-27 09:23:07 EST 5404] LOG: terminating any other active server processes There is no obvious path in which an fd is clobbered in xlog.c that I can see. If there is an explanation for this failure at the filesystem level, perhaps that can explain the above problem as well. -- Álvaro Herrera http://www.2ndQuadrant.com/ PostgreSQL Development, 24x7 Support, Training & Services -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs