0

I have read the documentation, https://dev.mysql.com/doc/refman/5.7/en/error-lost-connection.html

and it mention that it could be a network connectivity issue. I have also tried, configuring the parameters mentioned in the docs, but still experiencing the issue.

The client is a windows machine, and I tried running Test-Connection [mysqlserverip] -port 3306 and the result seems normal.

How do i investigate the potential network issue between the client and server?

  • I tested running python using the socket module to receive data via tcp, and I sometimes get a timeout error. If possible, I’m looking for data to show that there is indeed a tcp connection issue – Benj Cabalona Jr. May 25 '23 at 12:11
  • Does the query take too long to execute? – Salman A May 25 '23 at 12:35
  • No, only about a minute. – Benj Cabalona Jr. May 25 '23 at 12:39
  • 1
    My guess is that the client, has issues receiving tcp data. How do i prove this? – Benj Cabalona Jr. May 25 '23 at 12:39
  • 3
    One minute is too much for a query, unless you're processing gigabytes of data. Did you read the manual... can you confirm that it is "during query" scenario? – Salman A May 25 '23 at 12:43
  • Processing gigabytes of data - you mean the server is scanning gb of data? Then yes. I can only confirm the during query scenario from the error log because it is there. – Benj Cabalona Jr. May 25 '23 at 13:10
  • Forgot to mention that this is an analytical query (i.e. report data) so one minute is generally fast for my use case – Benj Cabalona Jr. May 25 '23 at 13:10
  • Do you receive the data across a network, store it in memory, then write it to the database? Or what? And how long does each step take? And how many items of data? "Analytical" -- Give us another hint. Is the query running against the _current_ data, or data that was already in the database? – Rick James May 25 '23 at 22:07
  • I'm asking all of these questions because I can see multiple places were the timeout _might_ occur, plus multiple _remedies_ depending on the details. – Rick James May 25 '23 at 22:08
  • Hello, the full architecture is I have a python client application that connects to mySQL reads some data, then dump it as csv. Query is running against existing data. – Benj Cabalona Jr. May 26 '23 at 14:26
  • I have also replicated the issue in mysql workbench. I encountered it just by selecting 2 columns from a table with 2k rows – Benj Cabalona Jr. May 26 '23 at 14:27
  • Oh and btw, i have isolated the issue to the mysql server returning the data to the client. The DBA saw error writing communication packet, and also in a log somewhere that it is stuck on sending to client – Benj Cabalona Jr. May 26 '23 at 14:28
  • I have consulted network team and they told me that the network is fine. – Benj Cabalona Jr. May 26 '23 at 14:29
  • 1
    For handling time consuming queries use a tool like SSDT with MYSQL tools it provides logs as well: https://stackoverflow.com/questions/4235291/how-to-connect-to-a-mysql-data-source-in-visual-studio - only for ETL – Cruzer Jun 01 '23 at 10:06

0 Answers0