Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thin mode connection to standby database failed with TypeError on _MAX_OPEN_CURSORS #294

Closed
theo-fokkinga opened this issue Feb 9, 2024 · 5 comments
Labels
bug Something isn't working patch available

Comments

@theo-fokkinga
Copy link

After upgrading from oracledb 1.4.2 to 2.1.0b1, thin mode connections to a physical standby database opened MOUNTED fail with a TypeError.

Connections using thick mode work fine. Thin mode connections to a primary database opened READ WRITE are fine, but when opened MOUNTED the same issue.

  1. What versions are you using?

Database version: 19.21.0.0.0

platform.platform: Linux-5.4.17-2136.327.2.el7uek.x86_64-x86_64-with-glibc2.17
sys.maxsize > 2**32: True
platform.python_version: 3.9.18
oracledb.version: 2.1.0b1

  1. Is it an error or a hang or a crash?

Error

  1. What error(s) or behavior you are seeing?

When calling the connect() function to connect to a standby database:
oracledb.connect(dsn=connect_string, user=username, password=password, mode=mode)

The following error occurs:

Traceback (most recent call last):
  File "/eco/mounts/eco_orabackup1/users/fokkingats/python_tests/test_oracledb_set_connectparams2.py", line 23, in <module>
    oracledb.connect(dsn=connect_string, user=username, password=password, mode=mode)
  File "/home/fokkingats/.local/lib/python3.9/site-packages/oracledb-2.1.0b1-py3.9-linux-x86_64.egg/oracledb/connection.py", line 1149, in connect
    return conn_class(dsn=dsn, pool=pool, params=params, **kwargs)
  File "/home/fokkingats/.local/lib/python3.9/site-packages/oracledb-2.1.0b1-py3.9-linux-x86_64.egg/oracledb/connection.py", line 523, in __init__
    impl.connect(params_impl)
  File "src/oracledb/impl/thin/protocol.pyx", line 376, in oracledb.thin_impl.Protocol._process_message
  File "src/oracledb/impl/thin/connection.pyx", line 372, in oracledb.thin_impl.ThinConnImpl.connect
  File "src/oracledb/impl/thin/connection.pyx", line 338, in oracledb.thin_impl.ThinConnImpl._connect_with_params
  File "src/oracledb/impl/thin/connection.pyx", line 319, in oracledb.thin_impl.ThinConnImpl._connect_with_description
  File "src/oracledb/impl/thin/connection.pyx", line 292, in oracledb.thin_impl.ThinConnImpl._connect_with_address
  File "src/oracledb/impl/thin/protocol.pyx", line 315, in oracledb.thin_impl.Protocol._connect_phase_two
  File "src/oracledb/impl/thin/protocol.pyx", line 397, in oracledb.thin_impl.Protocol._process_message
  File "src/oracledb/impl/thin/protocol.pyx", line 376, in oracledb.thin_impl.Protocol._process_message
  File "src/oracledb/impl/thin/messages.pyx", line 309, in oracledb.thin_impl.Message.process
  File "src/oracledb/impl/thin/messages.pyx", line 187, in oracledb.thin_impl.Message._process_message
  File "src/oracledb/impl/thin/messages.pyx", line 1577, in oracledb.thin_impl.AuthMessage._process_return_parameters
TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType'

This refers to the line

    self.conn_impl._max_open_cursors = \
        int(self.session_data.get("AUTH_MAX_OPEN_CURSORS"))

For testing purposes I changed this as follows, and then connections are established without the TypeError:

   self.conn_impl._max_open_cursors = \
       int(self.session_data.get("AUTH_MAX_OPEN_CURSORS", 100))
  1. Does your application call init_oracle_client()?

No, the error occurs only in thin mode. In thick mode no errors.

  1. Include a runnable Python script that shows the problem.
import oracledb

username = "sys"
password = "change_on_install"
mode = oracledb.AUTH_MODE_SYSDBA
connect_string = "standby-host.oracle.com:1521/stby_db"

oracledb.connect(dsn=connect_string, user=username, password=password, mode=mode)
@anthony-tuininga
Copy link
Member

I discussed this internally and thick mode uses the value 0, so I have adjusted thin mode to do the same. If you are able to build from source you can verify that it works for you, too.

@theo-fokkinga
Copy link
Author

theo-fokkinga commented Feb 13, 2024

Great, I tested with the latest source and the issue is resolved. Thanks for your quick response!

@maciej-markowski
Copy link

Hi, the same error is thrown when trying to connect to ASM instance, when using oracledb 2.0.1 installed through pip.
I also tested with latest source and it resolves this issue.
When can we expect this changes to be released and installable through pip?

@anthony-tuininga
Copy link
Member

A new release should be available "soon". We are doing internal testing right now so I can't say exactly when but it should be within the next week or so. Thank you for your patience!

@anthony-tuininga
Copy link
Member

This patch was included in version 2.1.0 which was just released.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working patch available
Projects
None yet
Development

No branches or pull requests

3 participants