HDFGroup / HDFGroup/vol-log-based

Segmentation fault: H5Pget_vol_cap_flags

Open
#57 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
3
Forks
8
PR merge metrics
No merged PRs in 30d

Description

## Summary
`H5Pget_vol_cap_flags` gives segmentation fault.

## Details
This issue prevents us from running [vol-tests](https://github.com/HDFGroup/vol-tests). vol-tests will fail in the setup stage (before any actual tests are performed).

A test program to reproduce the problem is provided below.
However, running the test program with [the Passthru VOL (provided by HDF5 group)](https://github.com/HDFGroup/hdf5/blob/develop/src/H5VLpassthru.h) gives the same segmentation error.
Therefore, it's possible that the root cause is outside our library.

## Reproducing the issue

Click here to see a test program that reproduces the problem:

```c
#include
#include
#include "hdf5.h"

#define CHECK_ERR(A) \
{ \
if (A < 0) { \
printf ("Error at line %d: code %d\n", __LINE__, A); \
goto err_out; \
} \
}

hid_t get_vol_id (int argc, char **argv, int rank);

int main (int argc, char **argv) {
herr_t err = 0;
int rank;
hid_t fapl_id, connector_id;
uint64_t vol_cap_flags;

MPI_Init (&argc, &argv);
MPI_Comm_rank (MPI_COMM_WORLD, &rank);

// get connector id, return one of the following:
// 1) the id for Log VOL
// 2) the id for the Passthru VOL (provided by HDF5 group)
// 3) -1 (error case)
connector_id = get_vol_id(argc, argv, rank);
CHECK_ERR(connector_id);

// create a file access property list
fapl_id = H5Pcreate (H5P_FILE_ACCESS);
CHECK_ERR (fapl_id);

// set the underlying VOL of fapl_id
err = H5Pset_vol(fapl_id, connector_id, NULL);
CHECK_ERR(err);

// get vol_cap_flags
err = H5Pget_vol_cap_flags(fapl_id, &vol_cap_flags); // seg fault happens inside this line

// following codes not able to run due to the seg fault above

CHECK_ERR (err);

err_out:;
if (fapl_id > 0) H5Pclose (fapl_id);
MPI_Finalize ();
return err;
}

hid_t get_vol_id (int argc, char **argv, int rank) {
hid_t connector_id = H5I_INVALID_HID;
if (argc > 2) {
if (!rank) printf ("Usage: %s [volname]\n", argv[0]);
goto err_out;
}

// return the id for LOG VOL
if (strcmp(argv[1], "LOG") == 0) {
if (!rank) printf ("Using connetcor: %s\n", argv[1]);
connector_id = H5VLregister_connector_by_name ("LOG", H5P_DEFAULT);
CHECK_ERR (connector_id);
}

// return the id for Passthru VOL
else if (strcmp(argv[1], "pass_through") == 0) {
if (!rank) printf ("Using connetcor: %s\n", argv[1]);
connector_id = H5VL_pass_through_register();
CHECK_ERR (connector_id);
}

// error case
else {
if (!rank) {
printf("Not supported for this test program.");
printf ("Using connetcor: %s\n", argv[1]);
}
}
err_out:;
return connector_id;
}

```

Click here to see the makefile:

```makefile
HDF5=/home/HDF5/1.14.0
LOGVOL=/home/Log-Vol/install

all:
mpicc test.c -g -o test \
-I${HDF5}/include \
-L${HDF5}/lib -lhdf5 -lhdf5_hl

run:
LD_LIBRARY_PATH=${LOGVOL}/lib:${HDF5}/lib:${LD_LIBRARY_PATH} \
HDF5_PLUGIN_PATH="${LOGVOL}/lib" \
mpirun -n 1 ./test LOG

passthru:
LD_LIBRARY_PATH=${HDF5}/lib:${LD_LIBRARY_PATH} \
HDF5_PLUGIN_PATH="${HDF5}/lib" \
mpirun -n 1 ./test pass_through

clean:
rm -rf *.h5 core.* test

```

`make` to compile.

`make run` to run the test program with Log VOL.

`make passthru` to run the test program with [the Passthru VOL (provided by HDF5 group)](https://github.com/HDFGroup/hdf5/blob/develop/src/H5VLpassthru.h).

[gdb output, using Log VOL](https://github.com/DataLib-ECP/vol-log-based/files/10341606/log_bt.txt)

[gdb output, using the Passthru VOL](https://github.com/DataLib-ECP/vol-log-based/files/10341607/passthru_bt.txt)

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by compiling test.c with the provided Makefile and running both `make run` and `make passthru` to reproduce the crash. Read the linked gdb outputs and compare the Log VOL and HDF5 Passthru paths around `H5Pget_vol_cap_flags`; done means the vol-tests setup completes without this segmentation fault.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, hpc
Domain
hpc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.