My favorites | Sign in
Project Home Downloads Wiki
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 98: This query makes pyodbc segfault
1 person starred this issue and may be notified of changes. Back to list
Status:  Complete
Owner:  ----
Closed:  Sep 2010


 
Reported by nickreta...@gmail.com, Apr 20, 2010
What steps will reproduce the problem?
1. Run a long-running query
2. Run the query "select * from v_monitor.sessions" in another process

What is the expected output? What do you see instead?
I expected it to fetch rows from the sessions table.  Instead, it segfaults.  If I add a small limit to the query, it doesn't segfault, but all the 
rows it outputs are unintelligible garbage that looks like this:

(u'21-42 85:3449', u'vpadmnd00', u'vri', u'1.63.0:15', u'21-41 32:6711', u'vr0-et92:x', u'21-42 85:1878', u'0', u'UkonTn ', u'21-42 
85:1810', 0L, 29L, u'', u'Nn', u'Pswr')

What version of the product are you using? On what operating system?
'2.1.7-beta0' on CentOS with Python  2.6.4
vertica_3.5.9_odbc_3.5_unixodbc_x86_64_linux.so

Please provide any additional information below.
I don't think this is a problem with the vertica drivers.  This query works fine in isql, which uses the same drivers.  Below is the exact script 
I used to cause the segfault.  Be sure to kick off some long running query with another python script first: there has to be an existing 
session or you wont see the segfault.

import pyodbc
connection = pyodbc.connect('DSN=vert')
cursor = connection.cursor()
cursor.execute("""select * from v_monitor.sessions""")
rows = cursor.fetchall() # SEGMENTATION FAULT
print repr(rows) # GARBAGE
Apr 20, 2010
#1 nickreta...@gmail.com
Friend showed me how to get a stack trace with gdb.  Here it is:

#0  0x00002aaaafbf3661 in GetDataString (cur=0x8408d0, iCol=<value optimized out>) at /tmp/pyodbc-2.1.7/src/getdata.cpp:188
#1  0x00002aaaafbf389a in GetData (cur=0x918940, iCol=1) at /tmp/pyodbc-2.1.7/src/getdata.cpp:585
#2  0x00002aaaafbee12a in Cursor_fetch (cur=0x8408d0) at /tmp/pyodbc-2.1.7/src/cursor.cpp:977
#3  0x00002aaaafbee1f8 in Cursor_fetchlist (cur=0x8408d0, max=-1) at /tmp/pyodbc-2.1.7/src/cursor.cpp:1009
#4  0x00002aaaaab9c6a3 in call_function (f=0x693570, throwflag=<value optimized out>) at Python/ceval.c:3690
#5  PyEval_EvalFrameEx (f=0x693570, throwflag=<value optimized out>) at Python/ceval.c:2389
#6  0x00002aaaaab9dc4f in PyEval_EvalCodeEx (co=0x2aaaaaf44648, globals=<value optimized out>, locals=<value optimized out>, args=0x0, argcount=0, kws=0x0, kwcount=0, 
    defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2968
#7  0x00002aaaaab9dc92 in PyEval_EvalCode (co=0x918940, globals=0x8c8, locals=0x4cc) at Python/ceval.c:522
#8  0x00002aaaaabc1401 in run_mod (fp=0x692dc0, filename=0x7fffffffebc7 "segfault.py", start=<value optimized out>, globals=0x63bf50, locals=0x63bf50, closeit=1, 
    flags=0x7fffffffe8a0) at Python/pythonrun.c:1335
#9  PyRun_FileExFlags (fp=0x692dc0, filename=0x7fffffffebc7 "segfault.py", start=<value optimized out>, globals=0x63bf50, locals=0x63bf50, closeit=1, flags=0x7fffffffe8a0)
    at Python/pythonrun.c:1321
#10 0x00002aaaaabc16c4 in PyRun_SimpleFileExFlags (fp=<value optimized out>, filename=0x7fffffffebc7 "segfault.py", closeit=1, flags=0x7fffffffe8a0) at Python/pythonrun.c:931
#11 0x00002aaaaabccdcc in Py_Main (argc=<value optimized out>, argv=0x7fffffffe9c8) at Modules/main.c:599
#12 0x0000003bfc21d994 in __libc_start_main () from /lib64/libc.so.6
#13 0x0000000000400629 in _start ()
Apr 21, 2010
Project Member #2 mkleehammer
OK, that's fantastic.  I'll look at that.

I'm pretty sure I need to port the 3.1 Unicode support back to the 2.1.x branch.  I'm going to make a v2unicode 
branch to test with.  Did you build your own?  If so, I'll let you know when the branch is ready and you can try to 
reproduce it.

Status: Started
Labels: -Priority-Medium Priority-High
Apr 21, 2010
#3 nickreta...@gmail.com
I just installed it with `pip install pyodbc`, which compiles it automatically.
Apr 23, 2010
#4 nickreta...@gmail.com
Is there another branch I should be using?
Apr 28, 2010
#5 nickreta...@gmail.com
Some information from Vertica Help:

Regarding the odd error message you reported.  This is a result of
mismatching the character sizes between the connection and the
application, e.g. by the setting of WideCharSizeOut and WideCharSizeIn
in the connection parameters.

What is displayed in your case is every other character of the string.
Your reported odd string said:

Err nai eso Dfra

E.r.r. .n.a.i. .e.s.o. .D.f.r.a.
Error: Invalid Session ID format
Sep 6, 2010
Project Member #6 mkleehammer
Can you test this with 2.1.8?  I believe I've fixed the Unicode issues.

Sep 7, 2010
#7 nickreta...@gmail.com
Sorry, I don't work on this project anymore.
Sep 7, 2010
Project Member #8 mkleehammer
(No comment was entered for this change.)
Status: Fixed
Nov 21, 2010
Project Member #9 mkleehammer
(No comment was entered for this change.)
Status: Complete

Powered by Google Project Hosting