Uninett / zinolib

Python library for zino
Apache License 2.0
1 stars 3 forks source link

Too short timeout #67

Open runborg opened 2 weeks ago

runborg commented 2 weeks ago

This is at least in 1.0, not sure if its in 0.9

When code is waiting for response from zino after sending a command it looks like the timeout some times is to short. if zino is busy it could take some seconds to get a reply.

The code failed after 10 sec while waiting.

Traceback (most recent call last):
  File "/home/runarb/src/zinolib-keepalive/zinolib-env/lib/python3.10/site-packages/zinolib/ritz.py", line 381, in _request
    data = self._sock.recv(recv_buffer)
TimeoutError: timed out

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/runarb/src/zinolib-keepalive/./examples/monitor.py", line 106, in <module>
    main()
  File "/home/runarb/src/zinolib-keepalive/./examples/monitor.py", line 58, in main
    cases[i] = sess.get_attributes(i)
  File "/home/runarb/src/zinolib-keepalive/zinolib-env/lib/python3.10/site-packages/zinolib/ritz.py", line 598, in get_attributes
    attrlist = self.get_raw_attributes(caseid)
  File "/home/runarb/src/zinolib-keepalive/zinolib-env/lib/python3.10/site-packages/zinolib/ritz.py", line 577, in get_raw_attributes
    response = self._request(cmd.encode("UTF-8"))
  File "/home/runarb/src/zinolib-keepalive/zinolib-env/lib/python3.10/site-packages/zinolib/ritz.py", line 383, in _request
    raise TimeoutError(
TimeoutError: Timed out waiting for data. command: b'getattrs 179411\r\n' buffer: ''
runborg commented 2 weeks ago

i believe we have the same issue in 0.9 and 1.0 as i've seen Timeout errors in the client when large tings happens in the network. but cannot verify if this is the same issue or not.

runborg commented 2 weeks ago

https://github.com/Uninett/zinolib/blob/b40fd573de220cea6ba3192c862353ff64f5be6c/src/zinolib/ritz.py#L331

This line sets the default timeout to 10sec, i think this timeout is to short because the old tcl server could potentially use over 10sec to deliver a result when it is under load