mkleehammer / pyodbc

Python ODBC bridge
https://github.com/mkleehammer/pyodbc/wiki
MIT No Attribution
2.95k stars 563 forks source link

SIG_ABRT trying to connect to MSSQL #1252

Closed sshevlyagin closed 1 year ago

sshevlyagin commented 1 year ago

Environment

Issue

I get a SIG_ABRT trying to connect when running example code

Code

import pydodbc
cnxn = pyodbc.connect('DRIVER={ODBC Driver 18 for SQL Server};SERVER='+server+';UID='+username+';PWD='+password)
crsr = cnxn.cursor()
rows = crsr.execute("select @@VERSION").fetchall()
print(rows)
crsr.close()
cnxn.close()

Crash Report

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               Python [80110]
Path:                  /opt/homebrew/*/Python.framework/Versions/3.11/Resources/Python.app/Contents/MacOS/Python
Identifier:            org.python.python
Version:               3.11.4 (3.11.4)
Code Type:             ARM-64 (Native)
Parent Process:        zsh [74180]
Responsible:           stable [1166]
User ID:               503

Date/Time:             2023-08-14 13:48:40.7263 -0700
OS Version:            macOS 13.5 (22G74)
Report Version:        12
Anonymous UUID:        FC5E7E51-090A-D613-3E43-3F0A0B1950CA

Sleep/Wake UUID:       D00D6341-8CB0-466E-BAE2-6FD0E6EE1CD3

Time Awake Since Boot: 13000 seconds
Time Since Wake:       1080 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000

Termination Reason:    Namespace SIGNAL, Code 6 Abort trap: 6
Terminating Process:   Python [80110]

Application Specific Information:
stack buffer overflow

Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_kernel.dylib                 0x184568764 __pthread_kill + 8
1   libsystem_pthread.dylib                0x18459fc28 pthread_kill + 288
2   libsystem_c.dylib                      0x1844adb74 __abort + 128
3   libsystem_c.dylib                      0x18449e640 __stack_chk_fail + 96
4   pyodbc.cpython-311-darwin.so           0x1031072f8 GetErrorFromHandle(Connection*, char const*, void*, void*) + 360
5   pyodbc.cpython-311-darwin.so           0x103107144 RaiseErrorFromHandle(Connection*, char const*, void*, void*) + 16
6   pyodbc.cpython-311-darwin.so           0x1030fffe4 Connection_New(_object*, bool, bool, long, bool, _object*, Object&) + 1248
7   pyodbc.cpython-311-darwin.so           0x10310cc60 mod_connect(_object*, _object*, _object*) + 1000
8   Python                                 0x1033b29e4 cfunction_call + 60
9   Python                                 0x10336af68 _PyObject_MakeTpCall + 128
10  Python                                 0x103443238 _PyEval_EvalFrameDefault + 40652
11  Python                                 0x103438828 PyEval_EvalCode + 168
12  Python                                 0x10348a044 run_eval_code_obj + 84
13  Python                                 0x103489fa8 run_mod + 112
14  Python                                 0x103489de8 pyrun_file + 148
15  Python                                 0x10348983c _PyRun_SimpleFileObject + 268
16  Python                                 0x1034891cc _PyRun_AnyFileObject + 216
17  Python                                 0x1034a5070 pymain_run_file_obj + 220
18  Python                                 0x1034a49b0 pymain_run_file + 72
19  Python                                 0x1034a4290 Py_RunMain + 704
20  Python                                 0x1034a53c8 Py_BytesMain + 40
21  dyld                                   0x184247f28 start + 2236
v-chojas commented 1 year ago

Can you check if 4.0.30 works, and 4.0.31 crashes? Or otherwise narrow down between which two versions this started happening?

sshevlyagin commented 1 year ago

Got it to crash on 4.0.30 and a few versions in between. My suspicion is something might have broken with unixodbc 2.3.12, but I have no idea how to downgrade that.

v-chojas commented 1 year ago

If you installed unixodbc via Homebrew, you can try to install e.g. unixodbc@2.3.11 for that version. If they did not have versioned formula, then you'll need to compile and install it manually.

sshevlyagin commented 1 year ago

Thanks @v-chojas, I've spent an hour messing around with the make commands and I can't get it to work :/ Let's see if anyone else has seen this issue

sshevlyagin commented 1 year ago

Just tested this on another Apple M1 and it worked fine. Something is borked on my main machine. 😭