Bug #114357 Unable to Connect to Any of the Specified MySQL Hosts
Submitted: 14 Mar 17:38 Modified: 25 Mar 17:13
Reporter: Mahesnwar Deveraj Email Updates:
Status: Verified Impact on me:
None 
Category:Connector / NET Severity:S2 (Serious)
Version:8.3.0 OS:Windows
Assigned to: CPU Architecture:Any
Tags: Opening Multiple Cuncurrent Connections, Unable to Connect to Any of the Specified MySQL Hosts

[14 Mar 17:38] Mahesnwar Deveraj
Description:
Hi,

   I have been using MYSQL NET connector 1.7 for a long time, Recently i upgraded my project with MYSQL 8.0.35  and connector with MYSQL 8.3.0. Every thing works fine except opening multiple connections in threaded environment gives "Unable to Connect to Any of the Specified MySQL Hosts" after 12 threads.

  The flow was simple .
   
       Open the connection
        
          Process

       Close the connection 

 The above code will be called in loop for multiple time and in multi threading environment.

 The same code works very well in old connector with out a single issue.

 The only fix was to set pooling = True ,  But when using pooling also i can see all the connections where waiting to open in a queue and then perform the operation one by one.

How to repeat:

  Use MYSQL NET 8.0 or above to connect , Do some simple DB operations in a function and call it in Multi threading loop. 

  Then you will get "Unable to Connect to Any of the Specified MySQL Hosts"
[15 Mar 8:16] Mahesnwar Deveraj
Am adding the simple code to duplicate the issue

 Public Shared Function pustest(ByVal busid As Integer) As String
        Dim d As New pustest_Delegate(AddressOf pustest1)
        Dim R As IAsyncResult = Nothing
        R = d.BeginInvoke(busid, Nothing, Nothing)
 End Function

 Private Delegate Sub pustest_Delegate(ByVal busid As Integer)
    Private Shared Function pustest1(ByVal busid As Integer) As String
        Dim con As MySqlConnection
        Dim str As String = "insert into tblins(bid, dte) values('" & busid & "','" & dbnow(0).DB_yyyyMMdd_HHmmss & "')"
        con = dcon1(myConfig.DB)
        dbcommand(str, con)
        Dim sd As String = busid
        con.Close()
  End Function

Calling Part:

Dim ik As Integer = 1
            While ik < 15000
                pustest(ik)
             
                Response.Write("<br>" & dbnow(0).DS_ddMMMyyyy_hhmm_tt & " - " & ik & " - " & sval & "<br>")
                ik = ik + 1
 End While
[25 Mar 12:54] MySQL Verification Team
Hello Mahesnwar Deveraj,

Thank you for the bug report.
Verified as described.

Regards,
Ashwini Patil
[25 Mar 17:13] Mahesnwar Deveraj
So its a bug?. Any idea when this will be fixed?