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  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024  Index 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: LUA: Segmentation fault on Raspberry for IOC being invoked from shell prompt; no problem via gdb execution.
From: "Lang, Keenan C. via Tech-talk" <tech-talk at aps.anl.gov>
To: "tech-talk at aps.anl.gov" <tech-talk at aps.anl.gov>, Kuldeep Joshi <kuldeep.joshi at gmail.com>
Date: Sun, 14 Feb 2021 01:01:33 +0000
Hello Kuldeep,

From your stack trace, the issue is occurring when the record is setting up the input links, which occurs after the point that it would attempt to load the scripts and compile the bytecode.

The line that triggers the error is calling dbNameToAddr which takes a specified PV name and attempts to return a data structure about it. I see that the recommended way of checking the information the record needs was changed between 3.15 and 3.16 to use dbLinkIsConstant/dbLinkIsVolatile. I've updated the code on the master branch to match up with the equivalent code from the calcout record from a more modern version of epics base.

Hopefully, that fixes what is causing the issue.


Keenan Lang

From: Tech-talk <tech-talk-bounces at aps.anl.gov> on behalf of Kuldeep Joshi via Tech-talk <tech-talk at aps.anl.gov>
Sent: Friday, February 12, 2021 6:58 AM
To: tech-talk at aps.anl.gov <tech-talk at aps.anl.gov>
Subject: LUA: Segmentation fault on Raspberry for IOC being invoked from shell prompt; no problem via gdb execution.
 
Hello
I have compiled Epics 7.0.4.1 with SynApps 6-2 on Raspberry PI with Raspberry OS. I am specifying ARCH=linux-arm
I see from the release notes that there can be some build issues for self hosted ARM processors
On building the IOC I notice that the command history is not working. ie I get special characters displayed on arrow key press  (instead of the earlier typed command). readline-common is installed on the PI

The db files in the current working directory are not identified even when the OS PATH variable has ./ in it.
In this case I have to specifically give file/script name as ./filename to dbLoadRecords() calls. This workaround is working successfully.

I tried implementing the LUA script record, which is causing segmentation fault.
Setting the present directory path using epicsEnvSet("LUA_SCRIPT_PATH", "./:./scripts") is not helping.
I suspect the problem is that the file path is not being passed over to the iocsh and hence the problem. When I execute the code via gdb, there is no such problem and the shell executes the lua script and the lua records successfully.
Any pointers will be helpful.

This problem is not occurring on regular Intel PC

Thank you in advance,
Kuldeep Joshi

the core dump backtrace in gdb is below

Using host libthread_db library "/lib/arm-linux-gnueabihf/libthread_db.so.1".
Core was generated by `../../bin/linux-arm/timsAmpA ./st.cmd.tims'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0xb6b7f67c in dbNameToAddr ()
   from /home/pi/Documents/Projects/EPICS/base-7.0/lib/linux-arm/libdbCore.so
[Current thread is 1 (Thread 0xb6fe0250 (LWP 1128))]
(gdb) bt
#0  0xb6b7f67c in dbNameToAddr ()
   from /home/pi/Documents/Projects/EPICS/base-7.0/lib/linux-arm/libdbCore.so
#1  0xb6e7ae7c in setLinks(luascriptRecord*) ()
   from /home/pi/Documents/Projects/EPICS/support/synApps/support/lua-R3-0-1/lib/linux-arm/liblua.so
#2  0xb6e7af6c in init_record(dbCommon*, int) ()
   from /home/pi/Documents/Projects/EPICS/support/synApps/support/lua-R3-0-1/lib/linux-arm/liblua.so
#3  0xb6bb9574 in iocBuild_2 ()
   from /home/pi/Documents/Projects/EPICS/base-7.0/lib/linux-arm/libdbCore.so
#4  0xb6bb9724 in iocBuild ()
   from /home/pi/Documents/Projects/EPICS/base-7.0/lib/linux-arm/libdbCore.so
#5  0xb6bb98fc in iocInit ()
   from /home/pi/Documents/Projects/EPICS/base-7.0/lib/linux-arm/libdbCore.so
#6  0xb6bb9d44 in iocInitCallFunc ()
   from /home/pi/Documents/Projects/EPICS/base-7.0/lib/linux-arm/libdbCore.so
#7  0xb6accb9c in iocshBody ()
   from /home/pi/Documents/Projects/EPICS/base-7.0/lib/linux-arm/libCom.so
#8  0x00018ba4 in main ()
(gdb)



References:
LUA: Segmentation fault on Raspberry for IOC being invoked from shell prompt; no problem via gdb execution. Kuldeep Joshi via Tech-talk

Navigate by Date:
Prev: Re: EPID Record Jemian, Pete R. via Tech-talk
Next: Re: EPID Record Mark Rivers via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
Navigate by Thread:
Prev: LUA: Segmentation fault on Raspberry for IOC being invoked from shell prompt; no problem via gdb execution. Kuldeep Joshi via Tech-talk
Next: EPICS Record Ben Franksen via Tech-talk
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  2013  2014  2015  2016  2017  2018  2019  2020  <20212022  2023  2024 
ANJ, 13 Feb 2021 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·