[Nexus] NXdir: SEG fault

Mark Rivers rivers at cars.uchicago.edu
Thu Jan 28 14:51:51 GMT 2010


I have discovered a possibly related problem with stack overflow when calling Nexus API from a multi-threaded C program.  I found that the function NXgetgroupinfo uses a very large amout of stack.  I would get stack overflow when my thread had less than 40000 bytes of stack, it worked OK with 80000 bytes.  The stack overflow only happened for me on Windows with the MS VC++ compiler, it did not happen on Linux, or Windows with the gcc compiler.  But I suspect that NXgetgroupinfo is doing some recursion that can use a large amount of stack depending on the structure of the HDF file.
 
Mark
 

________________________________

From: nexus-bounces at nexusformat.org on behalf of Emmanuel FARHI
Sent: Thu 1/28/2010 8:18 AM
To: nexus at nexusformat.org
Subject: [Nexus] NXdir: SEG fault


Using nxdir, I get a SEGV:



	nxdir -t multi mcstas.h5 -p "*" --data-mode script
	*** stack smashing detected ***: nxdir terminated
	Segmentation fault
	


System is:


	NeXus 4.2.0 (from tarball)
	Linux Ubuntu 8.04 64 bits
	


Generation of NeXus file with McStas performs OK (file attached), except for warning messages when trying to create/open already existing/opened groups/objects. 

The only way to seemingly test if a group exists without creating with an error message is to call NXgetgroupinfo to get the current group and make a strcmp with the requested group.

There is unfortunately no such routine for data sets. We can not obtain the current Data Set name, only its dimension, rank and type with NXgetinfo.

An other solution suggested by Mark K is to unactivate HDF error messages with NXMDisableErrorReporting(); and reset it with NXMEnableErrorReporting();

If you think of a better way to inquire groups/data sets, and a solution for nxdir that fails showing data values/attributes, please tell me.

Emmanuel.

-- 
Emmanuel FARHI,www.ill.eu/computing/people/emmanuel-farhi \|/ ____ \|/
CS-Group ILL4/221, Institut Laue-Langevin (ILL) Grenoble  ~@-/ oO \-@~
6 rue J. Horowitz, BP 156, 38042 Grenoble Cedex 9,France  /_( \__/ )_\
Work :Tel (33/0) 4 76 20 71 35. Fax (33/0) 4 76 48 39 06     \__U_/ 


More information about the NeXus mailing list