Hi Achim,

El dc 01 de 11 del 2006 a les 17:26 +0100, en/na Achim Gaedke va
escriure:
> Hi!
> 
> Accidentially I created some HDF files with lzo compressed arrays and no
> FLAVOR attribute was put to these data. I did not know how this could
> happen!?!
> 
> Calling ptdump to get a list of my data I got core dumps:
> ptdump pos.h5
> HDF5-DIAG: Error detected in HDF5 library version: 1.6.5 thread
> 2816043232.  Back trace follows.
>   #000: ../../../src/H5A.c line 457 in H5Aopen_name(): attribute not found
>     major(18): Attribute layer
>     minor(05): Bad value
>   #001: ../../../src/H5A.c line 404 in H5A_get_index(): attribute not found
>     major(18): Attribute layer
>     minor(48): Object not found
> Segmentation fault
> 
> (gdb) bt
> #0  0xa7e29f83 in strlen () from /lib/tls/i686/cmov/libc.so.6
> #1  0x08083efa in PyString_FromString ()
> #2  0xa6a7b08e in ?? () from
> /usr/lib/python2.4/site-packages/tables/hdf5Extension.so
> 
> Detailed analysis led me to the function H5ATTRget_attribute_string and
> it's caller:
> method _openArray of class Array
> 
> I added a test for the attribute and the things are working....
> 
> diff pytables-1.3.3/src/hdf5Extension.pyx
> pytables-1.3.3_fixed/src/hdf5Extension.pyx
> 1354,1355c1354,1355
> <     if self._v_file._isPTFile:
> <       H5ATTRget_attribute_string(self.dataset_id, "FLAVOR", &flavor)
> ---
> >     if self._v_file._isPTFile and
> H5ATTR_find_attribute(self.dataset_id, "FLAVOR")<0:
> >       ret=H5ATTRget_attribute_string(self.dataset_id, "FLAVOR", &flavor)
> 
> This test might be necessary at other methods, too.
> 
> Maybe it is better to handle this case in a proper way instead a core
> dump. I am not sure, whether it is best to asume "numarray"...

The issue here is that 'system' attributes are opened through the fast
H5ATTRget_attribute_string, which do assume that if the file is a
PyTables file, then a 'FLAVOR' attribute should exist for a leaf (i.e.
avoiding an attribute lookup which is an *expensive* operation). This
was critical back in pre-1.2 versions, when the opening time for file
with many nodes, was very affected by this additional lookup. With the
introduction of a node cache in PyTables 1.2, this was very alleviated,
but even in that case, keeping low the opening time of a leaf can be
important in situations when you want to traverse the complete object
tree (for example). So, I'd really like to not have to introduce the
lookup call (H5ATTR_find_attribute), if possible.

Mmm... the question should rather be how you have been able to create a
PyTables file with a leaf without a FLAVOR attribute. If you can
reproduce the way, please, tell me (I'm very much intrigued).

OTOH, in PyTables 2.0 the default for 'FLAVOR' will be 'numpy', of
course. But until 2.0 arrives, a 'numarray' value is probably a more
sensible default.

Cheers,

-- 
Francesc Altet    |  Be careful about using the following code --
Carabos Coop. V.  |  I've only proven that it works, 
www.carabos.com   |  I haven't tested it. -- Donald Knuth


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Pytables-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pytables-users

Reply via email to