Hi
Matteo,
Executive Summary:
=================
I believe that you have found a bug. There are at least four permutations using these abbreviations new gateway (NGW),
old gateway (OGW), new CAS server library (NCAS), and old CAS server library (OCAS).
{NGW, NCAS} (no bug)
{OGW, NCAS} (bug, probably your situation, and bad old behavior not updating clients when write notify is in progress)
{NGW, OCAS} (probably no bug, but bad old behavior not updating clients when write notify is in progress)
{OGW, OCAS} (no bug)
I created bug entry 944188, and you could also easily patch this issue yourself, but I recommend instead that you upgrade
to the latest version of the gateway (which will also resolve your issue and fix the old gateway behavior
wrt write notify). To verify that you have the older version of the gateway check to see if it is implementing the
writeNotify virtual function.
Detailed explanation:
=================
First some background info.
When inspecting
casdef.h (defining the interface between the server and services) one can see two interfaces
casPV and casChannel. Both of them have a similar virtual functions for implementing read, write, and
writeNotify etc in the service. The
casPV interface was first and it can be used when the PV is client agnostic in the service (its behavior does not change depending on what client is attached). In contrast, the
casChannel interface was added later for services which need to implement a PV that has a behavior which is different depending on what client is attached, or for implementing behavior that requires client specific state variables.
To maintain backwards compatibility the base class casChannel forwards requests such as read, write, or
writeNotify to the interface in
casPV. This happens when the service does not implement a factory for
casChannel derived objects.
Furthermore, in the original
casPV interface there was only a “write” interface. Sometime back we discovered that it was difficult to have a robust implementation of the gateway if the gateway was unable to determine if the CA request was a put, or a put notify.
Therefore, a new writeNotify interface was added so that the gateway could be improved
wrt put notify requests (as I recall the old gateway would stop updating its clients when a put notify request was pending). Of course to maintain backwards compatibility the
writeNotify interface calls the write interface if the service doesn’t implement
writeNotify.
Ok now about resolving your issue.
I believe that
casChannel::writeNotify is forwarding to
casPV::writeNotify. This is a bug. To maintain strict backwards compatibility
casChannel::writeNotify should call
casChannel::write.
Jeff
Hello everybody,
I recompiled the epics gateway with the base.3.14.12. Now if I try to execute a writeNotify I always get the following error in the log file:
Virtual gateVcData::write called for <channel name>
This is an error!
I searched for the source of this error and I found it in the file gateVc.cc (gateway/):
// This is the virtual write function defined in casPV. It should no
// longer be called if casChannel::write is implemented.
caStatus gateVcData::write(const casCtx& ctx, const gdd& dd)
{
fprintf(stderr,"Virtual gateVcData::write called for %s.\n"
" This is an error!\n",name());
return S_casApp_noSupport;
}
This function is actually called by this piece of code in casPV.cc (which is in
epics base/):
//
// casPV::writeNotify()
//
caStatus casPV :: writeNotify (
const casCtx & ctx, const gdd & val )
{
// plumbed this way to preserve backwards
// compatibility with the old interface which
// did not include a writeNotify interface
return this->write ( ctx, val );
}
With the epics base.3.14.8 there was no problem.
Has anyone idea how to solve this problem?
Thank you for your help,
Cheers,
Matteo