epics-extensions / ca-gateway

Channel Access PV Gateway
http://www.aps.anl.gov/epics/extensions/gateway/
Other
19 stars 18 forks source link

Undefined Timestamp with ca-gateway >= R2-0-6-0 #35

Open hhslepicka opened 3 years ago

hhslepicka commented 3 years ago

Bug Report

Recently at SLAC we started to notice some issues with the Archiver Appliance not properly archiving PVs.

When tracking it down we noticed that some PVs coming through the Gateway were reporting the timestamp as after the first time through the gateway.

We were running the latest from ca-gateway after an upgrade from 2.0.6.0.

Here is how it looks like:

$ EPICS_CA_SERVER_PORT=5124 caget -a KFE:TEST:HUGO:ENUM
KFE:TEST:HUGO:ENUM             <undefined> NO

I was able to isolate the issue once I moved back to 2.0.6.0 and cherry-picked every commit between 2.0.6 and 2.1.0 and testing on every change. The commit that introduces the issue is this one: https://github.com/epics-extensions/ca-gateway/commit/c6dc1597d991e41e96c16402cc4406c3b6b2f998

I am not very familiar with GDD and the ca-gateway but I am trying to investigate the root cause.

Please let me know if you have some insight or guidance or comments that could help me in finding a fix for it. I understand if not since it is a change introduced more than 5 years ago. (I guess folks run some very old gateways =) ).

Thank you!

Steps to Reproduce

Note: camonitor will have the same effect in case you are monitoring from the second host and update the PV via the first. The monitor update will display the new value but undefined for the timestamp.

hhslepicka commented 3 years ago

A little update

If I make so that this condition (https://github.com/epics-extensions/ca-gateway/blob/master/src/gatePv.cc#L1558) is always true, all the problems are gone for timestamps.

If I apply the same "patch" to the latest version of the gateway everything seems to behave properly (at least for my uneducated brain).

By behave properly I mean it didn’t look odd to my tests which were:

I have not tested it with waveforms as they will require some changes on my simple database.

ralphlange commented 3 years ago

Thanks. This is a better place than my inbox. No bad intentions. (Only the best!) But I am pretty snowed in at this moment and may take a while to get to it.

ralphlange commented 3 years ago

If you have some time: you could morph your manual test into a test of the built-in test suite (they are pretty similar). That would help avoiding regressions once it is fixed.

hhslepicka commented 3 years ago

Sorry that I reached out directly.. I should have thought of opening an issue here in the first place but the brain was damaged from GDD and ca-gateway! 😄 Thank you for the reply!

hhslepicka commented 3 years ago

I will give that a try and see if I can make the regression test cover this case.