EPICS Home

Experimental Physics and Industrial Control System


 
2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024  Index 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Small bug in 3.16
From: Andrew Johnson <[email protected]>
To: "Shankar, Murali" <[email protected]>, EPICS core-talk <[email protected]>
Date: Thu, 18 Feb 2016 10:45:04 -0600
Hi Murali,

On 02/17/2016 06:32 PM, Shankar, Murali wrote:
> We are starting to use 3.16 for
> LCLS-II development and I ran into a small bug that would core dump when
> doing a caget SOME:PV:NAME.[0:10]​. I have attached the patch; it does
> fix this issue and "make runtests" passes after this change.

Unfortunately I don't think your fix is correct, but I suspect I have
already found the problem (I've been working on creating a regression
test for the bug) and developed a fix for it — please undo your changes
and try the attached patch instead. This fix will be applied to the 3.15
branch as well as to 3.16.

> Would you
> know where the documentation for these server side filters is? Should I
> expect "caput SOME:PV:NAME.[2] 1​" to work?

Unfortunately server-side filters currently only work on gets and
monitors, not on puts, so no you cannot do a put to an individual
element of an array. This limitation is not documented anywhere that I
remember, although it should be. You can find some documentation for the
built-in filters in base-3.16/html/filters.html but I don't think the
individual filters currently explain which ones work on which operations
(get/put/monitor).

Ralph — am I right that there is no way for filters to support puts at
the moment? I get a seg-fault trying to do a sub-array put even with my
current patch, so that needs fixing. Should we try to support this? The
documentation for each filter should at least say what operations it
does support.

- Andrew


> $ bzr diff src/ioc/db/dbAccess.c
> === modified file 'src/ioc/db/dbAccess.c'                              
> --- src/ioc/db/dbAccess.c       2015-09-07 04:15:21 +0000              
> +++ src/ioc/db/dbAccess.c       2016-02-17 23:42:01 +0000
> @@ -878,7 +878,7 @@
>              if (pfl->type == dbfl_type_val)
>                  localAddr.pfield = (char *) &pfl->u.v.field;
>              else
> -                localAddr.pfield = (char *)  pfl->u.r.field;
> +                localAddr.pfield = (char *) &pfl->u.r.field;
>              status = dbFastGetConvertRoutine[field_type][dbrType]
>                  (localAddr.pfield, pbuf, &localAddr);
>          }
> 

-- 
There are only two hard problems in distributed systems:
  2. Exactly-once delivery
  1. Guaranteed order of messages
  2. Exactly-once delivery
 -- Mathias Verraes
=== modified file 'src/ioc/db/dbAccess.c'
--- src/ioc/db/dbAccess.c	2015-09-07 04:15:21 +0000
+++ src/ioc/db/dbAccess.c	2016-02-12 18:58:45 +0000
@@ -813,7 +813,7 @@
     void *pbuffer, long *options, long *nRequest, void *pflin)
 {
     char *pbuf = pbuffer;
-    void *pfieldsave;
+    void *pfieldsave = paddr->pfield;
     db_field_log *pfl = (db_field_log *)pflin;
     short field_type;
     long no_elements;
@@ -829,9 +829,18 @@
     if (!pfl || pfl->type == dbfl_type_rec) {
         field_type  = paddr->field_type;
         no_elements = paddr->no_elements;
+
+        /* Update field info from record */
+        if (paddr->pfldDes->special == SPC_DBADDR &&
+            (prset = dbGetRset(paddr)) &&
+            prset->get_array_info) {
+            status = prset->get_array_info(paddr, &no_elements, &offset);
+        } else
+            offset = 0;
     } else {
         field_type  = pfl->field_type;
         no_elements = pfl->no_elements;
+        offset = 0;
     }
 
     if (field_type >= DBF_INLINK && field_type <= DBF_FWDLINK)
@@ -849,21 +858,6 @@
         return S_db_badDbrtype;
     }
 
-    /* For SPC_DBADDR fields, the rset function
-     * get_array_info() is allowed to modify
-     * paddr->pfield.  So we store the original
-     * value and restore it later.
-     */
-    pfieldsave = paddr->pfield;
-
-    /* Update field info */
-    if (paddr->pfldDes->special == SPC_DBADDR &&
-        (prset = dbGetRset(paddr)) &&
-        prset->get_array_info) {
-        status = prset->get_array_info(paddr, &no_elements, &offset);
-    } else
-        offset = 0;
-
     if (offset == 0 && (!nRequest || no_elements == 1)) {
         if (nRequest) *nRequest = 1;
         if (!pfl || pfl->type == dbfl_type_rec) {


Replies:
Re: Small bug in 3.16 Shankar, Murali

Navigate by Date:
Prev: Re: Build failed in Jenkins: epics-base-3.16-mac-test #42 Andrew Johnson
Next: Re: Small bug in 3.16 Shankar, Murali
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: Jenkins build is back to normal : epics-base-3.16-mac-test #43 APS Jenkins
Next: Re: Small bug in 3.16 Shankar, Murali
Index: 2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  <20162017  2018  2019  2020  2021  2022  2023  2024