-1

I'm executing following python code to connect to remote DB server, I can see the syscalls getting timed out at the following location, so it take unusually high time to connect to the DB. How ever after like 10 seconds script connects to the DB and return the results. Checked the same connection with node js, and there is no indication of the futex() sys call time out. So the issue is only with the python code, what can be the cause for this?

import cx_Oracle

dsn_tns=cx_Oracle.makedsn('dbhost','port',service_name='SERVICENAME')
conn = cx_oracle.connect(user=r'USER_NAME',password='******',dsn=dsn_tns)
c = conn.cursor()
c.execute("""SIMPLE SELECT QUERY""")
for row in c;
    print (row[0],'-',row[1])
conn.close

Code executed to investiage the issue

strace python3.6 dbtest.py

Syscall where time out happend

futex(0x56413124c9c8, FUTEX_WAIT_BITSET_PRIVATE|FUTEX_CLOCK_REALTIME, 0, {tv_sec+1671793111, tv_nsec=5000000}, FUTEX_BITSET_MATCH_ANY) = -1 ETIMEOUT (Connection timed out)
user1672382
  • 87
  • 1
  • 10
  • What code do you expect to wake up the futex? – Joseph Sible-Reinstate Monica Dec 24 '22 at 20:26
  • sorry im not sure what the sucess code should be , what I see here is, the python to db connecting process just hang here and after some time it is getting completed. – user1672382 Dec 25 '22 at 15:51
  • 1
    Did you compare node-oracledb and cx_Oracle using the exact same machine and exact same service name and exact same Oracle client libraries? What is in your "client" sqlnet.ora file? Also, don't forget to upgrade cx_Oracle: see the [release announcement](https://cjones-oracle.medium.com/open-source-python-thin-driver-for-oracle-database-e82aac7ecf5a). – Christopher Jones Jan 09 '23 at 04:22
  • Thanks for the help , It seems the issue was with the cx_oracle library ( doesn't work even after upgrade) Then I have used oracledb library and the issue sorted `python3.6 -m pip install -U pip setuptools , python3.6 -m pip install oracledb` – user1672382 Jan 20 '23 at 08:45

1 Answers1

0

It seems the issue was with the cx_oracle library ( doesn't work even after upgrade) Then I have used oracledb library and the issue sorted , Installation steps used,

python3.6 -m pip install -U pip setuptools 
python3.6 -m pip install oracledb


user1672382
  • 87
  • 1
  • 10