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  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 
<== Date ==> <== Thread ==>

Subject: Re: Custom file saving plugin in AreaDetector
From: Hinko Kočevar <hinko.kocevar@i-tech.si>
To: tech-talk@aps.anl.gov
Date: Tue, 23 Jul 2013 09:50:52 +0200
Mark,

I can confirm that the changes you made play nicely. No problems with the capture mode so far. We will start using the AD trunk code in the project and let you know if anything pops up.

Thanks and have a nice day!

- Hinko

On 07/19/2013 01:00 PM, Hinko Kočevar wrote:
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: tech-talk-bounces@aps.anl.gov
[mailto:tech-talk-bounces@aps.anl.gov] 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





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

Navigate by Date:
Prev: Re: RDB archiver disk space Jiro Fujita
Next: Spellman SL30 Pearson, Matthew R.
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 
Navigate by Thread:
Prev: Re: Custom file saving plugin in AreaDetector Hinko Kočevar
Next: motor record & PC6K: program upload fails 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 
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 ·