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

nif_panicked does not show the panic message #504

Closed
ishitatsuyuki opened this issue Dec 3, 2022 · 2 comments
Closed

nif_panicked does not show the panic message #504

ishitatsuyuki opened this issue Dec 3, 2022 · 2 comments
Assignees

Comments

@ishitatsuyuki
Copy link
Contributor

It looks like a unwind handler was added in #264, but it ends up discarding the error object containing the panic message:

As a result, the panic message is not shown to the user, making it confusing and annoying to debug.

    ** (EXIT) an exception was raised:
        ** (ErlangError) Erlang error: :nif_panicked
            (myproject 0.1.0) MyProject.ProcessorNative.parse()
            ...

A workaround is to set panic = 'abort' in Cargo profile, however this is rather ugly.

@evnu evnu self-assigned this Dec 5, 2022
@evnu
Copy link
Member

evnu commented Dec 5, 2022

In RustlerTest.ThreadTest, the test thread panic triggers a panic. That test has additional output from the panic:

thread '<unnamed>' panicked at 'threaded_fac: integer overflow', rustler_tests/native/rustler_test/src/test_thread.rs:11:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

I wonder why that is different.

@ishitatsuyuki
Copy link
Contributor Author

Ah, I tested again and it seems it does give the message. When I encountered this it was #72 however, which effectively borked stderr.

Sorry for the noise.

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

No branches or pull requests

2 participants