EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: autosave fdbrestore
From: "Pearson, Matthew R." <[email protected]>
To: "[email protected]" <[email protected]>
Cc: "[email protected] list" <[email protected]>
Date: Thu, 13 Nov 2014 15:39:44 +0000
Hi,

I've been trying to use the fdbrestore autosave function to manually restore a .sav file after iocInit. This is because some of the PVs in my application have to be set after some other PVs, which I restore using normal autosave pass0/pass1 restore. 

Would using fdbrestore be an appropriate way to do it? My other solution is to use dbpf statements.

However, I've found a problem using fdbrestore to restore waveform PVs. I get a seg fault, like:

fdbrestore("example_File.sav")
save_restore task: calling do_manual_restore('example_File.sav')
fopen_and_check: checkFile returned 0x7fc2f00b34c0
Segmentation fault (core dumped)

The stack trace is:

(gdb) bt
#0  0x00007fcc0c9c6a6c in oldChannelNotify::getClientCtx (this=0x3) at ../oldAccess.h:441
#1  0x00007fcc0c9c6003 in ca_clear_channel (pChan=0x3) at ../access.cpp:378
#2  0x00007fcc0e3179e8 in do_manual_restore (filename=0x7fcbe94c9af4 "example_File.sav", file_type=1, macrostring=0x0)
    at ../save_restore.c:2775
#3  0x00007fcc0e31208f in save_restore () at ../save_restore.c:1092
#4  0x00007fcc0e56c3ce in start_routine (arg=0x1e65920) at ../../../src/libCom/osi/os/posix/osdThread.c:385
#5  0x000000304c407851 in start_thread () from /lib64/libpthread.so.0
#6  0x0000003a8bce890d in clone () from /lib64/libc.so.6

It seems to be caused by the fact that the waveforms are handled differently than scalers (the function works fine for scalers). For scaler PVs the do_manual_restore function is using channel access to do the put. But it's using database puts for the waveforms. The following patch seems to fix the seg fault:

--- a/asApp/src/save_restore.c
+++ b/asApp/src/save_restore.c
@@ -2768,11 +2768,11 @@ STATIC int do_manual_restore(char *filename, int file_type, char *macrostring)
                                                num_errs++;
                                        }
                                }
+                               if (chanid) ca_clear_channel(chanid);
                        } else {
                                status = SR_array_restore(1, inp_fd, PVname, value_string, 0);
                                if (status) num_errs++;
                        }
-                       if (chanid) ca_clear_channel(chanid);
                } else if (PVname[0] == '!') {
                        n = atoi(value_string); /* value_string actually contains 2nd word of error msg */
                        num_errs += n;



Is there another way to manually restore waveform PVs manually after iocInit?

The dbpf solution works fine. I restore the PV using pass1 autosave restore, then manually reprocess the record. But it means having to have the PV name hard coded into the startup script.

Cheers,
Matt

ps. the .sav file looks like:

# autosave R5.3	Automatically generated - DO NOT MODIFY - 141112-160201
BL99:Det:ADnED:Det1:PixelMapEnable 1
BL99:Det:ADnED:Det1:PixelMapFile.VAL @array@ { "47" "104" "111" "109" "101" "47" "99" "111" "110" "116" "114" "111" "108" "115" "47" "101" "112" "105" "99" "115" "47" "65" "68" "110" "69" "68" "47" "109" "97" "115" "116" "101" "114" "47" "101" "120" "97" "109" "112" "108" "101" "47" "109" "97" "112" "112" "105" "110" "103" "47" "112" "105" "120" "101" "108" "46" "109" "97" "112" "0" }
<END>


Data Acquisition and Control Engineer
Spallation Neutron Source
Oak Ridge National Lab





Replies:
RE: autosave fdbrestore Mooney, Tim M.

Navigate by Date:
Prev: RE: How to perform Loop in VDCT Dalesio, Leo
Next: RE: autosave fdbrestore Mooney, Tim M.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: How to perform Loop in VDCT Mooney, Tim M.
Next: RE: autosave fdbrestore Mooney, Tim M.
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  <20142015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 17 Dec 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·