Re: libpq, threads and connection reset
От | Tom Lane |
---|---|
Тема | Re: libpq, threads and connection reset |
Дата | |
Msg-id | 29109.1031235564@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | Re: libpq, threads and connection reset (Joe Murphy <joe.murphy@aersoft.ie>) |
Список | pgsql-interfaces |
Joe Murphy <joe.murphy@aersoft.ie> writes: >> The re-connect underlying call to connect returns -1 and errno = 0, so >> it thinks the connection is "in progress" and tries >> to complete the connection - but hangs on the select (poll) Well, you have a bug in connect() if it's returning the wrong errno in the multi-thread case. However, our code in fe-connect.c reads like this: if (connect(conn->sock, &conn->raddr.sa, conn->raddr_len) < 0) { if (SOCK_ERRNO == EINTR) /* Interruptedsystem call - we'll just try again */ goto retry1; if (SOCK_ERRNO == EINPROGRESS || SOCK_ERRNO == EWOULDBLOCK || SOCK_ERRNO == 0) { /* * Thisis fine - we're in non-blocking mode, and the * connection is in progress. */ conn->status= CONNECTION_STARTED; } else { /* Something's gone wrong */ connectFailureMessage(conn,SOCK_ERRNO); goto connect_errReturn; } I wonder whether it's really a good idea to treat errno == 0 as indicating "connection in progress". Does anyone know of a platform where zero is actually what is returned in this case? The man pages I can find all say that EINPROGRESS is returned. regards, tom lane
В списке pgsql-interfaces по дате отправления: