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  <20132014  2015  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  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
<== Date ==> <== Thread ==>

Subject: Re: Custom file saving plugin in AreaDetector
From: Hinko Kočevar <[email protected]>
To: Mark Rivers <[email protected]>
Cc: EPICS tech-talk <[email protected]>
Date: Fri, 19 Jul 2013 13:00:28 +0200
Dear Mark,

You can get the new version at

https://subversion.xor.aps.anl.gov/synApps/areaDetector/trunk

if you would like to test it, and I would be happy if you did.

Sure, we'll give it a spin next week.

Thanks,
Hinko



Thanks,
Mark


-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Hinko Kocevar
Sent: Thursday, July 18, 2013 5:48 AM
To: EPICS tech-talk
Subject: Custom file saving plugin in AreaDetector

Hi,

Segmentation fault happens when saving data to a file from my custom
made file saving plugin, that extends the NDPluginFile base class like
all other file saving plugins.
Saving mode is Capture, meaning a capture buffer, of user specified
capture size, is preallocated in advance. During capturing, NDArrays are
put into this buffer through callbacks. Actual file saving can occur
either when the number of captures(captured NDArrays) reaches the number
specified by the user, or when the user manually clicks save before the
actually capturing has finished. When saving is done, the preallocated
capture buffer is freed. If capturing is still carried on after the
saving, which does happen in the case of user clicking save prematurely
before the capturing reaches the number specified by the user,
segmentation fault happens.
The segmentation fault happens in code NDPluginFile.cpp at line 594
(EPICS base 3.14.12.3):

591 case NDFileModeCapture:
592 if (capture) {
593 if (numCaptured < numCapture) {
594 this->pNDArrayPool->copy(pArray, this->pCapture[numCaptured++], 1);
595 arrayCounter++;
596 setIntegerParam(NDFileNumCaptured, numCaptured);

Inspecting the segmentation fault, pCapture was a NULL pointer, the
numCaptured was the size of captured NDArrayes at clicking save prematurely.

Since the capture buffer is freed after save, I will avoid this problem
by stopping the capture when save is done.

Is a better way to handle this? Maybe there should be a check in the
code to avoid segmentation fault, when the NDArray buffer is NULL.

Best regards,
Hinko




Replies:
Re: Custom file saving plugin in AreaDetector Hinko Kočevar
References:
Custom file saving plugin in AreaDetector Hinko Kočevar
RE: Custom file saving plugin in AreaDetector Mark Rivers

Navigate by Date:
Prev: RDB archiver disk space Jiro Fujita
Next: Re: RDB archiver disk space Konrad, Martin
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
Navigate by Thread:
Prev: RE: Custom file saving plugin in AreaDetector Mark Rivers
Next: Re: Custom file saving plugin in AreaDetector Hinko Kočevar
Index: 1994  1995  1996  1997  1998  1999  2000  2001  2002  2003  2004  2005  2006  2007  2008  2009  2010  2011  2012  <20132014  2015  2016  2017  2018  2019  2020  2021  2022  2023  2024 
ANJ, 20 Apr 2015 Valid HTML 4.01! · Home · News · About · Base · Modules · Extensions · Distributions · Download ·
· Search · EPICS V4 · IRMIS · Talk · Bugs · Documents · Links · Licensing ·