Commit 8e797ae2 authored by Sergei Golubchik's avatar Sergei Golubchik

MDEV-8014 MariaDB client can hang in an infinite loop

On EOF vio_read returns 0, it's not an error so the errno
is not reset. If the previous error was EINTR the client
will loop forever. See also man recv.
parent aa509562
......@@ -917,7 +917,7 @@ my_real_read(NET *net, size_t *complen,
my_progname,vio_errno(net->vio));
}
#ifndef MYSQL_SERVER
if (vio_errno(net->vio) == SOCKET_EINTR)
if (length != 0 && vio_errno(net->vio) == SOCKET_EINTR)
{
DBUG_PRINT("warning",("Interrupted read. Retrying..."));
continue;
......
......@@ -137,6 +137,9 @@ int vio_socket_io_wait(Vio *vio, enum enum_vio_io_event event)
#define VIO_DONTWAIT 0
#endif
/*
returns number of bytes read or -1 in case of an error
*/
size_t vio_read(Vio *vio, uchar *buf, size_t size)
{
ssize_t ret;
......
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