dls-controls / aioca

Asynchronous Channel Access client for asyncio and Python using libca via ctypes
Apache License 2.0
6 stars 3 forks source link

Subscriptions using aioca are failing since v1.5 #32

Closed rjwills28 closed 1 year ago

rjwills28 commented 1 year ago

I was testing the Coniql application with the latest version of aioca (v1.5) and have found that the subscriptions using the aioca camonitor are now failing and giving the following error:

~/.local/share/virtualenvs/coniql-dqAdtlIg/lib/python3.8/site-packages/aioca/_catools.py:424: RuntimeWarning: coroutine 'Queue.put' was never awaited
  self.callback(value)

Previous versions of aioca was v1.4 and subscriptions were working there.

To reproduce, install and run the Coniql subscription test which you will now see never completes. pytest -s tests/test_caplugin.py::test_subscribe_ticking

If you would like me to provide a small application demoing this then please just let me know.

coretl commented 1 year ago

Please can you test installing aioca from that branch and see if it fixes things? If so I will make a release

rjwills28 commented 1 year ago

This does fix the subscription issue - thanks!

However I do now get an error when I try to put a list to a waveform PV. Here is the stack trace:

    return await throw_wrapper(*args, **kwargs)
  File "/home/cnuser/.local/share/virtualenvs/coniql-dqAdtlIg/lib/python3.8/site-packages/aioca/_catools.py", line 96, in throw_wrapper
    return await awaitable
  File "/home/cnuser/.local/share/virtualenvs/coniql-dqAdtlIg/lib/python3.8/site-packages/aioca/_catools.py", line 142, in ca_timeout
    result = await asyncio.wait_for(awaitable, timeout)
  File "/usr/local/lib/python3.8/asyncio/tasks.py", line 494, in wait_for
    return fut.result()
  File "/home/cnuser/.local/share/virtualenvs/coniql-dqAdtlIg/lib/python3.8/site-packages/aioca/_catools.py", line 715, in caget
    result = await done.wait()
  File "/home/cnuser/.local/share/virtualenvs/coniql-dqAdtlIg/lib/python3.8/site-packages/aioca/_catools.py", line 54, in wait
    assert self.value, "This should have been set in set()"
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
coretl commented 1 year ago

Sorry, I broke it while trying to fix mypy. I'll fix it properly on monday...

coretl commented 1 year ago

Ok, it should be fixed now, let me know if this works for you

rjwills28 commented 1 year ago

Yes I can confirm that the subscriptions and puts are now working as expected. Thanks for getting it fixed so quickly!