portable CA server uses wrong application type for alarm acknowledgement

Bug #541305 reported by Jeff Hill
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
EPICS Base
Fix Released
Medium
Andrew Johnson

Bug Description

The portable server was observed to be using the wrong application type when the client was attempting to acknowledge an alarm.

Additional information:
Thanks to Shifu Xu for providing a patch.

Original Mantis Bug: mantis-272
    http://www.aps.anl.gov/epics/mantis/view_bug_page.php?f_id=272

Tags: cas 3.14
Revision history for this message
Jeff Hill (johill-lanl) wrote :

I am testing this patch.

Index: casStrmClient.cc
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/cas/generic/casStrmClient
.cc,v
retrieving revision 1.92.2.10
diff -c -r1.92.2.10 casStrmClient.cc
*** casStrmClient.cc 21 Mar 2005 23:57:28 -0000 1.92.2.10
--- casStrmClient.cc 2 Oct 2006 15:47:34 -0000
***************
*** 2047,2059 ****
        if ( type == aitEnumInvalid ) {
                return S_cas_badType;
        }
-
      aitEnum bestExternalType = this->ctx.getPV()->bestExternalType ();
!
! gdd * pDD = new gddScalar ( gddAppType_value, bestExternalType );
! if ( ! pDD ) {
! return S_cas_noMemory;
! }

      //
      // copy in, and convert to native type, the incoming data
--- 2047,2058 ----
        if ( type == aitEnumInvalid ) {
                return S_cas_badType;
        }
      aitEnum bestExternalType = this->ctx.getPV()->bestExternalType ();
! aitUint16 app = gddDbrToAit[pHdr->m_dataType].app;
! gdd * pDD = new gddScalar ( app, bestExternalType );
! if ( ! pDD ) {
! return S_cas_noMemory;
! }

      //
      // copy in, and convert to native type, the incoming data
cvs diff: Diffing mt
cvs diff: Diffing st

edited on: 2006-10-02 09:49

Revision history for this message
Jeff Hill (johill-lanl) wrote :

Testing this revised patch.

Index: casStrmClient.cc
===================================================================
RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/cas/generic/casStrmClient.cc,v
retrieving revision 1.92.2.11
diff -c -u -w -b -i -r1.92.2.11 casStrmClient.cc
cvs diff: conflicting specifications of output style
--- casStrmClient.cc 2 Oct 2006 15:53:52 -0000 1.92.2.11
+++ casStrmClient.cc 4 Oct 2006 18:35:56 -0000
@@ -2043,13 +2043,24 @@
  if ( pHdr->m_dataType >= NELEMENTS(gddDbrToAit) ) {
   return S_cas_badType;
  }
+
+ // a primitive type matching the atomic DBR_XXX type
  aitEnum type = gddDbrToAit[pHdr->m_dataType].type;
  if ( type == aitEnumInvalid ) {
   return S_cas_badType;
  }
- aitEnum bestExternalType = this->ctx.getPV()->bestExternalType ();
+
+ // the application type best maching this DBR_XXX type
     aitUint16 app = gddDbrToAit[pHdr->m_dataType].app;
- gdd * pDD = new gddScalar ( app, bestExternalType );
+
+ // When possible, preconvert to best external type in order
+ // to reduce problems in the services
+ aitEnum bestWritePrimType =
+ app == gddAppType_value ?
+ this->ctx.getPV()->bestExternalType () :
+ type;
+
+ gdd * pDD = new gddScalar ( app, bestWritePrimType );
   if ( ! pDD ) {
    return S_cas_noMemory;
   }

Revision history for this message
Jeff Hill (johill-lanl) wrote :

And testing this change so that arrays are covered for completeness even
though arrays are inappropriate when acking an alarm

RCS file: /net/phoebus/epicsmgr/cvsroot/epics/base/src/cas/generic/casStrmClient.cc,v
retrieving revision 1.92.2.12
diff -c -u -w -b -i -r1.92.2.12 casStrmClient.cc
cvs diff: conflicting specifications of output style
--- casStrmClient.cc 4 Oct 2006 18:49:29 -0000 1.92.2.12
+++ casStrmClient.cc 4 Oct 2006 20:40:22 -0000
@@ -2124,7 +2124,17 @@

     aitEnum bestExternalType = this->ctx.getPV()->bestExternalType ();

- gdd * pDD = new gddAtomic(gddAppType_value, bestExternalType, 1, pHdr->m_count);
+ // the application type best maching this DBR_XXX type
+ aitUint16 app = gddDbrToAit[pHdr->m_dataType].app;
+
+ // When possible, preconvert to best external type in order
+ // to reduce problems in the services
+ aitEnum bestWritePrimType =
+ app == gddAppType_value ?
+ this->ctx.getPV()->bestExternalType () :
+ type;
+
+ gdd * pDD = new gddAtomic( app, bestWritePrimType, 1, pHdr->m_count);
  if ( ! pDD ) {
   return S_cas_noMemory;
  }
@@ -2158,7 +2168,7 @@
  // will be allowed to ref the DD
  //
     caStatus status = S_cas_noConvert;
- gddStatus gddStat = aitConvert ( bestExternalType,
+ gddStatus gddStat = aitConvert ( bestWritePrimType,
         pData, type, this->ctx.getData(),
         pHdr->m_count, &this->ctx.getPV()->enumStringTable() );
     if ( gddStat >= 0 ) {

Revision history for this message
Andrew Johnson (anj) wrote :

Original bug has been fixed in R3.14.9.

Revision history for this message
Andrew Johnson (anj) wrote :

R3.14.9 Released.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.