https://s3.amazonaws.com/clickhouse-test-reports/43987/3725cf4aa7a9aa022b11d08b2f8e4f7f0dd70283/stress_test__ubsan_/gdb.log
#include <IO/WriteBufferFromFileDescriptorDiscardOnFailure.h>
namespace ProfileEvents
{
    extern const Event CannotWriteToWriteBufferDiscard;
}
namespace DB
{
void WriteBufferFromFileDescriptorDiscardOnFailure::nextImpl()
{
    size_t bytes_written = 0;
    while (bytes_written != offset())
    {
        ssize_t res = ::write(fd, working_buffer.begin() + bytes_written, offset() - bytes_written);
        if ((-1 == res || 0 == res) && errno != EINTR)
        {
            ProfileEvents::increment(ProfileEvents::CannotWriteToWriteBufferDiscard);
            break;  
        }
        if (res > 0)
            bytes_written += res;
    }
}
}