フィルターのクリア

HDF5 cannot write files with R2021b

10 ビュー (過去 30 日間)
t pl
t pl 2022 年 3 月 18 日
コメント済み: Walter Roberson 2022 年 9 月 12 日
I want to write data in HDF5 files. I use the builtin function h5create and h5write.
I recently updated to R2021b and found an issue with the h5create and h5write functions. Consider the following code:
data.lon = randn(1,10);
data.lat = randn(1,10);
filename = '/mnt/nas/test.h5'
h5create(filename,'/lon',size(data.lon),'Datatype','double');
h5create(filename,'/lat',size(data.lat),'Datatype','double');
h5write(filename,'/lon',data.lon);
h5write(filename,'/lat',data.lat);
This should write some test data to a file located on a NAS that is mounted via SMB. However, even though I do have read/write permissions on this storage location, that code snippet fails with the following error:
Error using hdf5lib2
Unable to access '/mnt/nas/test.h5'. You might not have permission.
Error in H5F.open (line 130)
file_id = H5ML.hdf5lib2('H5Fopen', filename, flags, fapl, is_remote);
Error in h5create>create_dataset (line 180)
fid = H5F.open(options.Filename,'H5F_ACC_RDWR','H5P_DEFAULT');
Error in h5create (line 100)
create_dataset(options);
Error in untitled2 (line 11)
h5create(filename,'/lon',size(data.lon),'Datatype','double');
What is funny about this is that the exact same code works well with R2020b and previous. Also, even though I get this error, the file is created correctly, but no data is written to it. So the error "you might not have permission" is definitively wrong and makes no sense, as the file could be created.
What is also worth noting is that the code runs fine if I write to a file that is not on a NAS, for example to /tmp. Then, it works also with R2021b.
What is going on here and how should I try to fix this?
  2 件のコメント
Jerry Guern
Jerry Guern 2022 年 9 月 7 日
編集済み: Jerry Guern 2022 年 9 月 8 日
I am having this exact problem on 2021a, 2021b, and 2022a. In a function that uses both h5create and h5write several times, it's crashing about half the time, and crashing at different calls to h5create or h5write when it does crash. Are you running into this problem on Windows?
Walter Roberson
Walter Roberson 2022 年 9 月 12 日
I just noticed a bug report affecting Linux when the file system is mounted as NFS4. Bug 2682742 fixed in 44 r2022a update 5

サインインしてコメントする。

回答 (1 件)

Jerry Guern
Jerry Guern 2022 年 9 月 9 日
Try outputting to a different directory.
I had the EXACT issue described here, with the same crash reports, running 2021a, 2021b, and 2022a. My program would run to completion about half the time, but crash on any of several h5create() or h5write() calls the other half. I was outputting to a subdir of my Desktop, and our IT guy suggested outputting instead to a subdir of Documents instead, and that worked. Can't say if the problem was Windows, Windows Defender, or MATLAB's interface to Windows, but I haven't had the problem since.

製品


リリース

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by