-1

I have many users on my web site (2000000 per day) in my database, While fetching data from database im getting above error. I've received "Server is unavailable" errors before, but am now seeing a connection timeout error. I'm not familiar with this - why does it occur and how can I fix it?

   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   --- End of inner exception stack trace ---
   at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
   at MySql.Data.Common.MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   --- End of inner exception stack trace ---
   at MySql.Data.Common.MyNetworkStream.HandleOrRethrowException(Exception e)
   at MySql.Data.Common.MyNetworkStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at MySql.Data.MySqlClient.TimedStream.Read(Byte[] buffer, Int32 offset, Int32 count)
   at System.IO.BufferedStream.Read(Byte[] array, Int32 offset, Int32 count)
   at MySql.Data.MySqlClient.MySqlStream.ReadFully(Stream stream, Byte[] buffer, Int32 offset, Int32 count)
   at MySql.Data.MySqlClient.MySqlStream.LoadPacket()
   at MySql.Data.MySqlClient.MySqlStream.ReadPacket()
   at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32& affectedRow, Int64& insertedId)
   at MySql.Data.MySqlClient.Driver.GetResult(Int32 statementId, Int32& affectedRows, Int64& insertedId)
   at MySql.Data.MySqlClient.Driver.NextResult(Int32 statementId, Boolean force)
   at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
   at MySql.Data.MySqlClient.MySqlCommand.ExecuteReader(CommandBehavior behavior)```

1 Answers1

1

Plenty of reasons:

  1. The query is taking too long to execute. As the tables have increased in size, the queries are getting slower and slower due to bad design. Check if this happens during the execution of a specific query or table to narrow down the investigation area
  2. Network issues. These are errors due to connectivity issues. The network is unstable etc. This should be taken up with your provider or administrator.
  3. Returning huge amount of data. If you try to return millions of rows to the c# callier, it could be that it's taking too long to fetch. Try using paging or limit the rows by selecting the top X rows

It's really very hard to tell, without having some more information, like the query that it's failing, the database schema and indexes for said tables, or the state of your services. The above are the most common cases I've seen.

You can also check for deadlocks and live locks.

Athanasios Kataras
  • 25,191
  • 4
  • 32
  • 61