MDEV-38076 - main.mdev375 fails sporadically
Test was affected by incompletely closed preceding connections.
Wait for preceding connections to decrement Threads_connected before testing ER_CON_COUNT_ERROR condition.
what does it fix? MDEV-10608 says the failure is
mysqltest: At line 9: query 'connect con1,localhost,root,,' failed: 2003: Can't connect to MySQL server on 'localhost' (0 "Internal error/check (Not system error)")
but I see it's failing now as
mysqltest: At line 26: query 'connect con3,localhost,root,,' failed with wrong errno <Unknown> (2013): 'Can't connect to server (22).', instead of ER_CON_COUNT_ERROR (1040)...
and your fix wouldn't help here. Does this test still fail the old way anywhere?
With this sleep()...
diff --git a/sql/sql_connect.cc b/sql/sql_connect.cc
index c279f2663c8..c227fee943e 100644
--- a/sql/sql_connect.cc
+++ b/sql/sql_connect.cc
@@ -1483,6 +1483,7 @@ void do_handle_one_connection(CONNECT *connect, bool put_in_cache)
if (thd->userstat_running)
update_global_user_stats(thd, create_user, time(NULL));
+ sleep(1);
unlink_thd(thd);
if (IF_WSREP(thd->wsrep_applier, false) || !put_in_cache ||
!(connect= thread_cache.park()))
...the failure on my host is:
CURRENT_TEST: main.mdev375
mysqltest: At line 24: query 'connect con2,localhost,root,,' failed: ER_CON_COUNT_ERROR (1040): Too many connections
The result from queries just before the failure was:
set @save_log_warnings=@@log_warnings, @save_max_connections=@@max_connections;
SET GLOBAL log_warnings=4;
SET GLOBAL max_connections=10;
connect tmp_con1,localhost,root,,;
connect tmp_con2,localhost,root,,;
connect tmp_con3,localhost,root,,;
connect tmp_con4,localhost,root,,;
connect tmp_con5,localhost,root,,;
connect tmp_con6,localhost,root,,;
connect tmp_con7,localhost,root,,;
connect tmp_con8,localhost,root,,;
connect con1,localhost,root,,;
SELECT 1;
1
1
This failure is present in buildbot too: https://buildbot.mariadb.org/#/builders/644/builds/11740/steps/6/logs/stdio. But it is much less frequent compared to the con3 failure on aarch64-macos that you've outlined. And yes, it is correct that my fix won't help here.
The failure from MDEV-10608, I will need some time to analyze it. Will get back to you shortly.