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

Unable to open file #46

Open
BraveenSri opened this issue Mar 9, 2023 · 8 comments
Open

Unable to open file #46

BraveenSri opened this issue Mar 9, 2023 · 8 comments

Comments

@BraveenSri
Copy link

Hi
When trying to create a file using new h5wasm.File(fileName, 'w'), occasionally following error happens.

HDF5-DIAG: Error detected in HDF5 (1.12.1) thread 0:
#000: /home/brian/dev/libhdf5-wasm/wasm_build/1_12_1/_deps/hdf5-src/src/H5F.c line 532 in H5Fcreate(): unable to create file
major: File accessibility
minor: Unable to open file
#1: /home/brian/dev/libhdf5-wasm/wasm_build/1_12_1/_deps/hdf5-src/src/H5VLcallback.c line 3282 in H5VL_file_create(): file create failed
major: Virtual Object Layer
minor: Unable to create file
#2: /home/brian/dev/libhdf5-wasm/wasm_build/1_12_1/_deps/hdf5-src/src/H5VLcallback.c line 3248 in H5VL__file_create(): file create failed
major: Virtual Object Layer
minor: Unable to create file
#3: /home/brian/dev/libhdf5-wasm/wasm_build/1_12_1/_deps/hdf5-src/src/H5VLnative_file.c line 63 in H5VL__native_file_create(): unable to create file
major: File accessibility
minor: Unable to open file
#4: /home/brian/dev/libhdf5-wasm/wasm_build/1_12_1/_deps/hdf5-src/src/H5Fint.c line 1858 in H5F_open(): unable to truncate a major: File accessibility
minor: Unable to open file

Once I get the error, all requests are getting failed after that point with following error.
RuntimeError: memory access out of bounds

The only thing that worked for me was trying to restart.

I wonder whether anyone can help me to fix this.
Thanks!

Braveen.

@Carnageous
Copy link

First thing that comes to mind: did you wait for the filesystem to be ready (with await h5wasm.ready?
This needs to be done before any read/write operations can be done.

@BraveenSri
Copy link
Author

BraveenSri commented Mar 10, 2023

Hi @Carnageous, Thank you for your response
Yes I did

Following is code segment

const h5wasm = await this.getH5wasm();
let writeFile = new h5wasm.File(fileData.name, 'w');
writeFile.create_dataset('signal', mergedEcgData, [ ecgSize ], '<d');
writeFile.create_dataset('annotation', mergedAnnotationData, [ annotationSize, annotationColumnCount ], '<q');
writeFile.create_attribute('summary', JSON.stringify(fileData.summary));
writeFile.close();

@bmaranville
Copy link
Member

Can you tell me if this is happening for the first file you're trying to write after loading h5wasm, or does it happen later when adding more files?

Also it would help to know what's in the function this. getH5wasm()

@BraveenSri
Copy link
Author

BraveenSri commented Mar 13, 2023

Hi @bmaranville, Thank you for your response

In my code, I am creating only one file per http request.
After starting the nestjs application, this is not happening for the first request but for a random request sent after 2 or more requests.

Following is the this.getH5wasm() function. Sorry for not adding it initially.

async getH5wasm() {
    if (!this.h5wasm) {
        this.h5wasm = await getImport();
    }
    return this.h5wasm;
}

@bmaranville
Copy link
Member

Sorry - can you also show what is in getImport() ? It's important to how the library is being initialized. I suspect there's another await statement needed in your code, but I won't be able to say for sure until I see how the library is being imported and initialized, right up until you use it.

@BraveenSri
Copy link
Author

BraveenSri commented Mar 16, 2023

Sorry - can you also show what is in getImport() ? It's important to how the library is being initialized. I suspect there's another await statement needed in your code, but I won't be able to say for sure until I see how the library is being imported and initialized, right up until you use it.

async function getImport() {
  const h5wasm = await import('h5wasm');
  await h5wasm.ready;
  return h5wasm;
}

@BraveenSri
Copy link
Author

Sorry - can you also show what is in getImport() ? It's important to how the library is being initialized. I suspect there's another await statement needed in your code, but I won't be able to say for sure until I see how the library is being imported and initialized, right up until you use it.

async function getImport() {
  const h5wasm = await import('h5wasm');
  await h5wasm.ready;
  return h5wasm;
}

@bmaranville could you please let me know is this what you asked

@bmaranville
Copy link
Member

Sorry - I wasn't able to come up with a quick explanation of what's happening to you. The library initialization you're using seems fine. Without being able to run your code I'm not quite sure how to reproduce the error. There are other ways you can run into memory issues with wasm - are you opening extremely large files? How are you closing files when you are done with them? Are you overwriting a file with new contents when you open subsequent urls? ...

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