Repository navigation
feat(data): GeoTIFF and COG rasters the machine can't hold are errors, not crashes (#1291 step 1) - #1370
Conversation
…, not crashes (opengeos#1291 step 1, GeoTIFF and COG) The buffers a GeoTIFF read allocates at the raster's size are reserved first, through raster::{filled, room} (opengeos#1338): a decimated read's bands, the samples turned into f32, the bands split out of a whole image, a COG window's values (opengeos#1210), and a turned picture or skewed image's bands. The decoder's own buffer stays bounded by its decoding_buffer_size limit, and a COG tile by MAX_TILE_SAMPLES. polygon_mask's docs name its new error (from opengeos#1338's review).
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Code reviewI read the full diff against the call sites, the Bugs
Security
Performance
Quality
AGENTS.md
Prior reviews: none on this PR, so no earlier concerns were skipped. Change sizeCompared: the whole PR against main (merge base e03a6b1 to PR head 432e475).
|
…ead's size included
Code reviewReviewed the four changed files ( Bugs: None found. I checked:
Security: None found. Performance: None found. Allocation now happens through Quality:
AGENTS.md:
Earlier review threads: 1 thread ( Change sizeCompared: the whole PR against main (merge base e03a6b1 to PR head 0556fe7).
|
📖 Docs preview
GitHub Pages takes a minute or two to publish a new commit. |
|
On the review of 0556fe7: the |
Brings in main's 32 commits. Three blocks, each combined: - tiles cog.rs: main's bounded `decode_tile_counted` (opengeos#1370), then this branch's login check on the tile read. - engine project.rs: the recorded (history/task/model) addresses are put back first, then main's early return and project-size limit (opengeos#1364), so a refused save never leaves the live project's bindings stripped. - engine layer.rs: layer.addUrl lists main's `bbox`/`cellSize` (opengeos#1210) and this branch's `connection`.
Part of #1291, step 1 (fallible allocation): the GeoTIFF and COG readers. They follow #1328 and #1338, and come after #1210, which changed the same reader code.
What
Opening a GeoTIFF, a COG window or a turned picture whose bands can't be allocated now fails with "not enough memory for a W × H raster" instead of aborting the process. This holds in the browser and on Windows; on Linux it catches impossible requests, while overcommit can still let a reservation succeed and fail later (as #1291 says). The buffers that now reserve their memory first:
f32, and each band split out of them (bands stored apart or interleaved).f32. A failure on a worker thread stops the read and is returned, the same way a chunk that doesn't decode is.layer.addUrl {"bbox"}(#1204) #1210): the window's values inread_values_counted_blocking, which every band of alayer.addUrlwindow goes through.raster/mod.rs.Pixels, sizes and the
MAX_SAMPLESlimit are unchanged.How
to_f32returns aResult: it reserves the converted samples throughraster::room(feat(data): ASCII grids, Zarr stores and pictures the machine can't hold are errors, not crashes (#1291 step 1, part 2) #1338), and theFloat32case still passes the buffer through without copying.raster::filledandraster::room: one implementation for the error message, as in feat(data): ASCII grids, Zarr stores and pictures the machine can't hold are errors, not crashes (#1291 step 1, part 2) #1338.polygon_mask's docs now name its error, as promised in feat(data): ASCII grids, Zarr stores and pictures the machine can't hold are errors, not crashes (#1291 step 1, part 2) #1338's review.Not in this part
tiffcrate allocates it itself, and thedecoding_buffer_sizelimit already bounds it, asmax_allocdoes for the image decoder in feat(data): ASCII grids, Zarr stores and pictures the machine can't hold are errors, not crashes (#1291 step 1, part 2) #1338.MAX_TILE_SAMPLESbounds it.Tests
MAX_SAMPLESand the window limits refuse any file large enough first.a_band_too_large_to_hold_is_an_error(feat(data): ASCII grids, Zarr stores and pictures the machine can't hold are errors, not crashes (#1291 step 1, part 2) #1338) covers the helpers themselves.cargo xtask cipasses locally (fmt, clippy, tests, layers), apart from two tests that fail only on this machine (GDAL and a damaged-Shapefile fixture).Summary by CodeRabbit