Re: libpq, threads and connection reset
От | Joe Murphy |
---|---|
Тема | Re: libpq, threads and connection reset |
Дата | |
Msg-id | 3D788412.CCFB57E2@aersoft.com обсуждение исходный текст |
Ответ на | ("cheng" <ch_gang304@163.net>) |
Список | pgsql-interfaces |
The problem I was having "went away" when I moved to another Solaris 2.6 machine with the latest patch level. <br />I'vealso tested it on Solaris 8, HP-UX 11.00 and Linux, so it looks like there is a connect bug in a release 2.6, <br />butseems to be fixed with later patches. <p>Thanks for the help. <p>Joe <p>Tom Lane wrote: <blockquote type="CITE">JoeMurphy <joe.murphy@aersoft.ie> writes: <br />>> The re-connect underlying call to connect returns-1 and errno = 0, so <br />>> it thinks the connection is "in progress" and tries <br />>> to completethe connection - but hangs on the select (poll) <p>Well, you have a bug in connect() if it's returning the wrongerrno <br />in the multi-thread case. <p>However, our code in fe-connect.c reads like this: <p> if (connect(conn->sock,&conn->raddr.sa, conn->raddr_len) < 0) <br /> { <br /> if (SOCK_ERRNO == EINTR)<br /> /* Interrupted system call - we'll just try again */ <br /> goto retry1; <p> if(SOCK_ERRNO == EINPROGRESS || SOCK_ERRNO == EWOULDBLOCK || SOCK_ERRNO == 0) <br /> { <br /> /* <br /> * This is fine - we're in non-blocking mode, and the <br /> * connection is in progress. <br /> */ <br /> conn->status = CONNECTION_STARTED; <br /> } <br /> else <br /> { <br /> /* Something's gone wrong */ <br /> connectFailureMessage(conn, SOCK_ERRNO); <br/> goto connect_errReturn; <br /> } <p>I wonder whether it's really a good idea to treat errno == 0as <br />indicating "connection in progress". Does anyone know of a platform <br />where zero is actually what is returnedin this case? The man pages <br />I can find all say that EINPROGRESS is returned. <p> regards,tom lane <p>---------------------------(end of broadcast)--------------------------- <br />TIP 4: Don't 'kill -9'the postmaster</blockquote><pre>-- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Joe Murphy - AerSoft Limited 2 Northumberland Avenue, Dun Laoghaire, Co. Dublin. phone: +353-1-2301166 direct: +353-1-2145953 fax: +353-1-2301167 <a href="mailto:joe@aersoft.com">mailto:joe@aersoft.com</a> mobile: +353-86-8526181 <a href="http://www.aersoft.com">http://www.aersoft.com</a> ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~</pre>
В списке pgsql-interfaces по дате отправления: