-
Notifications
You must be signed in to change notification settings - Fork 262
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
Crash when opening same NC4 file from different threads BUT under global mutex #2496
Comments
Possibly related, we're seeing a similar crash when opening different files: georust/gdal#299. One difference is that there it seems to overflow the stack while trying to print a stack trace (but that's just a guess, I'm not familiar with the two libraries). |
Do you know if you are using pthreads for your mutex? |
using std::thread requires linking the code with -lpthread. Apparently the std::mutex implementation on Linux / gcc also uses pthread_mutex_lock() / pthread_mutex_unlock() underneeth. cf
To be noted that the original reproducer with GDAL uses a global lock that is a pthread_mutex_t |
This is an attempt at providing a minimum reproducer for OSGeo/gdal#6253
The attached docker.zip contains a simple Dockerfile building libhdf5 and libnetcdf, and a simple C++ program.
The C++ program loops at creating 2 threads, which open the same NC4 file and one calls nc_inq_varname(). It is to be noted that all calls to the netCDF API are protected by a common mutex , so there's no concurrent access to the netCDF API.
I've tried different versions of hdf5 and netcdf, and compiling hdf5 with or without --enable-unsupported --enable-threadsafe, but the crash always occur
How to reproduce:
results in
and under valgrind:
Dockerfile:
test.cpp:
The text was updated successfully, but these errors were encountered: