title: Segfault on 2nd connection with pyodbc to mirrored MS SQL Server
body: <p>I'm facing an issue with a Python script that connects to a mirrored MS SQL server DB. It's throwing a segmentation fault when I try connecting to the DB for the second time. Both the app server and the DB instances are running on Google Compute Engine.</p>
  
  <p>Here's some code replicating the issue:</p>
  
  <pre><code>import pyodbc
  
  params = {
     'autocommit': True,
     'uid': 'myuser',
     'tds_version': '8.0',
     'DRIVER': '{mssql}',
     'pwd': 'mypassword',
     'server': 'sql-server-01',
     'database': 'mydb',
     'port': 1433,
  }
  
  c1 = pyodbc.connect(**params)
  c2 = pyodbc.connect(**params)
  </code></pre>
  
  <p>The first connection (c1) succeeds, but the second connection (c2) fails immediately with segfault. "mydb" is mirrored to a second server (sql-server-02).
  Using a non-mirrored DB, or disabling mirroring for this DB, makes it go away.</p>
  
  <p>We have tried upgrading several libs, and that didn't fix the issue.
  Versions:</p>
  
  <ul>
  <li>Microsoft SQL Server: 12.00.2000 (latest)</li>
  <li>Python: 2.7.6</li>
  <li>pyodbc: 3.0.10 (latest)</li>
  <li>unixODBC: 2.2.14p2-5ubuntu5, 2.3.0, 2.3.4 (latest)</li>
  <li>MS ODBC driver for RedHat: 11.0.1790.0, 11.0.2270.0 (latest)</li>
  </ul>
  
  <p>To add here, Java code performing the same steps works fine.</p>
  
  <p>Any ideas?</p>