iRods server: rods5.0.2
We have encountered a NetworkException while running scripts that contain queries. To reproduce this issue, please execute the script provided below in the latest PRC version:
import os
import ssl
from irods.session import iRODSSession
from irods.models import DataObject, Collection
from irods.column import Criterion
env_file = os.path.expanduser("~/.irods/irods_environment.json")
ssl_context = ssl.create_default_context(purpose=ssl.Purpose.SERVER_AUTH, cafile=None, capath=None, cadata=None)
ssl_settings = {'ssl_context': ssl_context}
s = iRODSSession(irods_env_file=env_file, **ssl_settings)
col = s.collections.get('/vsc/home/public')
query = s.query(Collection, DataObject)
query.filter(Criterion("=", Collection.name, col.path))
results = [r for r in query] #HERE IS WHERE I GET THE ERROR
print(results)
The result is:
root@aaaed9abf832:/# python3 test.py
Traceback (most recent call last):
File "/usr/local/lib/python3.12/dist-packages/irods/connection.py", line 166, in recv
msg = iRODSMessage.recv(self.socket)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/irods/message/__init__.py", line 346, in recv
rsp_header_size = _recv_message_in_len(sock, 4)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/irods/message/__init__.py", line 251, in _recv_message_in_len
raise socket.error(msg)
OSError: Read 0 bytes from socket instead of expected 4 bytes
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "//test.py", line 21, in <module>
results = [r for r in query]
^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/irods/query.py", line 249, in get_results
for result_set in self.get_batches():
File "/usr/local/lib/python3.12/dist-packages/irods/query.py", line 233, in get_batches
result_set = self.execute()
^^^^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/irods/query.py", line 206, in execute
result_message = conn.recv()
^^^^^^^^^^^
File "/usr/local/lib/python3.12/dist-packages/irods/connection.py", line 177, in recv
raise NetworkException("Could not receive server response")
irods.exception.NetworkException: Could not receive server response
Following an investigation, we initially suspected pam_interactive authentication as the cause however, native authentication also failed. I have since confirmed that the script functions correctly using python-irodsclient==3.1.0, as demonstrated below.
root@aaaed9abf832:/# pip uninstall python-irodsclient --break-system-packages
Found existing installation: python-irodsclient 3.3.0
Uninstalling python-irodsclient-3.3.0:
Would remove:
/usr/local/bin/prc_write_irodsA.py
/usr/local/lib/python3.12/dist-packages/build/lib/irods/*
/usr/local/lib/python3.12/dist-packages/irods/*
/usr/local/lib/python3.12/dist-packages/python_irodsclient-3.3.0.dist-info/*
/usr/local/lib/python3.12/dist-packages/venv313/bin/prc_write_irodsA.py
Proceed (Y/n)? Y
Successfully uninstalled python-irodsclient-3.3.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@aaaed9abf832:/# pip install python-irodsclient==3.1.0 --break-system-packages
Collecting python-irodsclient==3.1.0
Using cached python_irodsclient-3.1.0-py3-none-any.whl.metadata (73 kB)
Requirement already satisfied: PrettyTable>=0.7.2 in /usr/local/lib/python3.12/dist-packages (from python-irodsclient==3.1.0) (3.16.0)
Requirement already satisfied: defusedxml in /usr/local/lib/python3.12/dist-packages (from python-irodsclient==3.1.0) (0.7.1)
Requirement already satisfied: wcwidth in /usr/local/lib/python3.12/dist-packages (from PrettyTable>=0.7.2->python-irodsclient==3.1.0) (0.2.13)
Using cached python_irodsclient-3.1.0-py3-none-any.whl (263 kB)
Installing collected packages: python-irodsclient
Successfully installed python-irodsclient-3.1.0
WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager. It is recommended to use a virtual environment instead: https://pip.pypa.io/warnings/venv
root@aaaed9abf832:/# python3 test.py
[]
We looked into the different versions but aren't exactly sure where the issue is coming from, even though 3.2.0 has some changes related to connections.
iRods server: rods5.0.2
We have encountered a
NetworkExceptionwhile running scripts that contain queries. To reproduce this issue, please execute the script provided below in the latest PRC version:The result is:
Following an investigation, we initially suspected pam_interactive authentication as the cause however, native authentication also failed. I have since confirmed that the script functions correctly using
python-irodsclient==3.1.0, as demonstrated below.We looked into the different versions but aren't exactly sure where the issue is coming from, even though 3.2.0 has some changes related to connections.