-
Notifications
You must be signed in to change notification settings - Fork 562
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
segfault on Linux / unixODBC when calling "use" statement, master only; 4.0.30 is fine #858
Comments
Please provide an ODBC trace. That will better show exactly where it faults. Also note that latest version of msodbcsql is 17.7 , which has fixed several bugs since 13.x. |
right, forgot about those. When the trace is turned on, the output includes an additional message:
file is attached, seems like it just generally has more logging turned on. |
I ran a quick test on Travis, but I was unable to reproduce the segfault. Calling |
crashes w/ 17 me also. tracefile attached |
here's the good tracefile with 4.0.30, it seems quite different |
diffing the two files it looks like the error one is calling into SQLGetDiagRecW, which I'd assume it does when it wants to get an error code, then the "DIAG" message says, "DIAG [01000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Changed database context to 'test'.", then that's the end of transmission. the "good" one doesn't call this and goes into SQLRowCount etc. and does normal cursor close / transaction end stuff. -[ODBC][1911305][1611978199.268275][SQLExecDirectW.c][456]
+[ODBC][1910737][1611978093.975701][SQLExecDirectW.c][456]
Exit:[SQL_SUCCESS_WITH_INFO]
-[ODBC][1911305][1611978199.268319][SQLGetDiagRecW.c][535]
+[ODBC][1910737][1611978093.975791][SQLRowCount.c][173]
Entry:
- Statement = 0x1656d80
- Rec Number = 1
- SQLState = 0x7fff9eb831f4
- Native = 0x7fff9eb831e8
- Message Text = 0x7fff9eb83200
- Buffer Length = 10239
- Text Len Ptr = 0x7fff9eb831e6
- DIAG [01000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Changed database context to 'test'.
-
+ Statement = 0x17fa530
+ Row Count = 0x7fff99f48140
left side ends here, right side continues on with normal transaction close things
|
I am able to reproduce this issue on Oracle Linux Server 8.3.
When it fails, the tail end of the ODBC trace is:
|
I too am able to reproduce this segmentation fault on CentOS 8.3. As part of the new "messages" attribute functionality I introduced recently, there are more calls to SQLGetDiagRecW after each SQL execution. Although this appears to work on Windows and Ubuntu, it clearly does not work on other Linux distributions. I'm going to see if I can figure out why this is happening (although to be honest I'm no C++ guru). If I can't find a fix, and nobody else can, then I think I'm going to have to disable this "messages" functionality on all Unix platforms. Sorry about this @zzzeek , bear with me. FYI, it looks like Kleehammer might have had issues in the past with SQLGetDiagRecW on Fedora. Here's a comment in the code about it: |
@keitherskine we're great! I run DBAPI git masters/main on my Jenkins server so we can catch these things before the DBAPIs are released. No rush here as long as you don't release with the bug :) |
Well Fedora 8 is eons ago, but if we want to call this a bug in Fedora itself I can raise this within Red Hat (where I happen to work!) if we want to raise this with the unixODBC package and we can get a good self-contained reproducer I can shop it around internally. |
A fix should be on the way, @zzzeek . PR 859 has been raised. The issue was nothing to do with Fedora in the end, it was just my code. Nevertheless, many thanks indeed for checking this build and raising the issue. |
#859 works for me on Oracle Linux Server 8.3:
|
Many thanks for testing this on Oracle Linux, Gord! |
bump ? |
You can try the fix here: #859 |
I'm fine with the fix I just am waiting for it to be merged to master. our CI runs against DBAPI git masters. |
FYI @zzzeek , the fix for this issue has been merged to master. Feel free to run your CI against the latest pyodbc. |
Fixed in #859 |
Environment
Python: Python 3.8.3 (default, May 23 2020, 16:34:37)
[GCC 9.3.1 20200408 (Red Hat 9.3.1-2)] on linux
pyodbc: 4.0.31b51 from 7c7b1b1
ODBC headers / devel libs (Fedora 33):
unixODBC-2.3.9-1.fc33.x86_64
unixODBC-devel-2.3.9-1.fc33.x86_64
OS:
uname -a
Linux photon3 5.10.8-200.fc33.x86_64 unicode parameters on pyodbc -> unixodbc -> freetds #1 SMP Sun Jan 17 19:53:01 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux
DB:
Centos packages:
mssql-server-14.0.3356.20-23.x86_64
mssql-tools-17.6.1.1-1.x86_64
mssql-server-fts-14.0.3356.20-23.x86_64
driver: msodbcsql 13.1.9.2
Issue
SQLAlchemy's test suite needs to use the "use" statement during a setup process in order to create a schema in a certain database. Building with latest master produces a segfault with the program below. I can do a source build against the 4.0.30 tag and that one is fine.
output:
The text was updated successfully, but these errors were encountered: