mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2026-05-04 12:41:00 +02:00
[MINOR] session: try to emit a 500 response on memory allocation errors
When we fail to create a session because of memory shortage, let's at least try to send a 500 message directly on the socket. Even if we don't have any buffers left, the kernel's orphans management will take care of delivering the message as long as there are socket buffers left.
This commit is contained in:
parent
9bd0d744ef
commit
2b15492a75
@ -310,6 +310,12 @@ int session_accept(struct listener *l, int cfd, struct sockaddr_storage *addr)
|
||||
out_free_session:
|
||||
pool_free2(pool2_session, s);
|
||||
out_close:
|
||||
if (ret < 0 && s->fe->mode == PR_MODE_HTTP) {
|
||||
/* critical error, no more memory, try to emit a 500 response */
|
||||
struct chunk *err_msg = error_message(s, HTTP_ERR_500);
|
||||
send(cfd, err_msg->str, err_msg->len, MSG_DONTWAIT|MSG_NOSIGNAL);
|
||||
}
|
||||
|
||||
if (fdtab[cfd].state != FD_STCLOSE)
|
||||
fd_delete(cfd);
|
||||
else
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user