EPICS Controls Argonne National Laboratory

Experimental Physics and
Industrial Control System

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

Subject: [Bug 2029482] Re: pvget json error
From: Andrew Johnson via Core-talk <core-talk at aps.anl.gov>
To: core-talk at aps.anl.gov
Date: Sat, 05 Aug 2023 22:20:35 -0000
The version of yajl that comes with Base 7.0.6.1 and later can generate
JSON5 which handles infinities and NaN values, but it looks like the
pvAccess code in pvget isn't enabling that option in the print
formatter. Applying the following patch to modules/pvData should fix it:

diff --git a/src/factory/printer.cpp b/src/factory/printer.cpp
index 928fc4f..31f7116 100644
--- a/src/factory/printer.cpp
+++ b/src/factory/printer.cpp
@@ -404,6 +404,9 @@ std::ostream& operator<<(std::ostream& strm, const PVStructure::Formatter& forma
     if(format.xfmt==PVStructure::Formatter::JSON) {
         JSONPrintOptions opts;
         opts.multiLine = false;
+#if EPICS_VERSION_INT>=VERSION_INT(7,0,6,1)
+        opts.json5 = true;
+#endif
         printJSON(strm, format.xtop, format.xshow ? *format.xshow : BitSet().set(0), opts);
         strm<<'\n';
         return strm;

Given that this is actually a bug against pvDataCPP I have filed an
issue against that module on GitHub referring to this bug report:
https://github.com/epics-base/pvDataCPP/issues/92

** Bug watch added: github.com/epics-base/pvDataCPP/issues #92
   https://github.com/epics-base/pvDataCPP/issues/92

** Changed in: epics-base
       Status: New => Triaged

** Changed in: epics-base
   Importance: Undecided => Medium

** Also affects: epics-base/7.0
   Importance: Medium
       Status: Triaged

-- 
You received this bug notification because you are a member of EPICS
Core Developers, which is subscribed to EPICS Base.
Matching subscriptions: epics-core-list-subscription
https://bugs.launchpad.net/bugs/2029482

Title:
  pvget json error

Status in EPICS Base:
  Triaged
Status in EPICS Base 7.0 series:
  Triaged

Bug description:
  I’ve been using `pvget -M json` and have noticed a problem with it
  when the PV has the alarm fields set like so:

  double lowAlarmLimit nan
  double lowWarningLimit nan
  double highWarningLimit nan
  double highAlarmLimit nan

  When I run pvget I get the following:

  > pvget -M json IOC:m1.RBV
  IOC:m1.RBV {"value":88.129999999999995,"alarm":{"severity":0,"status":0,"message":"NO_ALARM"},"timeStamp":{"secondsPastEpoch":1691063460,"nanoseconds":182366000,"userTag":0},"display":{"limitLow":-100.0,"limitHigh":100.0,"description":"motor 1","units":"degrees","precision":5,"form":{"index":0,"choices":["Default","String","Binary","Decimal","Hex","Exponential","Engineering"]}},"control":{"limitLow":-100.0,"limitHigh":100.0,"minStep":0.0},"valueAlarm":{"active":false,"lowAlarmLimit"Error in monitor handler : yajl_gen_invalid_number

  It looks like YAJL doesn’t like the nan values. If I set them to non-
  nan values then the error goes away.

  This is with base 7.0.7.

To manage notifications about this bug go to:
https://bugs.launchpad.net/epics-base/+bug/2029482/+subscriptions


References:
[Bug 2029482] [NEW] pvget json error Matt Clarke via Core-talk

Navigate by Date:
Prev: Build failed: EPICS Base 7 base-7.0-983 AppVeyor via Core-talk
Next: Re: What is the next step for RTEMS and EPICS? Does a small (virtual) workshop make sense? Chris Johns 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  <20232024 
Navigate by Thread:
Prev: [Bug 2029482] [NEW] pvget json error Matt Clarke via Core-talk
Next: [Bug 2029482] Re: pvget json error Matt Clarke 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  <20232024 
ANJ, 06 Aug 2023 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·