Re: Sometimes the output to the stdout in Windows disappears

2020-10-18 Thread Tom Lane
Alexander Lakhin writes: > I just wanted to inform that the ECPG-test failures can still persist in > the buildfarm, unfortunately. Right, but at least now we can see that there are other issues to investigate. Personally I stopped paying any attention to buildfarm ECPG failures on Windows some

Re: Sometimes the output to the stdout in Windows disappears

2020-10-18 Thread Tom Lane
Alexander Lakhin writes: > I've made a simple cmd script to reproduce problems seen on dory: > ... > Without the fix I've got errors on iterations 43, 46, 128, 47, 14, 4, > 27, which approximately corresponds to the ECPG-Check failure frequency > on dory (for HEAD). > With the fix all the 200

Re: Sometimes the output to the stdout in Windows disappears

2020-10-18 Thread Alexander Lakhin
18.10.2020 21:04, Tom Lane wrote: > Alexander Lakhin writes: >> @@ -0,0 +1 @@ >> +SQL error: descriptor "mydesc" not found on line 31 > does not look like the same kind of failure as what we've been dealing > with up to now. So maybe what we've got is that we fixed the stdio > loss problem, and

Re: Sometimes the output to the stdout in Windows disappears

2020-10-18 Thread Tom Lane
I wrote: >> diff -w -U3 >> .../src/interfaces/ecpg/test/expected/thread-descriptor.stderr >> .../src/interfaces/ecpg/test/results/thread-descriptor.stderr >> --- .../src/interfaces/ecpg/test/expected/thread-descriptor.stderr    >> 2019-12-04 16:05:46 +0300 >> +++

Re: Sometimes the output to the stdout in Windows disappears

2020-10-18 Thread Tom Lane
Alexander Lakhin writes: > With the fix all the 200 iterations passed as expected. > Then I ran the loop again just to be sure and got: > test thread/descriptor    ... stderr FAILED   81 ms > iteration 124 failed. Sigh ... still, this: > diff -w -U3 >

Re: Sometimes the output to the stdout in Windows disappears

2020-10-18 Thread Alexander Lakhin
17.10.2020 21:44, Tom Lane wrote: > I propose the attached patch. If this doesn't cause buildfarm problems, > perhaps we should back-patch it. Thank you! I've made a simple cmd script to reproduce problems seen on dory: https://buildfarm.postgresql.org/cgi-bin/show_history.pl?nm=dory=HEAD FOR /L

Re: Sometimes the output to the stdout in Windows disappears

2020-10-17 Thread Tom Lane
I wrote: > Alexander Lakhin writes: >> What bothers me is: >> There must be a call to *WSACleanup* for each successful call to >> WSAStartup >> >> . > Yeah, that is a very odd statement. Surely,

Re: Sometimes the output to the stdout in Windows disappears

2020-10-17 Thread Tom Lane
Alexander Lakhin writes: > 16.10.2020 19:18, Tom Lane wrote: >> What if we arranged to call WSAStartup just once, during the first >> libpq connection-open in a process, and then never did WSACleanup? >> Surely the OS can cope with that, and it eliminates any risk that >> WSACleanup breaks

Re: Sometimes the output to the stdout in Windows disappears

2020-10-17 Thread Andrew Dunstan
On 10/16/20 12:18 PM, Tom Lane wrote: > > But wait a minute: I just looked at Microsoft's docs [1] and found > > In a multithreaded environment, WSACleanup terminates Windows Sockets > operations for all threads. > > This makes me (a) wonder if that explains the side-effects on stdio, >

Re: Sometimes the output to the stdout in Windows disappears

2020-10-17 Thread Alexander Lakhin
16.10.2020 19:18, Tom Lane wrote: > Oh, very interesting. > Now that you have it somewhat in captivity, maybe you could determine > some things: > > 1. Is it only stdout that's affected? What of other stdio streams? > (Note that testing stderr might be tricky because it's probably >

Re: Sometimes the output to the stdout in Windows disappears

2020-10-16 Thread Tom Lane
Alexander Lakhin writes: > I've managed to make a simple reproducer. Please look at the patch attached. > There are two things crucial for reproducing the bug: >     ioctlsocket(sock, FIONBIO, _ret); // from pgwin32_socket() > and >     WSACleanup(); Oh, very interesting. Now that you have it

Re: Sometimes the output to the stdout in Windows disappears

2020-10-16 Thread Alexander Lakhin
Hello hackers, 13.09.2020 21:37, Tom Lane wrote: > I happened to try googling for other similar reports, and I found > a very interesting recent thread here: > > https://github.com/nodejs/node/issues/33166 > > It might not have the same underlying cause, of course, but it sure > sounds familiar.

Re: Sometimes the output to the stdout in Windows disappears

2020-09-13 Thread Tom Lane
I happened to try googling for other similar reports, and I found a very interesting recent thread here: https://github.com/nodejs/node/issues/33166 It might not have the same underlying cause, of course, but it sure sounds familiar. If Node.js are really seeing the same effect, that would

Re: Sometimes the output to the stdout in Windows disappears

2020-08-31 Thread Victor Spirin
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

Re: Sometimes the output to the stdout in Windows disappears

2020-08-31 Thread 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

Sometimes the output to the stdout in Windows disappears

2020-08-31 Thread Victor Spirin
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