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

Panic in comrak #1046

Closed
alexcrichton opened this issue Sep 6, 2017 · 6 comments
Closed

Panic in comrak #1046

alexcrichton opened this issue Sep 6, 2017 · 6 comments
Labels
B-needs-investigation C-bug 🐞 Category: unintended, undesired behavior

Comments

@alexcrichton
Copy link
Member

I was poking around in logs and found this panic, which unfortunately would take down the server. Unfortunately I don't have the precise text that was being rendered offhand yt

Sep 02 17:50:49 crates-io app/web.1: thread '<unnamed>' panicked at 'byte index 42 is not a char boundary; it is inside '’' (bytes 41..44) of `(Yes, it’s British English, but you won’t have to write “colour” very often. `', /checkout/src/libcore/str/mod.rs:2188:4 
Sep 02 17:50:49 crates-io app/web.1: stack backtrace: 
Sep 02 17:50:49 crates-io app/web.1:    0: std::sys::imp::backtrace::tracing::imp::unwind_backtrace 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libstd/sys/unix/backtrace/tracing/gcc_s.rs:49 
Sep 02 17:50:49 crates-io app/web.1:    1: std::sys_common::backtrace::_print 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libstd/sys_common/backtrace.rs:71 
Sep 02 17:50:49 crates-io app/web.1:    2: std::panicking::default_hook::{{closure}} 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libstd/sys_common/backtrace.rs:60 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libstd/panicking.rs:380 
Sep 02 17:50:49 crates-io app/web.1:    3: std::panicking::default_hook 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libstd/panicking.rs:396 
Sep 02 17:50:49 crates-io app/web.1:    4: std::panicking::rust_panic_with_hook 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libstd/panicking.rs:611 
Sep 02 17:50:49 crates-io app/web.1:    5: std::panicking::begin_panic_new 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libstd/panicking.rs:553 
Sep 02 17:50:49 crates-io app/web.1:    6: std::panicking::begin_panic_fmt 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libstd/panicking.rs:521 
Sep 02 17:50:49 crates-io app/web.1:    7: rust_begin_unwind 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libstd/panicking.rs:497 
Sep 02 17:50:49 crates-io app/web.1:    8: core::panicking::panic_fmt 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libcore/panicking.rs:92 
Sep 02 17:50:49 crates-io app/web.1:    9: core::str::slice_error_fail 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libcore/str/mod.rs:2188 
Sep 02 17:50:49 crates-io app/web.1:   10: comrak::parser::Parser::postprocess_text_node 
Sep 02 17:50:49 crates-io app/web.1:   11: comrak::parser::Parser::postprocess_text_nodes 
Sep 02 17:50:49 crates-io app/web.1:   12: comrak::parser::Parser::postprocess_text_nodes 
Sep 02 17:50:49 crates-io app/web.1:   13: comrak::parser::parse_document 
Sep 02 17:50:49 crates-io app/web.1:   14: comrak::markdown_to_html 
Sep 02 17:50:49 crates-io app/web.1:   15: cargo_registry::render::markdown_to_html 
Sep 02 17:50:49 crates-io app/web.1:   16: cargo_registry::krate::new 
Sep 02 17:50:49 crates-io app/web.1:   17: <cargo_registry::util::C as conduit::Handler>::call 
Sep 02 17:50:49 crates-io app/web.1:   18: <cargo_registry::util::R404 as conduit::Handler>::call 
Sep 02 17:50:49 crates-io app/web.1:   19: <cargo_registry::util::R<H> as conduit::Handler>::call 
Sep 02 17:50:49 crates-io app/web.1:   20: <cargo_registry::util::R404 as conduit::Handler>::call 
Sep 02 17:50:49 crates-io app/web.1:   21: <cargo_registry::util::head::Head as conduit::Handler>::call 
Sep 02 17:50:49 crates-io app/web.1:   22: <cargo_registry::dist::Middleware as conduit::Handler>::call 
Sep 02 17:50:49 crates-io app/web.1:   23: <conduit_middleware::MiddlewareBuilder as conduit::Handler>::call 
Sep 02 17:50:49 crates-io app/web.1:   24: civet::Server::start::internal_handler 
Sep 02 17:50:49 crates-io app/web.1:   25: std::panicking::try::do_call 
Sep 02 17:50:49 crates-io app/web.1:   26: __rust_maybe_catch_panic 
Sep 02 17:50:49 crates-io app/web.1:              at /checkout/src/libpanic_unwind/lib.rs:98 
Sep 02 17:50:49 crates-io app/web.1:   27: civet::raw::raw_handler 
Sep 02 17:50:49 crates-io app/web.1:   28: handle_request 
Sep 02 17:50:49 crates-io app/web.1:   29: worker_thread 
Sep 02 17:50:49 crates-io app/web.1:   30: start_thread 
Sep 02 17:50:49 crates-io app/web.1:   31: clone 
@alexcrichton
Copy link
Member Author

