irods / python-irodsclient

A Python API for iRODS
Other
62 stars 72 forks source link

setting connection_timeout is not dependable #569

Open d-w-moore opened 2 weeks ago

d-w-moore commented 2 weeks ago

Presently, as of v2.0.1, it is unreliable to set connection_timeout on a session , ie. it does not predictably translate to altering connection timeouts under that session:

Running the following script:

import itertools,uuid
from irods.test.helpers import make_session

def _print_conn(conn):
  sk = conn.socket
  print ('\t%016x'%id(conn), 'tmo =',sk.gettimeout())

def _print_session_connections(s,msg=''):
  print ('---',msg)
  for c in itertools.chain(s.pool.idle, s.pool.active):
    _print_conn(c)

sess = make_session( # test_server_version = False
       )

C1,C2 = ['/tempZone/home/rods/{}'.format(uuid.uuid4()) for _ in range(2)]

try:
    _print_session_connections(sess, msg = 'at session init')

    sess.connection_timeout = 660

    sess.collections.create(C1)
    _print_session_connections(sess, msg = 'after create')

    sess.collections.move(C1,C2)
    _print_session_connections(sess, 'after rename')
finally:
    for c in (C1,C2):
        try:
            sess.collections.remove(c)
        except:
            pass

gives us something like this output:

--- at session init
    00007ff3287ee0d0 tmo = 120.0
--- after create
    00007ff3287ee0d0 tmo = 120.0
--- after rename
    00007ff3287ee0d0 tmo = 120.0

We would expect (based on reasonable convention, as well as on explicit documentation) after connection_timeout is set to 660, to see the values change, but they do not.