Received: from malur.postgresql.org ([2a02:16a8:dc51::56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYmzN-0002qo-NP for pgsql-general@arkaria.postgresql.org; Fri, 29 Jun 2018 06:34:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1fYmzL-0002sb-Al for pgsql-general@arkaria.postgresql.org; Fri, 29 Jun 2018 06:34:35 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1fYmzK-0002sU-PS for pgsql-general@lists.postgresql.org; Fri, 29 Jun 2018 06:34:34 +0000 Received: from [195.159.176.226] (helo=blaine.gmane.org) by makus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1fYmzC-0003GN-VS for pgsql-general@postgresql.org; Fri, 29 Jun 2018 06:34:33 +0000 Received: from list by blaine.gmane.org with local (Exim 4.84_2) (envelope-from ) id 1fYmx2-0000O7-7M for pgsql-general@postgresql.org; Fri, 29 Jun 2018 08:32:12 +0200 X-Injected-Via-Gmane: http://gmane.org/ To: pgsql-general@postgresql.org From: Thomas Kellerer Subject: Re: Windows 10 got stuck with PostgreSQL at starting up. Adding delay lets it avoid. Date: Fri, 29 Jun 2018 08:34:18 +0200 Lines: 30 Message-ID: References: <20180629150310.b01664be02fde699ccc5f683@sraoss.co.jp> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Complaints-To: usenet@blaine.gmane.org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.23) Gecko/20090812 Thunderbird/2.0.0.23 Mnenhy/0.7.6.666 In-Reply-To: <20180629150310.b01664be02fde699ccc5f683@sraoss.co.jp> Content-Language: de-DE X-Host-Lookup-Failed: Reverse DNS lookup failed for 195.159.176.226 (failed) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk TAKATSUKA Haruka schrieb am 29.06.2018 um 08:03: > I got a trouble in PostgreSQL 9.3.x on Windows 10. > I would like to add new delay code as an official build option. > > Windows 10 sometime (approximately once in 300 tries) hung up > at OS starting up. The logs say it happened while the PostgreSQL > service was starting. When OS stopped, some postgres auxiliary > process were started and some were not started yet. > > The Windows dump say some threads of the postgres auxiliary process > are waiting OS level locks and the logon processes’thread are > also waiting a lock. MS help desk said that PostgreSQL’s OS level > deadlock caused OS freeze. I think it is strange story. But, > in fact, it not happened in repeated tests when I got rid of > PostgreSQL from the initial auto-starting services. > > I tweaked PostgreSQL 9.3.x (the newest from the repository) to add > 0.5 or 3.0 seconds delay after each sub process starts. > And then the hung up was gone. This test patch is attached. > It is only implemented for Windows. Also, I did not use existing > pg_usleep because it contains locking codes (e.g. WaitForSingleObject > and Enter/LeaveCriticalSection). > > Although Windows OS may have some problems, I think we should have > a means to avoid it. Can PostgreSQL be accepted such delay codes > as build-time options by preprocessor variables? Did you try setting the service to "delayed start"?