You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to replicate similar functionality to how a forward link works in a traditional IOC using p4p.client.thread.Context.put in the handler for a PV however, I've run into an issue with this not always working depending on the order in which PVs are created. A simple example of the problem is:
The idea is that if I do a put to DEV:RW:DOUBLE5 this then triggers a put to DEV:RW:DOUBLE1. However, if I do a put to DEV:RW:DOUBLE5 (from another terminal) the server gives this error:
Unexpected
Traceback (most recent call last):
File "/home/myuser/.local/lib/python3.10/site-packages/p4p/client/thread.py", line 362, in put
value, i = done.get(timeout=timeout)
File "/usr/lib/python3.10/queue.py", line 179, in get
raise Empty
_queue.Empty
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/home/myuser/.local/lib/python3.10/site-packages/p4p/server/thread.py", line 19, in _on_queue
M(*args)
File "/mnt/c/Users/mysuser/Software/p4p_for_isis/examples/basic_server_recipe-testing.py", line 40, in put
ctxt.put(put_pv,{})
File "/home/myuser/.local/lib/python3.10/site-packages/p4p/client/thread.py", line 365, in put
raise TimeoutError()
TimeoutError
Error from WorkQueue w/ functools.partial(<function _on_queue at 0x7f771b1bca60>, <p4p._p4p.ServerOperation object at 0x7f771b1b3be0>, <bound method MyHandlerWithPut.put of <__main__.MyHandlerWithPut object at 0x7f771b1ec7f0>>, SharedPV(value=0), <p4p.server.raw.ServOpWrap object at 0x7f771b1eca30>)
Traceback (most recent call last):
File "/home/myuser/.local/lib/python3.10/site-packages/p4p/util.py", line 56, in handle
callable()
File "/home/myuser/.local/lib/python3.10/site-packages/p4p/server/thread.py", line 27, in _on_queue
op.done(error=str(err))
File "src/p4p/_p4p.pyx", line 888, in p4p._p4p.ServerOperation.done
ValueError: Must provide error message
The odd thing is the above code works if I change the link to point to any of the other pvs (e.g. DEV:RW:DOUBLE2). This also works if I create another pv between pv1 and pv5. Diggging about in the code I found that I can fix this by changing the number of workers defined in the __init__ method of the class _DefaultWorkQueue in p4p.util, i.e. if I use def __init__(self, workers=5):
It looks like this problem occurs for the specific configuration of having 5 pvs in a row with the last one linking to the first. I'm not sure if this is a bug or if there is a different way to call a put to a pv from within a handler. This issue may also be related to #144
The text was updated successfully, but these errors were encountered:
I'm trying to replicate similar functionality to how a forward link works in a traditional IOC using
p4p.client.thread.Context.put
in the handler for a PV however, I've run into an issue with this not always working depending on the order in which PVs are created. A simple example of the problem is:The idea is that if I do a put to
DEV:RW:DOUBLE5
this then triggers a put toDEV:RW:DOUBLE1
. However, if I do a put toDEV:RW:DOUBLE5
(from another terminal) the server gives this error:The odd thing is the above code works if I change the link to point to any of the other pvs (e.g.
DEV:RW:DOUBLE2
). This also works if I create another pv between pv1 and pv5. Diggging about in the code I found that I can fix this by changing the number of workers defined in the__init__
method of the class_DefaultWorkQueue
inp4p.util
, i.e. if I usedef __init__(self, workers=5):
It looks like this problem occurs for the specific configuration of having 5 pvs in a row with the last one linking to the first. I'm not sure if this is a bug or if there is a different way to call a put to a pv from within a handler. This issue may also be related to #144
The text was updated successfully, but these errors were encountered: