PCAS: ENUM string table cache is not updated on DBE_PROPERTY updates
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
EPICS Base |
Fix Released
|
Medium
|
Unassigned | ||
3.14 |
Fix Released
|
Medium
|
Ralph Lange | ||
3.15 |
Fix Released
|
Medium
|
Ralph Lange | ||
3.16 |
Fix Released
|
Medium
|
Unassigned |
Bug Description
From Wang Xiaoqiang (PSI) <xiaoqiang.wang _AT_ psi.ch>:
TL;DR: When DBE_PROPERTY event is posted in a PCAS application for an Enum typed PV, the client will be noticed but with the stale state strings.
I have create an enum typed PV “MTEST:ENUM", initially with two states [ZERO, ONE], in a PCAS(py) application.
Then this is how I expand it to 3 states and send the DBE_PROPERTY event.
// pseudo code, only to show the sequence
dd = app_table.
dd[gddAppTypeIn
dd[gddAppTypeIn
myPV.postEvent(
One the client, I put a monitor with type DBR_GR_ENUM and mask DBE_PROPERTY, and print the states string in the callback.
# a.py
def valueCB(epicsArgs, userArgs):
print(
chan1 = CaChannel(
chan1.searchw()
chan1.add_
chan1.flush_io()
while True:
time.sleep(2)
The result is that the callback is called for the property change event, but the state string remains the same.
$ python a.py
('ZERO', 'ONE')
('ZERO', 'ONE’)
If I then run “caget -d DBR_GR_ENUM MTEST:ENUM”, it does print the changed state strings.
However if I load such a mbbo record into IOC,
record(mbbo, "MTEST:ENUM")
{
field (ZRST, "ZERO")
field (ONST, "ONE")
}
and change the state string with "dbpf MTEST:ENUM.TWST TWO”, the client will receive the event with the changed state strings.
$ python a.py
('ZERO', 'ONE')
('ZERO', 'ONE', 'TWO’)
I have doubted the PCASpy implementation. So I tested the above mbbo record through the ca-gateway(2.1.0), the result is consistent with the PCASpy application. It receives the event but with the stale state strings.
The test is with Base 3.14.12.5.
A suggested patch from Wang Xiaoqiang (PSI) <xiaoqiang.wang _AT_ psi.ch>:
I seem to find some clue.
The bug that is reported on launchpad can be worked around by creating a gdd of gddAppType_ dbr_ctrl_ double type and filling in the meta properties. This has to been do even if there is only a value update.
The bug with the enum typed PV is because casPVI caches the enum string table and only refresh it when PV gets created. So I implemented a fix to update this table during the call of postEvent. /github. com/xiaoqiangwa ng/epics- base/commit/ 3ca62daa6045d12 cc7e71284885309 310e9a062e
https:/
After these two changes, the DBE_PROPERTY event is properly received by client with updated meta property.
The test I used is here https:/ /github. com/paulscherre rinstitute/ pcaspy/ blob/master/ example/ dynamic_ property. py
Changing “MTEST:CHANGE” will cause MTEST:ENUM states and MTEST:RAND high alarm limit to change. And this change can be monitored from a client.
$ caput MTEST:CHANGE 3
$ python a.py
('ONE', 'TWO')
('ZERO', 'ONE', 'TWO')