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

Async changes break connecting under certain circumstances #288

Closed
jeamland opened this issue Jan 30, 2024 · 3 comments
Closed

Async changes break connecting under certain circumstances #288

jeamland opened this issue Jan 30, 2024 · 3 comments
Labels
bug Something isn't working patch available

Comments

@jeamland
Copy link

  1. What versions are you using?

OCI ADB-S, ORDS version 23.2.3.242.1937

platform.platform: Linux-5.4.17-2136.326.6.el7uek.aarch64-aarch64-with-glibc2.28
sys.maxsize > 2**32: True
platform.python_version: 3.9.18
oracledb.version: 2.0.1

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

Crash.

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

I'm truncating the trace somewhat, but this illustrates the issue:

2024-01-29T23:52:31.39334   File "/seed_bank/lib64/python3.9/site-packages/sqlalchemy/engine/default.py", line 616, in connect
2024-01-29T23:52:31.39335     return self.loaded_dbapi.connect(*cargs, **cparams)
2024-01-29T23:52:31.39335   File "/seed_bank/lib64/python3.9/site-packages/oracledb/connection.py", line 1134, in connect
2024-01-29T23:52:31.39335     return conn_class(dsn=dsn, pool=pool, params=params, **kwargs)
2024-01-29T23:52:31.39335   File "/seed_bank/lib64/python3.9/site-packages/oracledb/connection.py", line 523, in __init__
2024-01-29T23:52:31.39335     impl.connect(params_impl)
2024-01-29T23:52:31.39336   File "src/oracledb/impl/thin/connection.pyx", line 449, in oracledb.thin_impl.ThinConnImpl.connect
2024-01-29T23:52:31.39336   File "src/oracledb/impl/thin/connection.pyx", line 445, in oracledb.thin_impl.ThinConnImpl.connect
2024-01-29T23:52:31.39336   File "src/oracledb/impl/thin/connection.pyx", line 411, in oracledb.thin_impl.ThinConnImpl._connect_with_params
2024-01-29T23:52:31.39337   File "src/oracledb/impl/thin/connection.pyx", line 392, in oracledb.thin_impl.ThinConnImpl._connect_with_description
2024-01-29T23:52:31.39337   File "src/oracledb/impl/thin/connection.pyx", line 365, in oracledb.thin_impl.ThinConnImpl._connect_with_address
2024-01-29T23:52:31.39337   File "src/oracledb/impl/thin/protocol.pyx", line 290, in oracledb.thin_impl.Protocol._connect_phase_two
2024-01-29T23:52:31.39337   File "src/oracledb/impl/thin/protocol.pyx", line 386, in oracledb.thin_impl.Protocol._process_message
2024-01-29T23:52:31.39338   File "src/oracledb/impl/thin/protocol.pyx", line 363, in oracledb.thin_impl.Protocol._process_message
2024-01-29T23:52:31.39338   File "src/oracledb/impl/thin/messages.pyx", line 311, in oracledb.thin_impl.Message.send
2024-01-29T23:52:31.39338   File "src/oracledb/impl/thin/messages.pyx", line 1766, in oracledb.thin_impl.AuthMessage._write_message
2024-01-29T23:52:31.39338 AttributeError: 'oracledb.thin_impl.WriteBuffer' object has no attribute '_socket'
  1. Does your application call init_oracle_client()?

No, we're using Thin mode.

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

That's a bit tricky but I can point out where the problem lies.

In my use case I'm attempting to connect to an ADB-S using IAM tokens. I've implemented a SQLAlchemy dialect that wraps their oracledb dialect and does the IAM parts. I believe that this is leading to enabling some use of authenticated/signed messages In oracledb.thin_impl.AuthMessage._write_message, when self.private_key is set, we attempt to call .getpeername() on the _socket attribute of the WriteBuffer. Unfortunately when the async changes came in that attribute was replaced by a _transport attribute but this code wasn't changed to fit.

@jeamland jeamland added the bug Something isn't working label Jan 30, 2024
@anthony-tuininga
Copy link
Member

Thanks for the report. I'll get that fixed for the next release.

@anthony-tuininga
Copy link
Member

I was able to replicate the issue and resolve it. If you are able to build from source you can verify that it works for you, too.

@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

2 participants