Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Segmentation fault: H5Pget_vol_cap_flags #57

Open
yzanhua opened this issue Jan 4, 2023 · 4 comments
Open

Segmentation fault: H5Pget_vol_cap_flags #57

yzanhua opened this issue Jan 4, 2023 · 4 comments

Comments

@yzanhua
Copy link
Collaborator

yzanhua commented Jan 4, 2023

Summary

H5Pget_vol_cap_flags gives segmentation fault.

Details

This issue prevents us from running 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) 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:
#include <stdlib.h>
#include <string.h>
#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:
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).

gdb output, using Log VOL

gdb output, using the Passthru VOL

@yzanhua
Copy link
Collaborator Author

yzanhua commented Jan 4, 2023

The above tests are using HDF5 1.14.0.

Will also test HDF5 1.13.3.

@wkliao
Copy link
Collaborator

wkliao commented Jan 24, 2023

@yzanhua
Please shorten the test program to test pass-through VOL only and
use it to create an issue on HDF5 repo.

@yzanhua
Copy link
Collaborator Author

yzanhua commented Jan 24, 2023

An issue is created: HDFGroup/hdf5#2417

@khou2020
Copy link
Collaborator

Reimplement https://github.com/DataLib-ECP/vol-log-based/blob/68ffd85accfce126d48beca97c7130541d355202/src/H5VL_log_introspect.cpp#L68
Set cap flag to what logvol support, do not rely on under VOL.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants