neocturne/MinedMap

Single tile error stops whole render

dreadnaut opened this issue ยท 3 comments

Hello @neocturne, first of all congratulations on the Rust release! It might actually push me to learn some Rust ๐Ÿ˜€

I have noticed that the new version is more strict about errors, and if a problematic region means that a tile can't be rendered, the whole process fail โ€” leaving no map at all. The C version would skip the tile, leaving a hole on the map, but the process would complete.

Like the "processing" phase, tile rendering could continue even if a tile is missing, leaving a hole in the map.

2023-10-08T12:55:14.767085Z  INFO Processing region files...
[...]
2023-10-08T12:57:55.734375Z DEBUG Processing region r.8.-2.mca
2023-10-08T12:57:55.734911Z ERROR Failed to process region (8, -2): Failed to read region header

Caused by:
    failed to fill whole buffer
[...]
2023-10-08T12:57:55.739075Z  INFO Processed region files (106 processed, 3 unchanged, 3 errors)
2023-10-08T12:57:55.739372Z  INFO Rendering map tiles...
[...]
2023-10-08T12:58:06.095434Z DEBUG Rendering tile map/0/r.7.-7.png
Error: Failed to render tile (8, -2)

Caused by:
    0: Region (8, -2) from previous step must exist
    1: Failed to get modified timestamp of file /home/fran/var/minecraft/minedmap/processed/r.8.-2.bin    2: No such file or directory (os error 2)

anyhow::Ok(usize::from(
self.render_tile(coords)
.with_context(|| format!("Failed to render tile {:?}", coords))?,
))

The problematic regions have size 0. I don't know I common this is, but it happens sometimes on my server ๐Ÿค”

Hmm. The idea here was that errors are only ignored for the first stage of processing (as errors can easily occur when minedmap is running while Minecraft is saving), and in later stages no errors should ever happen as long as you got a complete run at least once (as the old processed data would be preserved in that case).

I did not think of persistent invalid files, but I agree it's better to have the run succeed with holes in such cases than to break altogether. I will work on a fix soon.

I have prepared a fix in #33. Will run a few more tests and likely make a fix release soon.

Thank you!