Skip to content

crash in capacity overflow on SequentialReader in vec alloc #252

Description

@harryhaaren

Hi All,

I'm seeing a crashing issue after a few days of serving pages successfully. I'm not sure what the incoming request is (if there is one specific one is also unkown..) it seems like an out-of-memory "OOM" type issue, but the capacity-overflow error, which also seems to occur when .collect() is called on an infinite iterator (user-lang bug report & related discussion).

A similar issue seems to have occurred in rust-analyzer at some point but I'm not sure if/how that solution applies to the tiny-http codebase.

I've added a std::env::set_var() call to set the RUST_BACKTRACE=full for the program, which gives the below stack-trace for indicating where things are going wrong (as suggested in the discussion here)

Thoughts or input appreciated; this is for a toy website but I'd like to understand/fix it.

/// normal behaviour, serving pages as expected, then:

thread '<unnamed>' panicked at library/alloc/src/raw_vec.rs:545:5:
capacity overflow
stack backtrace:
   0:     0x56070a094dfc - std::backtrace_rs::backtrace::libunwind::trace::heeb1a1d1e2dbc154 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x56070a094dfc - std::backtrace_rs::backtrace::trace_unsynchronized::h59b496b09972492a at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
... <snip bunch of rust-panic backtrace code> ...
  15:     0x560709ebc905 - core::panicking::panic_fmt::h1f0a3a584d873149 at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library/core/src/panicking.rs:72:14
  16:     0x56070a0b49cf - alloc::raw_vec::capacity_overflow::h4830d61c7a2080df at /rustc/de686cbc65478db53e3d51c52497685e852cc092/library/alloc/src/raw_vec.rs:545:5
  17:     0x560709fdb746 - <tiny_http::util::equal_reader::EqualReader<R> as core::ops::drop::Drop>::drop::hcef8d364da48367b
  18:     0x560709fb843c - core::ptr::drop_in_place<tiny_http::util::equal_reader::EqualReader<tiny_http::util::sequential::SequentialReader<std::io::buffered::bufreader::BufReader<tiny_http::util::refined_tcp_stream::RefinedTcpStream>>>>::h6a8ca82231c133d5
  19:     0x560709ecb15b - core::ptr::drop_in_place<tiny_http::request::Request>::h9d7ea4fa29835dc0
  20:     0x560709ecdd7d - my_webserver::serve_https::h853dce33341b3390

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions