Click here to Skip to main content
15,885,881 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am running a script which takes around 45 mins. The script interacts with MySQL multiple times in between but at the end the script got stopped and generated following error:
MySql.Data.MySqlClient.MySqlException (0x80004005): Unable to connect to any of the specified           MySQL hosts. ---> System.Net.Sockets.SocketException (0x80004005): An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full
at System.Net.Sockets.Socket.DoBeginConnect(EndPoint endPointSnapshot, SocketAddress socketAddress, LazyAsyncResult asyncResult)
at System.Net.Sockets.Socket.BeginConnect(EndPoint remoteEP, AsyncCallback callback, Object state)
at MySql.Data.Common.MyNetworkStream.CreateSocketStream(MySqlConnectionStringBuilder settings, IPAddress ip, Boolean unix)
at MySql.Data.Common.MyNetworkStream.CreateStream(MySqlConnectionStringBuilder settings, Boolean unix)
at MySql.Data.Common.StreamCreator.GetStream(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.NativeDriver.Open()
at MySql.Data.MySqlClient.Driver.Open()
at MySql.Data.MySqlClient.Driver.Create(MySqlConnectionStringBuilder settings)
at MySql.Data.MySqlClient.MySqlPool.GetPooledConnection()
at MySql.Data.MySqlClient.MySqlPool.TryToGetDriver()
at MySql.Data.MySqlClient.MySqlPool.GetConnection()
at MySql.Data.MySqlClient.MySqlConnection.Open()
at Connection.ExecuteNonQuery(String str)
at BulkEmailSender.Program.Main(String[] args)

The script was able to connect multiple times than what could have happened?
Note: MySQL server is running on Linux
Posted
Updated 29-Oct-14 20:13pm
v3
Comments
George Jonsson 30-Oct-14 1:40am    
This should give you a clue: "An operation on a socket could not be performed because the system lacked sufficient buffer space or because a queue was full".

Maybe you send data that is never consumed or the consumer is too slow for the send rate.
Ami_Modi 30-Oct-14 1:47am    
But this never happened before. Encountered for first time. If data is not consumable than I would have got this error before also.
George Jonsson 30-Oct-14 2:18am    
I wrote "data that is never consumed" not "not consumable", but that is semantics.

If this is the first time, what has changed? Don't answer "nothing" cause something has obviously changed. It could be more data to store, the table structure has been changed so it takes longer time to store data, the script has been changed so connections are opened but never closed, threading has been introduced on the client side.
(And do reply to the comment instead of adding a new comment if you want an answer)
Ami_Modi 30-Oct-14 2:31am    
I have made change by using Parallel.for(). Is it that every time I will get this error or it occurs occasionally?
George Jonsson 30-Oct-14 3:38am    
Well, I don't know your code or your system, so it is impossible for me to answer.
If you have made changes to the code, then you need to analyze what you have done that changed the execution behavior.
Most likely you are creating new resources such as MySqlConnection in your paralell flow, but you never close or dispose the connection. But that is just a guess.

1 solution

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900