Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kCpdj-0002c6-JY for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2020 19:38:52 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kCpdi-0000t0-Av for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2020 19:38:50 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1kCpdi-0000st-0P for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2020 19:38:50 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kCpdc-00077E-Qa for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2020 19:38:48 +0000 Received: from [192.168.28.30] (cyclops.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 8C79521C2BDD for ; Mon, 31 Aug 2020 22:38:41 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1598902721; bh=MKpjm2Pt5bbskXIRT6W2kGgU74s6wCE48tGyL6t6/j0=; h=Subject:To:References:From:Date:In-Reply-To; b=aUAibaxLJoOz0gIKa43amoVaIRFppcJkPTMj/5i72DUMOELURA5AFLSA/ktRiMzVL wKoOYQSe7o0y6DCXVVT0NkzuTF1er+7SvWGIzYwnW9RPmnVadqCo0ERY8Gy6KKR31X CX02Cfp5s+SeRnEfB768iZNl1w/2kBLBh9j4Y4Qg= Subject: Re: Sometimes the output to the stdout in Windows disappears To: pgsql-hackers@lists.postgresql.org References: <4124040.1598898684@sss.pgh.pa.us> From: Victor Spirin Message-ID: Date: Mon, 31 Aug 2020 22:38:36 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 In-Reply-To: <4124040.1598898684@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: ru List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk I only found that calling WSACleanup instead of PQfinish has the same effect. I don't see any big performance issues due to the extra fflush call in this place. I will be glad to find a more elegant solution. Victor Spirin Postgres Professional:http://www.postgrespro.com The Russian Postgres Company 31.08.2020 21:31, Tom Lane пишет: > Victor Spirin writes: >> Sometimes the output to stdout on Windows on multicore machines does not >> go through after connecting and disconnecting to the server using the >> PQconnectdbParams and PQfinish functions. I tested on 6 cores. > Hm, why is this not Microsoft's bug to solve? > > I do wonder if this report is related to the intermittent ecpg failures > we see on Windows machines, such as [1]. The details vary, but it's > always a case of a .stdout file ending up empty when it should not be. > I'd supposed though that it must be something specific to ecpg, since > we never see anything like that anywhere but the ecpg tests. Even if > you posit that libpq is doing something that somehow compromises stdio, > that should affect psql-based tests too. > >> I am attaching a patch and a script for testing. >> [ forced fflush in every snprintf call ] > My goodness, that's a large hammer you're swinging. What effects has this > kluge got on performance? > > While I think you may be on to something, this seems like a truly horrid > way to "fix" it. We need to dig down further and understand what is > actually happening. > > regards, tom lane > > [1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=dory&dt=2020-08-13%2022%3A15%3A05 > >