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

Fatal runtime errors for all code built by Rust 1.48 and above #331

Closed
shanemadden opened this issue Oct 24, 2020 · 4 comments · Fixed by #333
Closed

Fatal runtime errors for all code built by Rust 1.48 and above #331

shanemadden opened this issue Oct 24, 2020 · 4 comments · Fixed by #333

Comments

@shanemadden
Copy link
Collaborator

Rust nightly builds have been bumped up to 1.49, and when built with this version both my live bot's code and our sample begin throwing runtime stdweb conversion errors:

RuntimeError: unreachable
    at rust_panic (wasm-function[178]:1)
    at _ZN3std9panicking20rust_panic_with_hook17h1347218c91d128f7E (wasm-function[170]:117)
    at _ZN3std9panicking19begin_panic_handler28_$u7b$$u7b$closure$u7d$$u7d$17hfae94c93fb3d0300E (wasm-function[181]:1)
    at _ZN3std10sys_common9backtrace26__rust_end_short_backtrace17hf812f49b8d150ee0E (wasm-function[180]:6)
    at rust_begin_unwind (wasm-function[27]:52)
    at _ZN4core9panicking9panic_fmt17h6aa2a8f84484b5f7E (wasm-function[24]:48)
    at _ZN4core9panicking5panic17hc886a4cb4479b06eE (wasm-function[14]:67)
    at _ZN148_$LT$stdweb..webcore..serialization..SerializedValue$u20$as$u20$core..convert..From$LT$stdweb..webcore..serialization..SerializedUntaggedF64$GT$$GT$4from17h1f45361611ee357cE (wasm-function[72]:14)
    at _ZN50_$LT$T$u20$as$u20$core..convert..Into$LT$U$GT$$GT$4into17h099fb7234c614c67E (wasm-function[71]:1)

If we're unlucky, this breakage will carry down to stable like it did with #287 👎 ; probably #329 will be our way forward since stdweb isn't showing any signs of life.

@Szpadel
Copy link

Szpadel commented Oct 26, 2020

maybe for now we should report that as regression as described here?
https://blog.rust-lang.org/2020/10/20/regression-labels.html

@ASalvail
Copy link
Collaborator

I suspect the regression is in stdweb, not Rust. There isn't much we can do about that short of forking and patching stdweb, which seems very suboptimal.

@shanemadden shanemadden changed the title Fatal runtime errors for all code built by Rust 1.49 nightly builds Fatal runtime errors for all code built by Rust 1.48 and above Nov 20, 2020
@birktj
Copy link

birktj commented Jan 16, 2021

A workaround is using this patch: koute/stdweb#411 (comment)

@queer-emma
Copy link

A workaround is using this patch: koute/stdweb#411 (comment)

I can confirm that this works:

# append to Cargo.toml

[patch.crates-io]
stdweb = { git = 'https://github.com/arturoc/stdweb.git' }

I was able to change the rust version to 1.51.0 😸

Which also allowed me to install a proper panic handler (although this is a bit off-topic):
pub fn halt() {
    log::warn!("halting execution. run `Memory.halted = false` to continue.");
    screeps::memory::root().set("halted", true);
}

fn main() {
    panic::set_hook(Box::new(|panic_info| {
        if let Some(location) = panic_info.location() {
            log::error!(
                "panic: {}:{}: {}",
                location.file(),
                location.line(),
                panic_info
            );
        } else {
            log::error!("panic: {}", panic_info);
        }

        // use this in your game loop to not execute anything if you want to stop after a panic.
        screeps::memory::root().set("halted", true);
    }));
}

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

Successfully merging a pull request may close this issue.

5 participants