I think the crate may be this one: https://crates.io/crates/ansi_term

@ogham
Copy link

ogham commented Sep 7, 2017

So last night I published ansi_term v0.10.0, got a 500 error, saw that it was listed on crates.io, shrugged, and moved on. This morning I saw that it was gone, so I tried again, and got that same 500 error. Apparently doing that breaks stuff. I won't try and publish it again!

The string that's causing it to fail on occurs in README.txt and in src/lib.rs. It's the first instance of non-ASCII text in those two files.

Here's the output from my perspective:

$ cargo publish --verbose
    Updating registry `https://github.com/rust-lang/crates.io-index`
   Packaging ansi_term v0.10.0 (file:///Users/ben/Code/rust/ansi-term)
   Archiving .gitignore
   Archiving .travis.yml
   Archiving Cargo.toml
   Archiving LICENCE
   Archiving README.md
   Archiving src/ansi.rs
   Archiving src/debug.rs
   Archiving src/difference.rs
   Archiving src/display.rs
   Archiving src/lib.rs
   Archiving src/style.rs
   Archiving src/windows.rs
   Archiving src/write.rs
   Verifying ansi_term v0.10.0 (file:///Users/ben/Code/rust/ansi-term)
   Compiling ansi_term v0.10.0 (file:///Users/ben/Code/rust/ansi-term/target/package/ansi_term-0.10.0)
     Running `rustc --crate-name ansi_term target/package/ansi_term-0.10.0/src/lib.rs --crate-type lib --emit=dep-info,link -C debuginfo=2 -C metadata=58a4c93f70372b5a -C extra-filename=-58a4c93f70372b5a --out-dir /Users/ben/Code/rust/ansi-term/target/package/ansi_term-0.10.0/target/debug/deps -L dependency=/Users/ben/Code/rust/ansi-term/target/package/ansi_term-0.10.0/target/debug/deps`
    Finished dev [unoptimized + debuginfo] target(s) in 1.0 secs
   Uploading ansi_term v0.10.0 (file:///Users/ben/Code/rust/ansi-term)
error: failed to get a 200 OK response, got 500
headers:
    HTTP/1.1 100 Continue



    HTTP/1.1 500 Internal Server Error

    Connection: keep-alive

    Server: nginx

    Date: Thu, 07 Sep 2017 10:32:20 GMT

    Content-Length: 30

    Strict-Transport-Security: max-age=31536000

    Via: 1.1 vegur



body:
Error 404: Not Found
Not Found

@carols10cents
Copy link
Member

Hi! Sorry about this @ogham! It appears to be the characters that are causing a problem for some reason, I've filed a bug with comrak.

In the meantime, I don't want to prevent you from publishing a new version! If you want to publish immediately, I think replacing the characters in your README.md with ' characters should do it (the text in src/lib.rs is not causing this). I'm going to implement a workaround running this replacement on crates.io until the comrak issue is fixed, but that might take me a day or two to deploy.

@carols10cents
Copy link
Member

ACTUALLY I just found out this is fixed in comrak 0.1.9! Updating now!

carols10cents added a commit to integer32llc/crates.io that referenced this issue Sep 10, 2017
bors-voyager bot added a commit that referenced this issue Sep 11, 2017
1048: Upgrade comrak to 0.1.9. Fixes #1046. r=carols10cents
@carols10cents
Copy link
Member

@ogham Deployed the fix to staging and was able to publish ansi_term 0.10.0 without errors and the README is rendering: https://staging-crates-io.herokuapp.com/crates/ansi_term

So I deployed to production! Please try publishing again-- I'm going to close this because I'm pretty confident it's fixed, but please reopen if you still get an error :)

Sorry about that!!

@ogham
Copy link

ogham commented Sep 21, 2017

Thanks for sorting that out! (I got no errors this time, it's all good)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
B-needs-investigation C-bug 🐞 Category: unintended, undesired behavior
Projects
None yet
Development

No branches or pull requests

3 participants