Skip to content
Permalink
Browse files

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.
  • Loading branch information...
vuvova committed May 3, 2015
1 parent aa50956 commit 8e797ae26753b9bd3f8fd107175d4751953d875b
Showing with 4 additions and 1 deletion.
  1. +1 −1 sql/net_serv.cc
  2. +3 −0 vio/viosocket.c
@@ -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;

0 comments on commit 8e797ae

Please sign in to comment.
You can’t perform that action at this time.