BUG: possible busy loop when connection is closed while trying to establish SSL connection
От | Hannu Krosing |
---|---|
Тема | BUG: possible busy loop when connection is closed while trying to establish SSL connection |
Дата | |
Msg-id | 1095898262.3552.5.camel@fuji.krosing.net обсуждение исходный текст |
Ответы |
Re: BUG: possible busy loop when connection is closed while trying to establish SSL connection
|
Список | pgsql-hackers |
We were bitten by the following bug a few times, when our server tried to reestablish connections under bad network conditions: if connection is closed while trying to get response to SSL setup packet (i.e. conn->status is CONNECTION_SSL_STARTUP), we get a busy loop, as line 1035 in 8.0.0.beta2: if (pqWaitTimed(1, 0, conn, finish_time) { tells that there is data to read (returns 0) while actually it is error (POLLERR & POLLHUP) and not POLLIN returned from poll() and nread = recv(conn->sock, &SSLok, 1, 0); on line 1449 sets nread to 0, as there is in fact nothing to read from a closed socket after that the check on line 1462: if (nread == 0) /* caller failed to wait for data */ return PGRES_POLLING_READING; resumes the busy loop in all other places recv()'ing is done throught pqsecure_read, which checks for such condition. I'm not familiar enough with code to suggest a proper fix (and I quickfix our app by disabling SSL (PGSSLMODE=disable) - the default was prefer ;), but this may come back to haunt others -------------- Hannu
В списке pgsql-hackers по дате отправления: