neocturne / MinedMap

Minecraft map renderer and viewer
95 stars 13 forks source link

Single tile error stops whole render #32

Closed dreadnaut closed 10 months ago

dreadnaut commented 12 months ago

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)

https://github.com/neocturne/MinedMap/blob/ceb71f035caa5214e19dda49c63b6ea4b36c200b/src/core/tile_renderer.rs#L327-L330

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

neocturne commented 12 months ago

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.

neocturne commented 11 months ago

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

dreadnaut commented 10 months ago

Thank you!