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

Closing the dataset while an async operation is running can end with a segfault #38

Open
mmomtchev opened this issue Nov 16, 2020 · 2 comments

Comments

@mmomtchev
Copy link
Contributor

const gdal = require('gdal-next');
const ds = gdal.open('sample.tif');
const band = ds.bands.get(1)
band.pixels.readAsync(0, 0, 10, 10);
ds.close();

This is not expected to work, but the user should be protected against a segfault.

@yocontra
Copy link
Owner

@mmomtchev I think the correct behavior would be for ds.close() to throw if work is still ongoing, thoughts?

@mmomtchev
Copy link
Contributor Author

In the next version ds.close() will block until the currently running I/O finishes (it cannot be canceled) and then it will cancel all operations that have not yet started - they will end up rejecting with Dataset closed
Frankly, if I had seen this sooner, I would have probably settled for it 😄
But I already implemented a locking hierarchy on top of Brian Revis excellent PtrManager which manages the lifetime of all datasets

juneidy pushed a commit to juneidy/node-gdal-next that referenced this issue Feb 27, 2023
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

2 participants