Re: [cx-oracle-users] Segmentation fault in Python 3 - Cursor - chained exceptions
Brought to you by:
atuining
From: Boris D. <bor...@gm...> - 2014-05-14 12:28:12
|
Thank you for the quick response. Do you already have any plans, when will new version be released ? 2014-05-13 23:17 GMT+02:00 Anthony Tuininga <ant...@gm...>: > Thanks for the simple program to demonstrate the problem. :-) I have just > pushed a change to the source that resolves this issue. Apparently in > Python 3 the first time the exception is referenced it is not normalized > and so the error object I am creating is immediately accessible. The second > level of exception results in a normalized exception which means that it > can't be accessed in the same way. Fortunately the normalization can be > forced so that I can access the error object the same way each time. A > subtle and rare bug so I appreciate the pointer! > > Anthony > > > On Tue, May 13, 2014 at 1:15 AM, Boris Dzuba <bor...@gm...>wrote: > >> Hi all, >> >> The following test program gives a segmentation fault: >> >> C:\>python >> Python 3.3.3 (v3.3.3:c3896275c0f6, Nov 18 2013, 21:19:30) [MSC v.1600 64 >> bit (AMD64)] on win32 >> Type "help", "copyright", "credits" or "license" for more information. >> >>> import cx_Oracle >> >>> c=cx_Oracle.connect(<connect string>).cursor() >> >>> try: >> ... c.execute("select") >> ... except: >> ... try: >> ... c.execute("select") >> ... except: >> ... pass >> ... >> >> C:\> >> >> Access Violation >> Faulting application name: python.exe >> Fault offset: 0x000000000000cacd >> >> >> Platform: 64bit, Win7, Oracle Client 11g (11.2.0.1.0), python 3.3.3, >> cx_Oracle 5.1.2 >> >> >> >> At a guess, the problem is because in the function >> Cursor_SetErrorOffset() /Cursor.c/: >> >> static void Cursor_SetErrorOffset( >> udt_Cursor *self) // cursor to get the error offset >> from >> { >> PyObject *type, *value, *traceback; >> udt_Error *error; >> >> PyErr_Fetch(&type, &value, &traceback); >> if (type == g_DatabaseErrorException) { >> error = (udt_Error*) value; >> OCIAttrGet(self->handle, OCI_HTYPE_STMT, &error->offset, 0, >> OCI_ATTR_PARSE_ERROR_OFFSET, >> self->environment->errorHandle); >> } >> PyErr_Restore(type, value, traceback); >> } >> >> OCIAttrGet() call attempts to write a value to the address >> /&error->offset/, >> therefore after the end of an allocated memory block of the borrowed >> pointer /PyObject *value/ >> >> typedef struct { >> PyObject_HEAD >> sb4 code; >> ub4 offset; >> PyObject *message; >> const char *context; >> } udt_Error; >> >> >> Commenting it out /* OCIAttrGet(self->handle, OCI_HTYPE_STMT, >> &error->offset, 0, OCI_ATTR_PARSE_ERROR_OFFSET, >> self->environment->errorHandle);*/ >> fix this crash! >> >> >> Regards, >> Boris >> >> >> ------------------------------------------------------------------------------ >> "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE >> Instantly run your Selenium tests across 300+ browser/OS combos. >> Get unparalleled scalability from the best Selenium testing platform >> available >> Simple to use. Nothing to install. Get started now for free." >> http://p.sf.net/sfu/SauceLabs >> _______________________________________________ >> cx-oracle-users mailing list >> cx-...@li... >> https://lists.sourceforge.net/lists/listinfo/cx-oracle-users >> >> > > > ------------------------------------------------------------------------------ > "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE > Instantly run your Selenium tests across 300+ browser/OS combos. > Get unparalleled scalability from the best Selenium testing platform > available > Simple to use. Nothing to install. Get started now for free." > http://p.sf.net/sfu/SauceLabs > _______________________________________________ > cx-oracle-users mailing list > cx-...@li... > https://lists.sourceforge.net/lists/listinfo/cx-oracle-users > > |