Bug #98574 | mysql_real_connect_nonblocking() blocks | ||
---|---|---|---|
Submitted: | 12 Feb 2020 21:29 | Modified: | 13 Feb 2020 16:51 |
Reporter: | Jay Edgar | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: C API (client library) | Severity: | S2 (Serious) |
Version: | 8.0.17 | OS: | Any |
Assigned to: | CPU Architecture: | Any |
[12 Feb 2020 21:29]
Jay Edgar
[13 Feb 2020 12:25]
MySQL Verification Team
Hello Mr. Edgar, Thank you for your bug report. I agree with your analysis. I have studied the proposed patch, and with some minor changes, it is a truly welcome addition to our C API. Verified as reported.
[13 Feb 2020 16:51]
Jay Edgar
Found some more changes that need to be made to the mysql_client_test as it assumes that mysql_real_connect_nonblocking does not return NET_ASYNC_NOT_READY. diff --git a/testclients/mysql_client_test.cc b/testclients/mysql_client_test.cc index a22de6c6ae4..e2f7e48b866 100644 --- a/testclients/mysql_client_test.cc +++ b/testclients/mysql_client_test.cc @@ -20160,9 +20160,11 @@ static void test_wl11381() { myerror("mysql_client_init() failed"); exit(1); } - status = mysql_real_connect_nonblocking( - mysql_local, opt_host, opt_user, opt_password, current_db, opt_port, - opt_unix_socket, CLIENT_MULTI_STATEMENTS); + do { + status = mysql_real_connect_nonblocking( + mysql_local, opt_host, opt_user, opt_password, current_db, opt_port, + opt_unix_socket, CLIENT_MULTI_STATEMENTS); + } while (status == NET_ASYNC_NOT_READY); if (status == NET_ASYNC_ERROR) { fprintf(stdout, "\n mysql_real_connect_nonblocking() failed"); exit(1); @@ -20339,8 +20341,8 @@ static void test_wl11381() { static void test_wl11381_qa() { MYSQL *mysql_con1; MYSQL *mysql_con2; - net_async_status mysql_con1_status; - net_async_status mysql_con2_status; + net_async_status mysql_con1_status = NET_ASYNC_NOT_READY; + net_async_status mysql_con2_status = NET_ASYNC_NOT_READY; const char *stmt_text; int counter = 0; @@ -20356,13 +20358,20 @@ static void test_wl11381_qa() { exit(1); } - mysql_con1_status = (mysql_real_connect_nonblocking( - mysql_con1, opt_host, opt_user, opt_password, current_db, opt_port, - opt_unix_socket, CLIENT_MULTI_STATEMENTS)); + do { + if (mysql_con1_status == NET_ASYNC_NOT_READY) { + mysql_con1_status = (mysql_real_connect_nonblocking( + mysql_con1, opt_host, opt_user, opt_password, current_db, opt_port, + opt_unix_socket, CLIENT_MULTI_STATEMENTS)); + } - mysql_con2_status = (mysql_real_connect_nonblocking( - mysql_con2, opt_host, opt_user, opt_password, current_db, opt_port, - opt_unix_socket, CLIENT_MULTI_STATEMENTS)); + if (mysql_con2_status == NET_ASYNC_NOT_READY) { + mysql_con2_status = (mysql_real_connect_nonblocking( + mysql_con2, opt_host, opt_user, opt_password, current_db, opt_port, + opt_unix_socket, CLIENT_MULTI_STATEMENTS)); + } + } while (mysql_con1_status == NET_ASYNC_NOT_READY || + mysql_con2_status == NET_ASYNC_NOT_READY); if (mysql_con1_status == NET_ASYNC_ERROR) { fprintf(stdout, "\n mysql_real_connect_nonblocking() failed");
[28 Feb 2020 14:16]
Georgi Kodinov
Posted by developer: Duplicate of Bug#30771233