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.
Here's some code replicating the issue:
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)
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.
We have tried upgrading several libs, and that didn't fix the issue. Versions:
- Microsoft SQL Server: 12.00.2000 (latest)
- Python: 2.7.6
- pyodbc: 3.0.10 (latest)
- unixODBC: 2.2.14p2-5ubuntu5, 2.3.0, 2.3.4 (latest)
- MS ODBC driver for RedHat: 11.0.1790.0, 11.0.2270.0 (latest)
To add here, Java code performing the same steps works fine.
Any ideas?