title: Hard to debug "Mysql server has gone away"
body: <p>I'm running a MsAccess with Mysql background database and today I am experiencing some problems. </p>
  
  <p>Depending on how far I can get into the program I am able to get a list of all the names and entry. But once I go into the edit form of any entry I get a variety of results. Sometimes I am lucky and I can see the first entry. But any entry after that will always get a MsAccess error: <strong>Object invalid or no longer set</strong> and then any subsequent calls after will yield a Mysql ODBC error of <strong>Mysql server has gone away.</strong></p>
  
  <p>I've looked around at several websites and even all the stack overflow sites with the same question and I've tried a variety of solutions. (Keep in mind that this database has been running for years and this is the first time I am getting this message) It also takes about 2m14s to 2m59s before it displays any error messages.</p>
  
  <p>Here is what I tried so far:</p>
  
  <ol>
  <li>I've tried changing a few of the ODBC connection settings. 
  <ul>
  <li>Checked Allow Big Results - <strong>FAILED</strong></li>
  <li>Checked Enable Auto Reconnect - <strong>FAILED</strong></li>
  </ul></li>
  <li>I've Checked and repaired tables - <strong>FAILED</strong>
  <ul>
  <li>A good number of tables resulted in, "table needs update please repair table"</li>
  </ul></li>
  <li>I've Doubled the numbers in the my.cnf configuration and restarted the mysql service as well as the msaccess software. <strong>FAILED</strong>
  <ul>
  <li>These were the settings of my my.cnf after I made the changes.</li>
  </ul></li>
  </ol>
  
  <p>Here:</p>
  
  <pre><code>set-variable = max_connections=500
  safe-show-database
  log-error=/var/log/mysqld.log
  connect_timeout=1000
  interactive_timeout=28800
  wait_timeout=288000          &lt;**This was changed**
  
  join_buffer_size=6M
  key_buffer_size=300M         &lt;**THIS WAS CHANGED **
  max_allowed_packet=300M      &lt;**THIS WAS CHANGED **
  myisam_sort_buffer_size=300M &lt;**THIS WAS CHANGED **
  read_buffer_size=6M
  sort_buffer_size=6M
  table_cache=12288
  thread_cache_size=24
  tmp_table_size=132M
  query_cache_limit=3M
  query_cache_size=64M
  query_cache_type=1
  </code></pre>
  
  <p>Basically I've tried every suggestion I could find so far and I can't seem to figure out the problem.  </p>
  
  <p>I've also had a look at <a href="http://dev.mysql.com/doc/refman/5.0/en/gone-away.html" rel="nofollow">MYSQL: Has gone away</a>
  If I go through the bulleted list there</p>
  
  <ul>
  <li>Nobody has killed the running thread</li>
  <li>I don't think the query was ran after the connection was closed (since it ran for years fine)</li>
  <li>Client application does have the privileges needed</li>
  <li><strong>I don't know how to figure out if I had a timeout from the TCP/IP connection on client side</strong></li>
  <li><strong>I don't know if I've encounted a timeout on the server side, but I do know that automatic reconnection in client is disabled</strong></li>
  <li>???</li>
  <li>The query could potentially be large since it is a form with many subforms</li>
  <li>???</li>
  <li>DNS should be ok, since I can connect to it with a real sql viewer (HeidiSQL)</li>
  <li>???Child forks???</li>
  <li>???</li>
  </ul>
  
  <p>I think this is one of those bugs that is hard to figure out since I'm exhausted :/ I'm probably missing some info but I am not sure what else to include.</p>
  
  <p>---EDIT---</p>
  
  <p>Thank you all for your comments, I'm still debugging this issue. It seems that it's not all the forms that are causing some issues. So I'm starting to think that this is a MSAccess issue more than it is an MySql issue. The forms that do break all have the same line in their VBA code: </p>
  
  <pre><code>Private Sub Form_Error(DataErr As Integer, Response As Integer)
      If Screen.ActiveControl.Name = "UnboundTextBox" Then
         Response = acDataErrContinue
      End If
  End Sub
  </code></pre>
  
  <p>I don't recall putting this code in, so I assume it's an automatic thing, but I'm still going through all my forms to see which ones cause this error and which do not. So more in a few. </p>
  
  <p>---Today I'm doing some debugging trying to find whatever I can from whatever log I can muster ----</p>
  
  <pre><code> MSACCESS        17ec-b10   EXIT  SQLStatisticsW  with return code -1 (SQL_ERROR)
      HSTMT               0AF82920
      WCHAR *             0x00000000 [      -3] &lt;empty string&gt;
      SWORD                       -3 
      WCHAR *             0x00000000 [      -3] &lt;empty string&gt;
      SWORD                       -3 
      WCHAR *             0x0013AAE8 [      -3] "location\ 0"
      SWORD                       -3 
      UWORD                        1 &lt;SQL_INDEX_ALL&gt;
      UWORD                        0 &lt;SQL_QUICK&gt;
  
      DIAG [08S01] [MySQL][ODBC 3.51 Driver][mysqld-5.0.92-community]Lost   
   connection to MySQL server during query (2013) 
  </code></pre>
  
  <p>----------------------------- FINAL EDIT --------------------------</p>
  
  <p>The past week or so, my boss has been working hard to install a new internal server for our office. We also switched IPs several times and ISP providers. Turns out, as a result he created for me an administrative nightmare, as I attempted to debug issues with the server, and issues with the software ect.. ect.. when the issue was in the settings the ISP providers established with the router settings etc... etc... SO basically this whole headache was nothing wrong with server, nor software but hardware inbetween. </p>
  
  <p>So now, I have to backwards engineer everything I did and try to get it to work on both ips. It works on the important one now. But it's not working on the old one so... I guess I just have to figure that out. [Waving imaginary fist in the air] Lol</p>