[MDEV-8014] [PATCH] MariaDB client can hang in an infinite loop Created: 2015-04-18 Updated: 2015-05-05 Resolved: 2015-05-05 |
|
| Status: | Closed |
| Project: | MariaDB Server |
| Component/s: | OTHER |
| Affects Version/s: | 10.0.17, 5.5, 10.0, 10.1 |
| Fix Version/s: | 10.0.18, 10.1.5 |
| Type: | Bug | Priority: | Major |
| Reporter: | Pavel Ivanov | Assignee: | Sergei Golubchik |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | upstream-fixed | ||
| Description |
|
In certain conditions MySQL client compiled from MariaDB sources can hang in an infinite loop. The problem is in my_real_read() function in sql/net_serv.cc. When vio_read() returns 0 that means EOF. But it's processed as if it's error and gets to the following lines:
Note that EOF is not an error and thus recv() doesn't change errno when it returns 0. So errno contains whatever last erroneous syscall set in there. And if it contains EINTR then the code goes to the beginning of the loop, calls vio_read() again which returns 0 again, and it goes into the same "if" again, goes to the beginning of the loop etc. Simple adding of "length != 0 && " to the beginning of this "if" condition should fix the problem. The bug affects 5.5, 10.0 and 10.1. |