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 1kCoQ0-00086k-Rx for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2020 18:20:37 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kCoPz-0003gt-Qs for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Aug 2020 18:20:35 +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 1kCoPz-0003gm-Fo for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2020 18:20:35 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1kCoPw-0006Rw-2a for pgsql-hackers@lists.postgresql.org; Mon, 31 Aug 2020 18:20:34 +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 EE08E21C2BDD for ; Mon, 31 Aug 2020 21:20:28 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1598898028; bh=8k+62MHGGgAjsxEiJDcvr+yyAV9Bi7H2FdgpLkIHhnE=; h=To:From:Subject:Date; b=EMRJvqEZod7jl3+ZTjBfvJmcBDJEBsgCmZrvOZhpD+WLLvDRTs6RXha+GMBI+syRZ VK/HLct3yRK8EvtpINMN5kj22a8HEGL18JYrCB+ICiuyzSEr6g6bQ7yy4GmcS3asUk xb9C+bTVW49zQf08x/E998tfHS5iK7jzsXuyoi6I= To: pgsql-hackers@lists.postgresql.org From: Victor Spirin Subject: Sometimes the output to the stdout in Windows disappears Message-ID: Date: Mon, 31 Aug 2020 21:20:28 +0300 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.12.0 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="------------4B387ABEBF3108ABC2CF1EF7" Content-Language: ru List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk This is a multi-part message in MIME format. --------------4B387ABEBF3108ABC2CF1EF7 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Hi! 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. First we appeared this in some pgbench tests.  Then we found that this happens on any console program using PQconnectdbParams and PQfinish. I am attaching a patch and a script for testing. -- Victor Spirin Postgres Professional:http://www.postgrespro.com The Russian Postgres Company --------------4B387ABEBF3108ABC2CF1EF7 Content-Type: text/plain; charset=UTF-8; name="stdout.patch" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="stdout.patch" ZGlmZiAtLWdpdCBhL3NyYy9wb3J0L3NucHJpbnRmLmMgYi9zcmMvcG9ydC9zbnByaW50Zi5j CmluZGV4IDgzYTgxMDMuLjE3ZGM1MDUgMTAwNjQ0Ci0tLSBhL3NyYy9wb3J0L3NucHJpbnRm LmMKKysrIGIvc3JjL3BvcnQvc25wcmludGYuYwpAQCAtMzEzLDYgKzMxMywxNCBAQCBmbHVz aGJ1ZmZlcihQcmludGZUYXJnZXQgKnRhcmdldCkKIAkJCXRhcmdldC0+ZmFpbGVkID0gdHJ1 ZTsKIAl9CiAJdGFyZ2V0LT5idWZwdHIgPSB0YXJnZXQtPmJ1ZnN0YXJ0OworCS8qCisJICog U29tZXRpbWVzIHRoZSBvdXRwdXQgdG8gc3Rkb3V0IG9uIFdpbmRvd3Mgb24gbXVsdGljb3Jl IG1hY2hpbmVzIAorCSAqIGRvZXMgbm90IGdvIHRocm91Z2ggYWZ0ZXIgY29ubmVjdGluZyBh bmQgZGlzY29ubmVjdGluZyB0byB0aGUgc2VydmVyIAorCSAqIHVzaW5nIHRoZSBQUWNvbm5l Y3RkYlBhcmFtcyBhbmQgUFFmaW5pc2ggZnVuY3Rpb25zLgorCSovCisjaWZkZWYgV0lOMzIK KwlmZmx1c2godGFyZ2V0LT5zdHJlYW0pOworI2VuZGlmCiB9CiAKIAo= --------------4B387ABEBF3108ABC2CF1EF7 Content-Type: text/plain; charset=UTF-8; name="test_clusterdb.pl" Content-Transfer-Encoding: base64 Content-Disposition: attachment; filename="test_clusterdb.pl" dXNlIElQQzo6UnVuOwpteSAkY2xvcHRzID0gJy1wIDU0MzIgLWUgLS1kYm5hbWU9cG9zdGdy ZXMgLVUgcG9zdGdyZXMnOwpteSAkc3Rkb3V0OwpteSAkc3RkZXJyOwpteSBAY21kID0gKCdj bHVzdGVyZGInLCBzcGxpdCAvXHMrLywgJGNsb3B0cyk7Cm15ICRjaDsKZm9yIChteSAkaSA9 MDsgJGkgPCAyKjQwOTY7ICRpKyspIHsKCSRjaCA9IElQQzo6UnVuOjpydW4oXEBjbWQsICc+ JywgXCRzdGRvdXQsICcyPicsIFwkc3RkZXJyKTsKCWlmKG5vdCBkZWZpbmVkICRzdGRvdXQp IHsKCQlwcmludCgkaS4iOiBub3QgZGVmaW5lZFxuIik7Cgl9CglpZigkc3Rkb3V0IGVxICcn KSB7CgkJcHJpbnQoJGkuIjogc3Rkb3V0IGlzIGVtcHR5XG4iKTsKCX0KCWlmICggKCRpICUg MTAwKSA9PSAwKXsKCQlwcmludCgiJGlcbiIpOwoJfQp9Cg== --------------4B387ABEBF3108ABC2CF1EF7--