Commit 79e1a118 authored by Dimitrios Katsaros's avatar Dimitrios Katsaros

Transport: Workaround for segmentation fault

There is a race condition where a connection being serviced can
hang up before a write operation is performed. In these cases, the
transport will issue an error response to the disconnected peer,
which invokes a promise to handle the request. The object is destroyed
and then the promise is resolved on the destroyed response object,
causing a segmentation fault
parent f0b86b0e
......@@ -287,7 +287,7 @@ Transport::asyncWriteImpl(Fd fd)
// EBADF can happen when the HTTP parser, in the case of
// an error, closes fd before the entire request is processed.
// https://github.com/oktal/pistache/issues/501
else if (errno == EBADF) {
else if (errno == EBADF || errno == EPIPE || errno == ECONNRESET) {
wq.pop_front();
toWrite.erase(fd);
stop = true;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment