Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1YswvL-0008QK-0u for pgsql-bugs@arkaria.postgresql.org; Thu, 14 May 2015 17:27:55 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1YswvK-0004sb-HZ for pgsql-bugs@arkaria.postgresql.org; Thu, 14 May 2015 17:27:54 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1YswvJ-0004sU-GE for pgsql-bugs@postgresql.org; Thu, 14 May 2015 17:27:53 +0000 Received: from mail.anarazel.de ([217.115.131.40]) by makus.postgresql.org with esmtp (Exim 4.84) (envelope-from ) id 1YswvG-0003Qc-GJ for pgsql-bugs@postgresql.org; Thu, 14 May 2015 17:27:52 +0000 Received: from intern.anarazel.de (unknown [184.23.178.130]) (Authenticated sender: andres@anarazel.de) by mail.anarazel.de (Postfix) with ESMTPSA id D93A4860001; Thu, 14 May 2015 19:27:48 +0200 (CEST) Date: Thu, 14 May 2015 19:27:46 +0200 From: Andres Freund To: Hillel.Eilat@attunity.com Cc: pgsql-bugs@postgresql.org Subject: Re: BUG #13287: Database corruption - PANIC: could not fsync file "pg_replslot/[Slot]/state": Bad file descriptor Message-ID: <20150514172746.GJ9584@alap3.anarazel.de> References: <20150514105514.2691.67352@wrigleys.postgresql.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150514105514.2691.67352@wrigleys.postgresql.org> X-Pg-Spam-Score: -4.2 (----) 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 Hi, On 2015-05-14 10:55:14 +0000, Hillel.Eilat@attunity.com wrote: > I am in a process of developing an REPLICATION application using PostgreSQL > 9.4.1 on a "Windows 7" platform. > > "Logical Decoding" feature is used for extracting database changes in > real-time. > A dedicated replication slot - say [Replication Slot Name] - is used for > controlling this flow. > Everything works fine until PostgreSQL service is stopped. > While an active replication slot exists and PostgreSQL service is neatly > stopped, further attempt to restart it is responded by: > > PostgreSQL - PANIC: could not fsync file "pg_replslot/[Replication Slot > Name]/state": Bad file descriptor > Actually - the database in question is now corrupted / not operational > anymore. > Tonight this occurred also after a spontaneous machine shutdown. > > This misbehavior now occurs very systematically upon stopping PostgreSQL > service while active replication slots are defined there. This is a known and fixed problem that only occurs on windows (unfortunately it's not allowed to fsync a readonly file handle on windows). The next 9.4 release will be made public on the 21st. Until then there's basically three ways to circumvent the problem: 1) Start the database with fsync turned off, and immediately after start turn it on, and reload the config. If you're concerned about the data loss window that could theoretically incur you can use initdb -S. 2) Remove the slot by simply removing the directory. Obviously that's problematic because the slot's gone in that case. 3) Apply the fix (http://git.postgresql.org/gitweb/?p=postgresql.git;a=commit;h=dfbaed459754e71e01bb0cc90a12802bba3f9786) and recompile postgres. Unfortunately that's not that easy on windows. Hope that helps? Andres -- Sent via pgsql-bugs mailing list (pgsql-bugs@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-bugs