DiamondLightSource / aioca

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

Freezes indefinitely using epicscorelibs > 7.0.5.99.1.0a2 #56

Open RJCD-Diamond opened 4 hours ago

RJCD-Diamond commented 4 hours ago

When using newer version of epicscorelibs, it freezes indefinitely when using caget or camonitor. No error messages are shown. Issues seems to come from:

cadef.ca_context_create(1)

Steps To Reproduce

Steps to reproduce the behaviour: python3.11 pip install aioca

Run this script:

script

from aioca import caget, camonitor, run

PV = "BL22I-MO-FSWT-01:YAW.RBV"

async def do_stuff():

    # Print out the value reported by PV2.
    print(await caget(PV,timeout=1))

    # Monitor PV3, printing out each update as it is received.
    def callback(value):
        print('callback', value)

    camonitor(PV, callback)

# Now run the camonitor process until interrupted by Ctrl-C.
run(do_stuff(), forever=True)
AlexanderWells-diamond commented 4 hours ago

Could you please confirm what version(s) of aioca and epicscorelibs you have used for this?

Also, when I try and run your script I get an error that forever is an unrecognised keyword of the asyncio.run() method. Could you please clarify what this function is supposed to be?

RJCD-Diamond commented 2 hours ago

aioca 1.8.1 epicscorelibs = 7.0.7.99.1.1

This script is a modified version of the one in the documentation, with the PVs set to a real PV and the caget omitted. I had not included my imports. I have added them for clarity. The run command seems to be imported from aioca.

https://diamondlightsource.github.io/aioca/main/tutorials/intro.html

Having tested further, and created a new venv. I can no longer get any version of epicscorelibs to not freeze indefinitely

RJCD-Diamond commented 1 hour ago

Through more investigation the non-working venv uses= epicscorelibs/lib/libca.so.7.0.5.99.1, and the working one uses epicscorelibs/lib/libca.so.7.0.1.99.14

I think here are the reasons:

At an earlier point I must had installed 7.0.1.99.14, and then installed newer and newer version. Finding 7.0.5.99.1 to be the final working version.

It seems 7.0.5.99.1 is the last version that is not explicitly using the libca file with the same version number, and so is using an older version, which works.

epicscorelibs > 7.0.5.99.1.0a2 use the libca with same name and version number, hence why they are not working. And newer versions of epicscorelibs have a broken libca.so, which is why they are not working.

Running on RHEL on my workstation

Suggest look into the newer versions of libca.so.7.0.5.99.1, and recompile.