oracle / python-oracledb

Python driver for Oracle Database conforming to the Python DB API 2.0 specification. This is the renamed, new major release of cx_Oracle
https://oracle.github.io/python-oracledb
Other
308 stars 61 forks source link

Error: Unknown protocol message type 1 at position 10 #235

Closed nikeshkedlaya closed 7 months ago

nikeshkedlaya commented 9 months ago
  1. What versions are you using? 1.4.1
  1. Is it an error or a hang or a crash? Error

  2. What error(s) or behavior you are seeing? Getting below error while calling the procedure but it is intermittent.

    `File "/opt/app/app/orm_dto/tenancy_report_orm.py", line 68, in fetch_all_clients_backup_report
    cursor_obj.callproc("package_name.procedure_name", [
    File "/home/python/.local/lib/python3.9/site-packages/oracledb/cursor.py", line 285, in callproc
    self._call(name, parameters, keyword_parameters)
    File "/home/python/.local/lib/python3.9/site-packages/oracledb/cursor.py", line 118, in _call
    self.execute(statement, bind_values)
    File "/home/python/.local/lib/python3.9/site-packages/oracledb/cursor.py", line 383, in execute
    impl.execute(self)
    File "src/oracledb/impl/thin/cursor.pyx", line 132, in oracledb.thin_impl.ThinCursorImpl.execute
    File "src/oracledb/impl/thin/protocol.pyx", line 420, in oracledb.thin_impl.Protocol._process_single_message
    File "src/oracledb/impl/thin/protocol.pyx", line 421, in oracledb.thin_impl.Protocol._process_single_message
    File "src/oracledb/impl/thin/protocol.pyx", line 381, in oracledb.thin_impl.Protocol._process_message
    File "src/oracledb/impl/thin/protocol.pyx", line 360, in oracledb.thin_impl.Protocol._process_message
    File "src/oracledb/impl/thin/messages.pyx", line 292, in oracledb.thin_impl.Message.process
    File "src/oracledb/impl/thin/messages.pyx", line 848, in oracledb.thin_impl.MessageWithData._process_message
    File "src/oracledb/impl/thin/messages.pyx", line 180, in oracledb.thin_impl.Message._process_message
    File "/home/python/.local/lib/python3.9/site-packages/oracledb/errors.py", line 127, in _raise_err
    raise exc_type(_Error(message)) from cause
    oracledb.exceptions.InternalError: DPY-5000: internal error: unknown protocol message type 1 at position 10`
  1. Does your application call init_oracle_client()? No
cjbj commented 9 months ago

What's the exact DB version? What OS is Python being run on? Can you share SQL to create the PL/SQL procedure & table?

anthony-tuininga commented 9 months ago

It would also be useful to include the last packet sent and the last one received when this error occurs. If you set the environment variable PYO_DEBUG_PACKETS to any value prior to running your script that would be useful. If the packets are large you can e-mail them to me instead of posting here. Hopefully you can provide the PL/SQL procedure and we can replicate it internally.

nikeshkedlaya commented 9 months ago

@cjbj @anthony-tuininga . I have tried making oracle db thick and I could see some errors from database procedure where we connect to different database via dblink. we are verifying that issue. Hopefully the issue is not with oracledb but with database procedure. We can close this issue for now and I will reopen if the error still persists.

anthony-tuininga commented 9 months ago

Thanks, @nikeshkedlaya. The error you reported is a protocol error which I would like to solve, if at all possible! Since in thick mode you seem to be getting an error, that suggests that thin mode isn't handling that scenario correctly. If you are able to help with the detrmination of a solution, great. If you resolve the issue and can't help, just go ahead and close the issue with whatever information you can provide. Thanks!

nikeshkedlaya commented 9 months ago

Same code with thick mode gives below error

ERROR: 2023-09-27 08:39:11,056 [a58747f2-3934-44] tenancy_report_orm.py:87 Exception while calling package_name.procedure_name procedure tofetch backups status for all clients : Traceback (most recent call last):
  File "/opt/app/app/orm_dto/tenancy_report_orm.py", line 68, in fetch_all_clients_backup_report
    cursor_obj.callproc("package_name.procedure_name", [
  File "/home/python/.local/lib/python3.9/site-packages/oracledb/cursor.py", line 285, in callproc
    self._call(name, parameters, keyword_parameters)
  File "/home/python/.local/lib/python3.9/site-packages/oracledb/cursor.py", line 118, in _call
    self.execute(statement, bind_values)
  File "/home/python/.local/lib/python3.9/site-packages/oracledb/cursor.py", line 383, in execute
    impl.execute(self)
  File "src/oracledb/impl/thick/cursor.pyx", line 243, in oracledb.thick_impl.ThickCursorImpl.execute
  File "src/oracledb/impl/thick/utils.pyx", line 431, in oracledb.thick_impl._raise_from_odpi
  File "src/oracledb/impl/thick/utils.pyx", line 421, in oracledb.thick_impl._raise_from_info
oracledb.exceptions.DatabaseError: ORA-03150: end-of-file on communication channel for database link

Only suggestion to the team from. my side is if thin mode also gives the same error as thick mode would be helpful as thick mode is giving the actual error which database is throwing

anthony-tuininga commented 7 months ago

It would indeed be helpful! If you are able to give direction on how to replicate the problem I would be happy to look into it further. I'll close the issue for now.