! The explanation is spotted in net.cc ! in wsock_event::wait()
case WSA_WAIT_EVENT_0 + 1: if (!CancelIo ((HANDLE) socket)) { debug_printf ("CancelIo() %E, fallback to blocking io"); WSAGetOverlappedResult (socket, &ovr, &len, TRUE, flags); } else WSASetLastError (WSAEINTR); break; Most of the time, when signal_arrived is raised, there is nothing but the EINTR code to set, and the backend loops in recv() to receive the next command. But the race conditions may be different, and the command is available at the same time the signal is detected. So the CancelIo() call discards the command. When the backend returns in recv(), the command is lost, and the sender waits for an answer -> deadlock Why this CancelIo() ?? It seems too intrusive. Additional note: DWORD len; is present in case WSA_WAIT_EVENT_0 but is missing in case WSA_WAIT_EVENT_0 + 1 --- Patrick Samson wrote: > If I run a test script enough time, it eventually > freezes in this deadlock situation: > > The client sends a command to a backend and waits > for an answer. It will wait forever because the > backend > is not aware of the arrival of the request and waits > for a next command. > > What happens in the loop is: > SIInsertDataEntry: table is 70% full, > signaling postmaster > > In reaction, the postmaster sends to its children: > SignalChildren: sending signal 31 to process <pid> > > Most of the time, it works. But at an unpredictable > iteration, it freezes. > > This problem appeared first in a replication > machinery, so I reduced the number of components > involved, to get a simpler test case: > A pgtcl script, running a loop with: > create table from another-table > copy table to file > drop table > > The 'create table' regularly fires the '70% full' > event, and at some point, the 'copy' never gets > answered. __________________________________ Do you Yahoo!? Yahoo! Finance Tax Center - File online. File on time. http://taxes.yahoo.com/filing.html -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/