[cx-oracle-users] curs.bindnames ACESS_VIOLATION crash with cx_Oracle 5.0.3 unicode build on Window
Brought to you by:
atuining
From: Henning v. B. <H.v...@t-...> - 2010-06-17 15:45:03
|
Hi, I am converting an existing application to cx_Oracle 5.0.3 Unicode on Windows with Python 2.6.5. With cx_Oracle 4.4, iso-8859-1 and bytestrings, it worked. Now, with Unicode, it crashes with ACCESS_VIOLATION at the call to curs.bindnames() The database is using NLS_CHARACTERSET='UTF8', NLS_LANG is set to GERMAN_GERMANY.UTF8. curs = conn.cursor() perflog.info("Vor prepare") curs.prepare( u"""begin update BRLRS set STATUS = 'STARTING' , DAT_STATUS = SYSDATE , RESOURCES_USED = 0 , RESOURCES_MAX = 0 where RECO_ID = :RECO_ID and HOST_IP = :HOST_IP and HOST_PORT = :SERVER_PORT ; if SQL%ROWCOUNT = 0 then raise NO_DATA_FOUND; -- LRS ist nicht im Repository eingetragen. end if; end;""") perflog.info("Nach Prepare") try: perflog.info("Vor bindnames") k = curs.bindnames() perflog.info("nach bindnames") except: perflog.error("Exception beim Zugriff auf bindnames") k = [] Note: 1) I do not get any Python exception, but the python process crashes with ACCESS_VIOLATION (exit code -1073741819). The last line in the log output is "Vor bindnames". 2) The connection is from a Session Pool and it's using an InputTypeHandler as follows: conn = dbtools.session_pool.acquire() conn.setupConnection("something") # Code excerpt from dbtools: log = logging.getLogger("main") def uc(val): "UTF8-Strings nach Unicode konvertieren" log.info("uc called for %r", val) if isinstance(val, str): if log.isEnabledFor(logging.DEBUG): log.debug("Conversion necessary from utf-8 to unicode for value %r, called from %s", val, inspect.stack()[1][1:4]) try: return val.decode("utf-8") except: log.exception("Value is not utf-8!") return val.decode("utf-8", errors="replace") return val def InputTypeHandler(cursor, value, numElements): "UTF8-Strings nach Unicode umwandeln" log.info("InputTypeHandler called for %r", value) if isinstance(value, str): try: 1/0 except: log.exception("Conversion from utf-8 to unicode for value=%r", value) return cursor.var(unicode, arraysize=numElements, inconverter=uc) return None def createSessionPool(*args, **kwargs): """ Wrapper zum Erzeugen des Session Pools. """ global session_pool if cx_Oracle.version >= "4.4" and cx_Oracle.version[0].isdigit(): session_pool = cx_Oracle.SessionPool(*args, **kwargs) else: session_pool = DummySessionPool(*args, **kwargs) def setupConnection (conn, threadDescr): """ Schreibt Informationen in die V$SESSION. Setzt außerdem die Session so, dass immer in UTC gerechnet wird. """ conn.inputtypehandler = InputTypeHandler rechnerDescr = u"Bla Bla Bla" curs = conn.cursor() _ = curs.callproc (u"dbms_session.reset_package", tuple()) _ = curs.callproc (u"dbms_application_info.set_module", (u"BlaBla", uc(threadDescr[:32]))) _ = curs.callproc (u"dbms_application_info.set_client_info", (uc(rechnerDescr[:64]), )) _ = curs.execute (u"alter session set TIME_ZONE='+00:00'") curs.close() Any ideas? Henning |