semaphore timeouts on win32
Brought to you by:
cliechti
I use timeouts in my reads for BitPim. Two users have now reported getting an exception:
File "serial\serialwin32.pyo", line 198, in read
error: (121, 'GetOverlappedResult', 'The semaphore
timeout period has expired.')
That line of code is below, in the read function if timeouts are set:
n = win32file.GetOverlappedResult(self.hComPort, self._overlappedRead, 1)
serialwin32.py $Revision is 1.22
Any ideas?
Logged In: YES
user_id=30737
I have just had another user report this. It doesn't happen, much but it does happen.
Logged In: YES
user_id=30737
This was probably a bug in the driver. Doing USB protocol sniffing, I observed that when user level code did a write to the USB device the driver would send a read URB followed by a write URB of the data. In theory that would speed up responses to the write since the read URB was still outstanding, but I think what happened in the end is that the read URB could timeout and the driver would return issues from that rather than what was actually happening in user level code.
In the end I coded a workaround that trapped this particular error code and did timeouts manually (repeatedly do reads until the time period actually expired).