Re: BUG #1467: fe_connect doesn't handle EINTR right
От | Tom Lane |
---|---|
Тема | Re: BUG #1467: fe_connect doesn't handle EINTR right |
Дата | |
Msg-id | 28294.1123801009@sss.pgh.pa.us обсуждение исходный текст |
Ответ на | BUG #1467: fe_connect doesn't handle EINTR right (AgentM <agentm@themactionfaction.com>) |
Список | pgsql-patches |
AgentM <agentm@themactionfaction.com> writes: > Attached is a patch which corrects the behavior. I verified that the > patch does not interfere with normal operation (using psql) but > unfortunately the code path is virtually impossible to test without a > really slow connection to a postgresql server [which I thankfully > don't have]. To test the patch, you would need to send an interrupt > at the exact time that the kernel is connect()ing in blocking mode- > good luck. I've applied a simplified version of this patch --- there is no need to duplicate the functionality that the calling level must have anyway. regards, tom lane Index: fe-connect.c =================================================================== RCS file: /cvsroot/pgsql/src/interfaces/libpq/fe-connect.c,v retrieving revision 1.316 retrieving revision 1.317 diff -c -r1.316 -r1.317 *** fe-connect.c 9 Aug 2005 05:14:26 -0000 1.316 --- fe-connect.c 11 Aug 2005 22:53:41 -0000 1.317 *************** *** 1082,1096 **** * since we are in nonblock mode. If it does, well, * too bad. */ - retry_connect: if (connect(conn->sock, addr_cur->ai_addr, addr_cur->ai_addrlen) < 0) { - if (SOCK_ERRNO == EINTR) - /* Interrupted system call - just try again */ - goto retry_connect; if (SOCK_ERRNO == EINPROGRESS || SOCK_ERRNO == EWOULDBLOCK || SOCK_ERRNO == 0) { /* --- 1082,1093 ---- * since we are in nonblock mode. If it does, well, * too bad. */ if (connect(conn->sock, addr_cur->ai_addr, addr_cur->ai_addrlen) < 0) { if (SOCK_ERRNO == EINPROGRESS || SOCK_ERRNO == EWOULDBLOCK || + SOCK_ERRNO == EINTR || SOCK_ERRNO == 0) { /*
В списке pgsql-patches по дате отправления: