TypeError: cannot convert 'NoneType' object to bytearray when connecting to oracledb server 19.2 in thin mode
server:
Oracle Database 19c Standard Edition 2 Release 19.0.0.0.0 - Production
Version 19.16.0.0.0
client:
>>> print("platform.platform:", platform.platform())
platform.platform: Linux-5.10.0-17-amd64-x86_64-with-glibc2.31
>>> print("sys.maxsize > 2**32:", sys.maxsize > 2**32)
sys.maxsize > 2**32: True
>>> print("platform.python_version:", platform.python_version())
platform.python_version: 3.9.2
>>> print("oracledb.__version__:", oracledb.__version__)
oracledb.__version__: 1.0.3
thats the script:
import oracledb
c = oracledb.connect(user="user", password="mypassword", dsn="servername:1521/orcl")
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/usr/local/lib/python3.9/dist-packages/oracledb/connection.py", line 1000, in connect
return conn_class(dsn=dsn, pool=pool, params=params, **kwargs)
File "/usr/local/lib/python3.9/dist-packages/oracledb/connection.py", line 128, in __init__
impl.connect(params_impl)
File "src/oracledb/impl/thin/connection.pyx", line 294, in oracledb.thin_impl.ThinConnImpl.connect
File "src/oracledb/impl/thin/connection.pyx", line 184, in oracledb.thin_impl.ThinConnImpl._connect_with_params
File "src/oracledb/impl/thin/connection.pyx", line 157, in oracledb.thin_impl.ThinConnImpl._connect_with_description
File "src/oracledb/impl/thin/connection.pyx", line 114, in oracledb.thin_impl.ThinConnImpl._connect_with_address
File "src/oracledb/impl/thin/protocol.pyx", line 218, in oracledb.thin_impl.Protocol._connect_phase_two
File "src/oracledb/impl/thin/protocol.pyx", line 336, in oracledb.thin_impl.Protocol._process_message
File "src/oracledb/impl/thin/protocol.pyx", line 315, in oracledb.thin_impl.Protocol._process_message
File "src/oracledb/impl/thin/messages.pyx", line 281, in oracledb.thin_impl.Message.process
File "src/oracledb/impl/thin/messages.pyx", line 2107, in oracledb.thin_impl.ProtocolMessage._process_message
TypeError: cannot convert 'NoneType' object to bytearray
That looks like some unexpected output from the server is occurring. Can you set the environment variable PYO_DEBUG_PACKETS to any value, rerun your script and put the output here? That should help figure things out. If you have a server side sqlnet.ora file, please indicate its contents here as well. Also, can you try with the parmeter disable_oob set to the value True? There have been some issues with out-of-band break detection. Thanks!
@abma Can you get us the trace?
the oracle listener was configured incorrectly: it had some db server/instance configured which didn't exist.
i can try to reproduce the issue, but this will take a bit.
@abma if you can, we'd love it. Then @anthony-tuininga may be able to squash a bug - even if it is only a missing "can't connect" case that should generate a DPY error.
If you can indicate what the configuration of the listener was before you fixed it, that would also be helpful, as then we can try to reproduce the problem ourselves. :-)
listener.ora:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = ORCL.some.domain)
(ORACLE_HOME = /opt/oracle/product/19c/dbhome_1)
(SID_NAME = ORCL.some.domain)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = server.some.domain)(PORT = 1521)(IP=V4_ONLY))
)
)
and then connect to server.some.domain/ORCL.some.domain
can you provide me a mail address or so, so i can send the trace in private or is this info enough?
You can e-mail me directly at [email protected] (or [email protected]). Both of these e-mail addresses are noted in the Python package information. Thanks!
In the listener.ora configuration above, what was incorrect? What did you have to do to fix it? What error do you get when using the thick driver?
GLOBAL_DBNAME + SID_NAME was incorrect. to fix it i just removed SID_LIST_LISTENER.
i didn't test the thick driver: lsnrctl status says
Instance "ORCL", status UNKNOWN, has 1 handler(s) for this service...
Ok. I'll see if I can reproduce here, but the traces would be very helpful if you are able to provide them. Thanks!
Ok. I am able to reproduce here using the contents of the listener.ora you posted. The thick driver gives the following output, for reference:
Traceback (most recent call last):
File "/home/anthony/git/py-oracledb-oh/t.py", line 9, in <module>
conn = oracledb.connect(DSN)
File "/home/anthony/git/py-oracledb-oh/build/lib.linux-x86_64-3.10/oracledb/connection.py", line 1011, in connect
return conn_class(dsn=dsn, pool=pool, params=params, **kwargs)
File "/home/anthony/git/py-oracledb-oh/build/lib.linux-x86_64-3.10/oracledb/connection.py", line 137, in __init__
impl.connect(params_impl, pool_impl)
File "src/oracledb/impl/thick/connection.pyx", line 385, in oracledb.thick_impl.ThickConnImpl.connect
_raise_from_odpi()
File "src/oracledb/impl/thick/utils.pyx", line 410, in oracledb.thick_impl._raise_from_odpi
_raise_from_info(&error_info)
File "src/oracledb/impl/thick/utils.pyx", line 400, in oracledb.thick_impl._raise_from_info
raise exc_type(error)
oracledb.exceptions.OperationalError: ORA-01034: ORACLE not available
ORA-27101: shared memory realm does not exist
Linux-x86_64 Error: 2: No such file or directory
Additional information: 4775
Additional information: -1450581829
Process ID: 0
Session ID: 0 Serial number: 0
I'll see about adding the necessary code to the thin driver to handle this situation gracefully. Thanks for the report!
I've pushed a patch for this issue. Thanks for your help in resolving it!
Thank you!