Page 1 of 1

Bug Report - Phidget22Python: Intermittent timeout when using openWaitForAttachment()

Posted: Wed Mar 28, 2018 1:32 pm
by mofahead
Hi,

Using the new to v22 python library, connecting our interfacekit 0/16/16 (v605) sometimes hangs on openWaitForAttachment(), resulting in a timeout exception. Doesn't seem to happen using the C lib directly, nor was happening with the v21 python library.

The timeout happens equally with DigitalInput and DigitalOutput, and it doesn't seem to matter the timeout value given or if a delay is added between calls.

With the following minimal demo code (open and close all 16 output channels) we can see the error about every 10 runs so so:

Code: Select all

import time
from Phidget22.Devices.DigitalOutput import DigitalOutput
from Phidget22.PhidgetException import PhidgetException

def open(ch):
    try:
        ch.openWaitForAttachment(5000)
        return True
    except PhidgetException as e:
        print("*** Couldn't open:", end=" ")
        print("Exception %i: %s" % (e.code, e.details), end=" *** ")
        close(ch)

def close(ch):
    try:
        ch.close()
    except PhidgetException as e:
        print("Couldn't close channel:", end=" ")
        print("Exception %i: %s" % (e.code, e.details))
    del(ch)
    print("Closed.")

def open_and_close_channel(ch_num):
    ch = DigitalOutput()
    ch.setChannel(ch_num)
    print("Opening output", ch_num, end="... ", flush=True)
    if open(ch):
        print("Open.", end=" ")
        close(ch)

for n in range(16):
    open_and_close_channel(n)
    time.sleep(.1) # changing the delay doesn't make a difference
A failing run looks like this:

Code: Select all

Opening output 0... Open. Closed.
Opening output 1... Open. Closed.
Opening output 2... Open. Closed.
Opening output 3... Open. Closed.
Opening output 4... Open. Closed.
Opening output 5... Open. Closed.
Opening output 6... Open. Closed.
Opening output 7... Open. Closed.
Opening output 8... Open. Closed.
Opening output 9... Open. Closed.
Opening output 10... Open. Closed.
Opening output 11... Open. Closed.
Opening output 12... *** Couldn't open: Exception 3: Timed Out *** Closed.
Opening output 13... Open. Closed.
Opening output 14... Open. Closed.
Opening output 15... Open. Closed.

Re: Bug Report - Phidget22Python: Intermittent timeout when using openWaitForAttachment()

Posted: Thu Mar 29, 2018 12:02 pm
by mofahead
Forgot to mention, the base system is Ubuntu 16.04 (64-bit).

Re: Bug Report - Phidget22Python: Intermittent timeout when using openWaitForAttachment()

Posted: Tue Apr 03, 2018 2:18 pm
by Patrick
I've been able to reproduce. Looking into it now.

-Patrick

Re: Bug Report - Phidget22Python: Intermittent timeout when using openWaitForAttachment()

Posted: Fri Apr 06, 2018 4:12 pm
by Patrick
Fixed. Releasing new library now.

-Patrick

Re: Bug Report - Phidget22Python: Intermittent timeout when using openWaitForAttachment()

Posted: Tue May 29, 2018 2:01 pm
by aho
Hi Patrick,

I think that I'm hitting a similar bug and wanted to make sure that I'm picking up your bug fix. I'm assuming that you just changed the Phidget Python library and not the C library?

Cheers

Code: Select all

>>> Phidget22.Phidget.Phidget.getLibraryVersion()
'Phidget22 - Version 1.0.0 - Built May  2 2018 19:19:13'
>>>