Subject: |
[Merge] ~bhill/epics-base:dbLoadSuspendOnError into epics-base:7.0 |
From: |
Bruce Hill via Core-talk <[email protected]> |
To: |
[email protected] |
Date: |
Sat, 27 Apr 2019 06:04:22 -0000 |
Bruce Hill has proposed merging ~bhill/epics-base:dbLoadSuspendOnError into epics-base:7.0.
Commit message:
Adds a dbLoadSuspendOnError variable to suspend st.cmd on dbLoad related errors.
Default is False, no change to current behavior.
Suspends the thread reading the st.cmd file on the following:
* db file syntax errors
* unexpanded macros
* invalid DTYP
* invalid enum name
* DESC or other string fields > 40 char
Requested reviews:
EPICS Core Developers (epics-core)
For more details, see:
https://code.launchpad.net/~bhill/epics-base/+git/epics-base/+merge/366606
Addresses "Stopping IOC boot on failure to load database" suggestion on TechTalk, 4/15/2019.
--
Your team EPICS Core Developers is requested to review the proposed merge of ~bhill/epics-base:dbLoadSuspendOnError into epics-base:7.0.
diff --git a/documentation/RELEASE_NOTES.html b/documentation/RELEASE_NOTES.html
index df78360..5b01720 100644
--- a/documentation/RELEASE_NOTES.html
+++ b/documentation/RELEASE_NOTES.html
@@ -29,6 +29,30 @@ release.</p>
<p>Description</p>
-->
+<h3>Added dbLoadSuspendOnError control</h3>
+
+<p>When loading database files, unexpanded macros and syntax errors can
+result in one or more records not being loaded and a partly broken IOC.
+By setting dbLoadSuspendOnError to a non-zero value before loading the file,
+the IOC will suspend the thread immediately after printing the error
+message or messages. This makes it obvious that there was a problem with
+a db file and makes it easy to see the error messages.</p>
+
+<blockquote><pre>
+var dbLoadSuspendOnError 1 <i>iocsh</i>
+dbLoadSuspendOnError=1 <i>VxWorks</i>
+</pre></blockquote>
+
+<p>Default is 0, no change to current behavior.</p>
+<p>When set to 1, the thread reading the st.cmd file is suspended on the following errors:</p>
+
+<ul>
+<li>db file syntax errors</li>
+<li>unexpanded macros</li>
+<li>invalid DTYP</li>
+<li>invalid enum name</li>
+<li>DESC or other string fields > 40 char</li>
+</ul>
<h1 align="center">EPICS Release 7.0.2.2</h1>
diff --git a/modules/database/src/ioc/dbStatic/dbLexRoutines.c b/modules/database/src/ioc/dbStatic/dbLexRoutines.c
index 9281246..2e09a28 100644
--- a/modules/database/src/ioc/dbStatic/dbLexRoutines.c
+++ b/modules/database/src/ioc/dbStatic/dbLexRoutines.c
@@ -22,6 +22,7 @@
#include "ellLib.h"
#include "epicsPrint.h"
#include "epicsString.h"
+#include "epicsThread.h"
#include "errMdef.h"
#include "freeList.h"
#include "gpHash.h"
@@ -41,6 +42,9 @@
/*global declarations*/
epicsShareDef char *makeDbdDepends=0;
+epicsShareDef int dbLoadSuspendOnError=0;
+epicsExportAddress(int,dbLoadSuspendOnError);
+
epicsShareDef int dbRecordsOnceOnly=0;
epicsExportAddress(int,dbRecordsOnceOnly);
@@ -326,6 +330,9 @@ cleanup:
if(my_buffer) free((void *)my_buffer);
my_buffer = NULL;
freeInputFileList();
+ if(status != 0 && dbLoadSuspendOnError) {
+ epicsThreadSuspendSelf();
+ }
return(status);
}
@@ -354,6 +361,9 @@ static int db_yyinput(char *buf, int max_size)
if (exp < 0) {
fprintf(stderr, "Warning: '%s' line %d has undefined macros\n",
pinputFileNow->filename, pinputFileNow->line_num+1);
+ if(dbLoadSuspendOnError) {
+ epicsThreadSuspendSelf();
+ }
}
}
} else {
@@ -1138,6 +1148,10 @@ static void dbRecordField(char *name,char *value)
epicsPrintf("Can't set \"%s.%s\" to \"%s\" %s\n",
dbGetRecordName(pdbentry), name, value, msg);
yyerror(NULL);
+ if(status != 0 && dbLoadSuspendOnError) {
+ epicsThreadSuspendSelf();
+ }
+ /* TODO: Find other dbLoad* error handling! */
return;
}
}
diff --git a/modules/database/src/ioc/misc/dbCore.dbd b/modules/database/src/ioc/misc/dbCore.dbd
index 51f9c96..d2776bd 100644
--- a/modules/database/src/ioc/misc/dbCore.dbd
+++ b/modules/database/src/ioc/misc/dbCore.dbd
@@ -16,6 +16,7 @@ variable(CASDEBUG,int)
variable(dbJLinkDebug,int)
# Static database access variables
+variable(dbLoadSuspendOnError,int)
variable(dbRecordsOnceOnly,int)
variable(dbRecordsAbcSorted,int)
variable(dbBptNotMonotonic,int)
- Replies:
- Re: [Merge] ~bhill/epics-base:dbLoadSuspendOnError into epics-base:7.0 Martin Konrad via Core-talk
- Re: [Merge] ~bhill/epics-base:dbLoadSuspendOnError into epics-base:7.0 Andrew Johnson via Core-talk
- Navigate by Date:
- Prev:
Jenkins build is still unstable: epics-7.0 » linux32 #116 APS Jenkins via Core-talk
- Next:
Re: ICALEPCS 2019 Contributions Konrad, Martin via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024
- Navigate by Thread:
- Prev:
[Merge] ~info-martin-konrad/epics-base:fix-compiler-warnings into epics-base:3.15 noreply--- via Core-talk
- Next:
Re: [Merge] ~bhill/epics-base:dbLoadSuspendOnError into epics-base:7.0 Martin Konrad via Core-talk
- Index:
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
<2019>
2020
2021
2022
2023
2024
|