panic in src/generate/heightmap.rs:127:27
hdevalence opened this issue · 6 comments
Hi, this crate looks really cool! I tried running it on a MacBook with Apple Silicon M1 (I realize this is an unsupported platform, but it would be cool to get it to work), and first ran into the unsupported double types issue.
Then I reran with cargo run --features soft-float64 --release
and got a different error. Sorry if this is a problem caused by a MacOS issue!
Backtrace
hdevalence@deimos terra % RUST_BACKTRACE=1 cargo run --features soft-float64 --release
Finished release [optimized + debuginfo] target(s) in 0.29s
Running `target/release/preview`
thread '<unnamed>' panicked at 'index out of bounds: the len is 0 but the index is 0', src/generate/heightmap.rs:127:27
stack backtrace:
0: rust_begin_unwind
at /rustc/0b644e419681835bd0f5871c3bfbd648aa04f157/library/std/src/panicking.rs:493:5
1: core::panicking::panic_fmt
at /rustc/0b644e419681835bd0f5871c3bfbd648aa04f157/library/core/src/panicking.rs:92:14
2: core::panicking::panic_bounds_check
at /rustc/0b644e419681835bd0f5871c3bfbd648aa04f157/library/core/src/panicking.rs:69:5
3: terra::generate::heightmap::uncompress_heightmap_tile
at ./src/generate/heightmap.rs:127:27
4: terra::generate::heightmap::HeightmapCache::get_tile::{{closure}}
at ./src/generate/heightmap.rs:328:29
5: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /Users/hdevalence/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
6: <core::pin::Pin<P> as core::future::future::Future>::poll
at /Users/hdevalence/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/future.rs:119:9
7: terra::stream::TileStreamer::run::{{closure}}::{{closure}}
at ./src/stream.rs:117:73
8: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /Users/hdevalence/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
9: <core::pin::Pin<P> as core::future::future::Future>::poll
at /Users/hdevalence/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/future.rs:119:9
10: <futures_util::stream::futures_unordered::FuturesUnordered<Fut> as futures_core::stream::Stream>::poll_next
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.9/src/stream/futures_unordered/mod.rs:542:17
11: futures_util::stream::stream::StreamExt::poll_next_unpin
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.9/src/stream/stream/mod.rs:1407:9
12: <futures_util::stream::stream::select_next_some::SelectNextSome<St> as core::future::future::Future>::poll
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.9/src/stream/stream/select_next_some.rs:34:36
13: <core::pin::Pin<P> as core::future::future::Future>::poll
at /Users/hdevalence/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/future.rs:119:9
14: futures_util::future::future::FutureExt::poll_unpin
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.9/src/future/future/mod.rs:561:9
15: terra::stream::TileStreamer::run::{{closure}}::{{closure}}::{{closure}}
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.9/src/async_await/select_mod.rs:326:13
16: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &mut F>::call_mut
at /Users/hdevalence/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/ops/function.rs:269:13
17: terra::stream::TileStreamer::run::{{closure}}::{{closure}}
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.9/src/async_await/select_mod.rs:326:13
18: <futures_util::future::poll_fn::PollFn<F> as core::future::future::Future>::poll
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/futures-util-0.3.9/src/future/poll_fn.rs:54:9
19: terra::stream::TileStreamer::run::{{closure}}
at ./src/stream.rs:110:13
20: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
at /Users/hdevalence/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/future/mod.rs:80:19
21: tokio::park::thread::CachedParkThread::block_on::{{closure}}
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.0.1/src/park/thread.rs:263:54
22: tokio::coop::with_budget::{{closure}}
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.0.1/src/coop.rs:121:9
23: std::thread::local::LocalKey<T>::try_with
at /Users/hdevalence/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:272:16
24: std::thread::local::LocalKey<T>::with
at /Users/hdevalence/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/std/src/thread/local.rs:248:9
25: tokio::coop::with_budget
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.0.1/src/coop.rs:114:5
26: tokio::coop::budget
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.0.1/src/coop.rs:98:5
27: tokio::park::thread::CachedParkThread::block_on
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.0.1/src/park/thread.rs:263:31
28: tokio::runtime::enter::Enter::block_on
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.0.1/src/runtime/enter.rs:151:13
29: tokio::runtime::thread_pool::ThreadPool::block_on
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.0.1/src/runtime/thread_pool/mod.rs:71:9
30: tokio::runtime::Runtime::block_on
at /Users/hdevalence/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.0.1/src/runtime/mod.rs:452:43
31: terra::stream::TileStreamerEndpoint::new::{{closure}}
at ./src/stream.rs:55:13
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
The only reason that hardware isn't supported is that I don't have a MacBook on hand to test things on. Happy to work with you to get things running!
From the backtrace you posted, I think a cached heightmap tile might be corrupt. Could you delete your $HOME/Library/Application Support/terra/tiles/heightmaps
directory? The program should re-download everything in there on the next run.
Hmm, I don't think I have a $HOME/Library/Application Support/terra
.
Could you figure out where TERRA_DIRECTORY points to? The documentation for config_dir does suggest it should have been that path.
Lines 19 to 20 in 930d9d6
The panic seems to be accessing the very first byte of a file that should be in that directory... so if it has gone missing that would certainly explain things.
On my machine, TERRA_DIRECTORY
turns into /Users/hdevalence/Library/Caches/terra
, which does have stuff in it, but not a heightmaps
directory:
hdevalence@deimos terra % ls -l /Users/hdevalence/Library/Caches/terra
total 271176
-rw-r--r-- 1 hdevalence staff 29082084 Jan 12 19:45 eso0932a.tif
-rw-r--r-- 1 hdevalence staff 16777216 Jan 12 19:45 inscattering.raw
-rw-r--r-- 1 hdevalence staff 16777338 Jan 12 19:45 noise.bmp
-rw-r--r-- 1 hdevalence staff 72000122 Jan 12 19:45 sky.bmp
drwxr-xr-x 6 hdevalence staff 192 Jan 12 19:45 tiles
-rw-r--r-- 1 hdevalence staff 4194304 Jan 12 19:45 transmittance.raw
Could you try deleting the whole directory?
Woohoo! After deleting the whole directory, I got some command-line messages with progress bars as it was building some data, and then it launched into a magenta screen (which does seem like potentially a platform issue).
I'm curious why it worked after deleting the whole directory but not on the first time -- could it be that because the first time I ran Terra, I didn't use --features soft-float64
, the data was corrupt because it was interrupted before it could be generated?