pythonoracle-databaseredhatsystem-callsfutex

futex() syscall timed out during python trying to connect remote oracle db


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)

Solution

  • 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