The VXI-11 lock handling is in general incorrect.
The SocketTimeout is set to a smaller value as the actual requested lock_timeout.
This results into a break of the communication, especially when exclusive locks are used.
The socket timeout has to be set in alignment with lock_timeout (if the called function has it)+ io_timeout (if the called function has it) + "some" extra margin.
To Reproduce
VISANAME = 'TCPIP::192.168.3.2::inst22::INSTR'
import pyvisa as visa
import time
rm = visa.ResourceManager('@py')
dev = rm.open_resource(VISANAME)
dev.lock()
dev2 = rm.open_resource(VISANAME) # expectation: this fails with error 11 after the 10000ms of lock time, however it fails after ~7s with sockettimeout
Wireshark trace:
- Here you see that pyvisa-py requested 10s lock timeout.
- You see that between packet 224 and 227 10s pass. However, pyvisa-py raises an exception "Exception: error creating link: 3" BEFORE the actual 10s lock timeout passed and the reply was sent.
This is just one occurance of that issue. Note: create_link has no flags field, that means there is no waitforlock information. That means the lock timeout of 10s pyvisa-py passes always has to be respected when the device is locked.
I have no immediate bandwidth to provide a PR as this can be a tricky one, but might be able to pick it up at a later stage.
The VXI-11 lock handling is in general incorrect.
The SocketTimeout is set to a smaller value as the actual requested lock_timeout.
This results into a break of the communication, especially when exclusive locks are used.
The socket timeout has to be set in alignment with lock_timeout (if the called function has it)+ io_timeout (if the called function has it) + "some" extra margin.
To Reproduce
Wireshark trace:
This is just one occurance of that issue. Note: create_link has no flags field, that means there is no waitforlock information. That means the lock timeout of 10s pyvisa-py passes always has to be respected when the device is locked.
I have no immediate bandwidth to provide a PR as this can be a tricky one, but might be able to pick it up at a later stage.