Shim session management in SciDB-py. SciDB 18.1

We have a problem in the project with session timeout when using SciDB-py.
In configuration file the session timeout is set to a very big value (timeout=36000), but timeout still happens with the error:

requests.exceptions.HTTPError: 404 Client Error: Session not found for url: ...

So the questions are:

  1. Is there any way to check if the session is still active or not and it should be reconnected using scidbpy.connect()
  2. Is there any way to just close the session when all processing is done and just use connect() function every time when session is needed.

Thank you.

After changing the shim configuration file, please be sure that you restart the shim service for it to pick up the configuration changes. You don’t need to restart SciDB, just the shim.
In your python application, you can dispose of the reference to SciDB and the python garbage collector will disconnect it via the _shim_release_session function. You can then reconnect on the next query.

Thank you for the information.
Could you please give more details about how to use _shim_release_session.
In our project we use multiple sessions at the same time. Each session is allocated as scidbpy.connect()

For example db_sessions[i] = scidbpy.connect() where i changes from 0 to 10.
In this case how can I use _shim_release_session and make sure that I release session number i.
I could not find much information about input parameters for _shim_release_session.
As I understand, i should call it like scidbpy.db._shim_release_session(). So in this case what input parameters should I use to make shoure that I close only one session that I need.

Thank you.

The _shim_release_session is a free function invoked by the DB class finalizer. We intend for the python GC to invoke it after all references to a DB class instance are gone.
In your case, I imagine the array db_sessions is an array of currently active connections to SciDB in your client. If you were to empty a position out after a session was complete, the garbage collector should eventually cleanup the connection to SciDB. Without seeing your code, I can’t say for sure.