paulscherrerinstitute / pcaspy

Portable Channel Access Server in Python
BSD 3-Clause "New" or "Revised" License
32 stars 24 forks source link

same value updates after initialization in pcaspy 0.7.0 #50

Closed xiaoqiangwang closed 6 years ago

xiaoqiangwang commented 6 years ago

From Jameson Graef Rollins https://epics.anl.gov/tech-talk/2017/msg02007.php

I have a trivial test pcaspy IOC (code attached) serving a single channel "TEST:A". After starting the IOC I run camonitor on the channel:

$ camonitor TEST:A
TEST:A                         2017-12-27 19:15:42.991145 0

If I then put the same initial value into the channel...

$ caput TEST:A 0
Old : TEST:A                         0
New : TEST:A                         0

...I see an update:

guard-test> camonitor TEST:A
TEST:A                         2017-12-27 19:15:42.991145 0  
TEST:A                         2017-12-27 19:15:50.661466 0  

Additional puts with the same value show no more spurious updates. So this only happens immediately after initialization.

The test script

#!/usr/bin/env python

import sys
import pcaspy

prefix = 'TEST:'
pvdb = {
    'A': {
        'prec': 0
    },
}

class DummyDriver(pcaspy.Driver):
    pass

server = pcaspy.SimpleServer()
server.createPV(prefix, pvdb)
driver = DummyDriver()

for k in pvdb:
    driver.setParamStatus(k, pcaspy.Severity.NO_ALARM, pcaspy.Severity.NO_ALARM)
driver.updatePVs()

while True:
    server.process(0.1)
jrollins commented 6 years ago

@xiaoqiangwang the patch at a667471 seems to have resolved the double-update-after init issue I was seeing. With that commit I no longer see updates where none should be expected. Thanks!

xiaoqiangwang commented 6 years ago

The patch is released with 0.7.1.