Skip to content

VLEN string problem on Win64 #593

Closed
Closed

Description

@andrewcollette

From this thread:

https://groups.google.com/forum/#!topic/h5py/nF_EkdOpCd8

Evidently storing a variable-length string causes a segmentation fault with 2.5.0, on win64 (conda).

Activity

  1. rossant commented on Jul 3, 2015

    @rossant

    it seems like i have exactly the same problem with booleans. fixed by casting to an int

  2. groutr commented on Jul 7, 2015

    @groutr

    I'm pretty sure this is related.
    PyTables/PyTables#471

  3. cpcloud commented on Jul 7, 2015

    @cpcloud

    This isn't limited to variable length string dtypes:

    In [1]: import numpy as np
    
    In [2]: import h5py
    
    In [3]: f = h5py.File('foo.h5')
    
    In [4]: ds = f.create_dataset('/x', shape=(20, 24), dtype=np.dtype([('a', 'i4'), ('b', 'i4')]), chunks=(4, 6))
    
    In [5]: ds
    Out[5]:  # crashes the interpreter
    
  4. cgohlke commented on Jul 8, 2015

    @cgohlke
    Contributor

    I can't reproduce these crashes with the builds from http://www.lfd.uci.edu/~gohlke/pythonlibs/#h5py

    >>> import numpy as np
    >>> import h5py
    >>> f = h5py.File('foo.h5')
    >>> ds = f.create_dataset('/x', shape=(20, 24), dtype=np.dtype([('a', 'i4'), ('b', 'i4')]), chunks=(4, 6))
    >>> ds
    <HDF5 dataset "x": shape (20, 24), type "|V8">
    
  5. groutr commented on Jul 10, 2015

    @groutr

    I can confirm that Python 3.4 on Windows 32bit does not seem to be affected by this issue.

  6. rossant commented on Jul 10, 2015

    @rossant

    is this a conda-only problem?

  7. groutr commented on Jul 10, 2015

    @groutr

    I don't know if it is a conda only problem. As far as I can tell, we are compiling hdf5 and h5py correctly.
    From what I'm seeing, the difference is the conda packages is linking against the latest hdf5 library (1.8.15patch1). Is there a change between 1.8.14 and 1.8.15patch1 that might have affected h5py?

    When using hdf5 1.8.15patch and h5py 2.5.0, the interpreter crashes running the test suite. When using hdf5 1.8.14 and h5py 2.5.0, the test suite passes.

  8. cgohlke commented on Jul 11, 2015

    @cgohlke
    Contributor

    I rebuilt against HDF5 1.8.15-patch1: No crashes.

  9. groutr commented on Jul 11, 2015

    @groutr

    Hmmm....Maybe it is just affecting the conda builds. I'll look over things again today.

  10. groutr commented on Jul 31, 2015

    @groutr

    I'm wondering if threadsafe in hdf5 has anything to do with this. @cgohlke, are you compiling your hdf5 windows binaries with HDF5_ENABLE_THREADSAFE?

  11. cgohlke commented on Jul 31, 2015

    @cgohlke
    Contributor

    HDF5_ENABLE_THREADSAFE? No, not for h5py and pytables.

  12. subhacom commented on Aug 22, 2015

    @subhacom

    I am facing what seems to be the same issue, but for reading dataset containing strings. I cloned master and used setuptools to install on both conda and cygwin. Occurs only with conda, not with cygwin on the same (windows 7) system.

  13. jdreaver commented on Sep 10, 2015

    @jdreaver

    I am experiencing the same issue. If I set an attribute using a string, I get a segfault. It is fixed if I wrap the string in an array:

    group.attrs["key"] = np.array(["string"], dtype=np.string_)

    However, I think we can agree that this is a bug and this workaround is a band-aid. I am also using the latest h5py and hdf5 packages from conda on Windows 64 bit.

  14. jdreaver commented on Sep 23, 2015

    @jdreaver

    I'll add that I'm also getting a segfault with boolean attributes. (My workaround is to just store them as ints and then restore to bool when loading.)

  15. evangroopman commented on Sep 24, 2015

    @evangroopman

    I can confirm the the issue with arrays of variable length strings. jdreaver's workaround also seems to work, albeit only with dtype=np.string_. Trying to use h5py's special dtypes, e.g., dt = h5py.special_dtype(vlen=str), from the documentation still ends with a segfault.

    This DOES appear to be a conda issue. No such troubles using WinPython (python 3.4, 64 bit).

    Rebuilding h5py with pip from cgohlke's page http://www.lfd.uci.edu/~gohlke/pythonlibs/#h5py fixes the issue, too, in the conda distro.

  16. jpiersol commented on Nov 5, 2015

    @jpiersol

    This seems to be fixed in the latest Win64 Anaconda release (Anaconda 2.4.0/Python 3.5).

  17. jdreaver commented on Nov 5, 2015

    @jdreaver

    Thanks for the heads up @jpiersol!

  18. TheQuantumPhysicist commented on Feb 9, 2017

    @TheQuantumPhysicist

    We are facing exactly the same symptoms with Python 3.5 64-bit and h5py 2.6. A create_dataset command without a list wrapping the dataset name crashes the interpreter. Also we tried h5py.run_tests() and it works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions