crypto-crawler / crypto-crawler-rs

A rock-solid cryptocurrency crawler library.
Apache License 2.0
230 stars 74 forks source link

Stack overflow on Hello World #21

Open TrueBers opened 2 years ago

TrueBers commented 2 years ago

rustc 1.60.0 (7737e0b5c 2022-04-04)

Window 11 10.0.22000 Build 22000

main.rs:

use crypto_crawler::{crawl_trade, MarketType};

#[tokio::main]
async fn main() {
    let (tx, rx) = std::sync::mpsc::channel();
    tokio::task::spawn(async move {
        for msg in rx {
            println!("{}", msg);
        }
    });

    crawl_trade("binance", MarketType::Spot, None, tx).await;
}

Cargo.toml:

[package]
name = "crypto_test"
version = "0.1.0"
edition = "2021"

[dependencies]
tokio = { version = "1", features = ["full"] }
crypto-crawler = "*"
> cargo run

thread 'main' has overflowed its stack
error: process didn't exit successfully: `target\debug\crypto_test.exe` (exit code: 0xc00000fd, STATUS_STACK_OVERFLOW)
Callstack ``` (665c.31a0): Stack overflow - code c00000fd (first chance) First chance exceptions are reported before any exception handling. This exception may be expected and handled. *** WARNING: Unable to verify checksum for crypto_test.exe crypto_test!__chkstk+0x37: 00007ff7`4a62c887 41c60300 mov byte ptr [r11],0 ds:0000008c`6af06000=00 0:000> k # Child-SP RetAddr Call Site 00 0000008c`6af08cd8 00007ff7`4992d3db crypto_test!__chkstk+0x37 [d:\a01\_work\43\s\src\vctools\crt\vcstartup\src\misc\amd64\chkstk.asm @ 109] 01 0000008c`6af08cf0 00007ff7`49918e7d crypto_test!tungstenite::handshake::machine::HandshakeMachine > > >::single_round > >,http::response::Response > >+0xb [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tungstenite-0.17.2\src\handshake\machine.rs @ 39] 02 0000008c`6af08d00 00007ff7`4988bb82 crypto_test!tungstenite::handshake::MidHandshake > > > >::handshake > > > >+0x8d [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tungstenite-0.17.2\src\handshake\mod.rs @ 42] 03 0000008c`6af0ccf0 00007ff7`49972638 crypto_test!tokio_tungstenite::client_async_with_config::async_fn$0::closure$0 >,enum$ > >+0x282 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-tungstenite-0.17.1\src\lib.rs @ 102] 04 0000008c`6af0e550 00007ff7`499712e7 crypto_test!tokio_tungstenite::handshake::impl$1::poll > > >,tokio_tungstenite::client_async_with_config::async_fn$0::closure_env$0 >,enum$ > >,enum$ > >+0x278 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-tungstenite-0.17.1\src\handshake.rs @ 138] 05 0000008c`6af11d70 00007ff7`499001f7 crypto_test!tokio_tungstenite::handshake::handshake::async_fn$0 > > >,tokio_tungstenite::client_async_with_config::async_fn$0::closure_env$0 >,enum$ > >,enum$ > >+0x2e7 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-tungstenite-0.17.1\src\handshake.rs @ 78] 06 0000008c`6af16d60 00007ff7`49971a39 crypto_test!core::future::from_generator::impl$1::poll > > >,tokio_tungstenite::client_async_with_config::async_fn$0::closure_env$0 >,enum$ > >,enum$ > > >+0x87 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 07 0000008c`6af178f0 00007ff7`49901ca7 crypto_test!tokio_tungstenite::handshake::client_handshake::async_fn$0 >,enum$ > >,enum$ > >+0x1f9 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-tungstenite-0.17.1\src\handshake.rs @ 100] 08 0000008c`6af1c8b0 00007ff7`4988b7c0 crypto_test!core::future::from_generator::impl$1::poll >,enum$ > >,enum$ > > >+0x87 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 09 0000008c`6af1d440 00007ff7`49901177 crypto_test!tokio_tungstenite::client_async_with_config::async_fn$0 >,enum$ > >+0x290 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-tungstenite-0.17.1\src\lib.rs @ 104] 0a 0000008c`6af21c30 00007ff7`498b2a3b crypto_test!core::future::from_generator::impl$1::poll >,enum$ > > >+0x87 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 0b 0000008c`6af227c0 00007ff7`499049b7 crypto_test!tokio_tungstenite::tls::client_async_tls_with_config::async_fn$0 >,tokio::net::tcp::stream::TcpStream>+0xdab [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-tungstenite-0.17.1\src\tls.rs @ 226] 0c 0000008c`6af28cf0 00007ff7`4992fa8f crypto_test!core::future::from_generator::impl$1::poll >,tokio::net::tcp::stream::TcpStream> >+0x87 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 0d 0000008c`6af29880 00007ff7`498ffda7 crypto_test!tokio_tungstenite::connect::connect_async_with_config::async_fn$0+0x98f [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-tungstenite-0.17.1\src\connect.rs @ 51] 0e 0000008c`6af2e2b0 00007ff7`4992ef5d crypto_test!core::future::from_generator::impl$1::poll >+0x87 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 0f 0000008c`6af2ee40 00007ff7`498ffb87 crypto_test!tokio_tungstenite::connect::connect_async::async_fn$0+0x17d [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-tungstenite-0.17.1\src\connect.rs @ 22] 10 0000008c`6af32a40 00007ff7`499555fd crypto_test!core::future::from_generator::impl$1::poll >+0x87 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 11 0000008c`6af335d0 00007ff7`499000e7 crypto_test!crypto_ws_client::common::connect_async::connect_async::async_fn$0+0x49d [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\crypto-ws-client-4.10.6\src\common\connect_async.rs @ 57] 12 0000008c`6af3e9c0 00007ff7`49937d86 crypto_test!core::future::from_generator::impl$1::poll+0x87 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 13 0000008c`6af3ec10 00007ff7`49900397 crypto_test!crypto_ws_client::common::ws_client_internal::impl$0::connect::async_fn$0+0x2c6 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\crypto-ws-client-4.10.6\src\common\ws_client_internal.rs @ 48] 14 0000008c`6af422d0 00007ff7`498697c8 crypto_test!core::future::from_generator::impl$1::poll >+0x87 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 15 0000008c`6af42430 00007ff7`499033b7 crypto_test!crypto_ws_client::clients::binance::impl$0::new::async_fn$0+0x258 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\crypto-ws-client-4.10.6\src\clients\binance.rs @ 84] 16 0000008c`6af45aa0 00007ff7`499abf64 crypto_test!core::future::from_generator::impl$1::poll >+0x87 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 17 0000008c`6af45c10 00007ff7`498fe14f crypto_test!crypto_crawler::crawlers::utils::create_ws_client_internal::async_fn$0+0x15b4 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\crypto-crawler-4.2.2\src\crawlers\utils.rs @ 370] 18 0000008c`6afbb3e0 00007ff7`499b0e97 crypto_test!core::future::from_generator::impl$1::poll+0x5f [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 19 0000008c`6afbb480 00007ff7`498ff8ff crypto_test!crypto_crawler::crawlers::utils::create_ws_client::async_fn$0+0x557 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\crypto-crawler-4.2.2\src\crawlers\utils.rs @ 495] 1a 0000008c`6afc2fe0 00007ff7`499b20a0 crypto_test!core::future::from_generator::impl$1::poll+0x5f [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 1b 0000008c`6afc3080 00007ff7`498fc461 crypto_test!crypto_crawler::crawlers::utils::crawl_event_one_chunk::async_fn$0+0x450 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\crypto-crawler-4.2.2\src\crawlers\utils.rs @ 679] 1c 0000008c`6afc6cd0 00007ff7`499b479f crypto_test!core::future::from_generator::impl$1::poll+0x81 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 1d 0000008c`6afc6d80 00007ff7`49903499 crypto_test!crypto_crawler::crawlers::utils::crawl_event::async_fn$0+0x1b7f [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\crypto-crawler-4.2.2\src\crawlers\utils.rs @ 811] 1e 0000008c`6afd3f00 00007ff7`498bf528 crypto_test!core::future::from_generator::impl$1::poll+0x59 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 1f 0000008c`6afd3f80 00007ff7`499006f9 crypto_test!crypto_crawler::crawlers::binance::crawl_trade::async_fn$0+0xa88 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\crypto-crawler-4.2.2\src\crawlers\binance.rs @ 38] 20 0000008c`6afdb400 00007ff7`498858ea crypto_test!core::future::from_generator::impl$1::poll+0x59 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 21 0000008c`6afdb480 00007ff7`498fd349 crypto_test!crypto_crawler::crawl_trade::async_fn$0+0x3ea [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\crypto-crawler-4.2.2\src\lib.rs @ 239] 22 0000008c`6afeae00 00007ff7`49996227 crypto_test!core::future::from_generator::impl$1::poll+0x59 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 23 0000008c`6afeae80 00007ff7`49900929 crypto_test!crypto_test::main::async_block$0+0x2c7 [d:\DEV\PROJ\crypto_test\src\main.rs @ 12] 24 0000008c`6afeeff0 00007ff7`498c495a crypto_test!core::future::from_generator::impl$1::poll+0x59 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\future\mod.rs @ 84] 25 0000008c`6afef070 00007ff7`498c57a9 crypto_test!tokio::park::thread::impl$5::block_on::closure$0 >+0x4a [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.2\src\park\thread.rs @ 263] 26 0000008c`6afef0e0 00007ff7`499a9842 crypto_test!tokio::coop::with_budget::closure$0 > >,tokio::park::thread::impl$5::block_on::closure_env$0 > >+0xa9 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.2\src\coop.rs @ 102] 27 0000008c`6afef170 00007ff7`499a962d crypto_test!std::thread::local::LocalKey >::try_with,tokio::coop::with_budget::closure_env$0 > >,tokio::park::thread::impl$5::block_on::closure_env$0 > >,enum$ > > >+0xa2 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\std\src\thread\local.rs @ 413] 28 0000008c`6afef230 00007ff7`498c4753 crypto_test!std::thread::local::LocalKey >::with,tokio::coop::with_budget::closure_env$0 > >,tokio::park::thread::impl$5::block_on::closure_env$0 > >,enum$ > > >+0x2d [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\std\src\thread\local.rs @ 389] 29 (Inline Function) --------`-------- crypto_test!tokio::coop::with_budget+0x2e [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.2\src\coop.rs @ 95] 2a (Inline Function) --------`-------- crypto_test!tokio::coop::budget+0x90 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.2\src\coop.rs @ 72] 2b 0000008c`6afef280 00007ff7`4996769b crypto_test!tokio::park::thread::CachedParkThread::block_on >+0x253 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.2\src\park\thread.rs @ 263] 2c 0000008c`6aff1480 00007ff7`4987d09d crypto_test!tokio::runtime::enter::Enter::block_on >+0x7b [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.2\src\runtime\enter.rs @ 151] 2d 0000008c`6aff3580 00007ff7`49996706 crypto_test!tokio::runtime::thread_pool::ThreadPool::block_on >+0x7d [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.2\src\runtime\thread_pool\mod.rs @ 81] 2e 0000008c`6aff5680 00007ff7`498eb252 crypto_test!tokio::runtime::Runtime::block_on >+0x106 [C:\Users\user\.cargo\registry\src\github.com-1ecc6299db9ec823\tokio-1.18.2\src\runtime\mod.rs @ 477] 2f 0000008c`6aff9780 00007ff7`4988fd7b crypto_test!crypto_test::main+0xf2 [d:\DEV\PROJ\crypto_test\src\main.rs @ 12] 30 0000008c`6afffa60 00007ff7`4996c66b crypto_test!core::ops::function::FnOnce::call_once >+0xb [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\ops\function.rs @ 227] 31 0000008c`6afffaa0 00007ff7`498651a1 crypto_test!std::sys_common::backtrace::__rust_begin_short_backtrace >+0x1b [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\std\src\sys_common\backtrace.rs @ 125] 32 0000008c`6afffae0 00007ff7`4a5f8baf crypto_test!std::rt::lang_start::closure$0 >+0x11 [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\std\src\rt.rs @ 145] 33 (Inline Function) --------`-------- crypto_test!core::ops::function::impls::impl$2::call_once+0xb [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\core\src\ops\function.rs @ 259] 34 (Inline Function) --------`-------- crypto_test!std::panicking::try::do_call+0xb [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\std\src\panicking.rs @ 492] 35 (Inline Function) --------`-------- crypto_test!std::panicking::try+0xb [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\std\src\panicking.rs @ 456] 36 (Inline Function) --------`-------- crypto_test!std::panic::catch_unwind+0xb [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\std\src\panic.rs @ 137] 37 (Inline Function) --------`-------- crypto_test!std::rt::lang_start_internal::closure$2+0xb [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\std\src\rt.rs @ 128] 38 (Inline Function) --------`-------- crypto_test!std::panicking::try::do_call+0xb [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\std\src\panicking.rs @ 492] 39 (Inline Function) --------`-------- crypto_test!std::panicking::try+0xb [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\std\src\panicking.rs @ 456] 3a (Inline Function) --------`-------- crypto_test!std::panic::catch_unwind+0xb [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\std\src\panic.rs @ 137] 3b 0000008c`6afffb20 00007ff7`4986516f crypto_test!std::rt::lang_start_internal+0x11f [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\/library\std\src\rt.rs @ 128] 3c 0000008c`6afffc00 00007ff7`498eb346 crypto_test!std::rt::lang_start >+0x2f [/rustc/7737e0b5c4103216d6fd8cf941b7ab9bdbaace7c\library\std\src\rt.rs @ 144] 3d 0000008c`6afffc60 00007ff7`4a62cabc crypto_test!main+0x16 3e (Inline Function) --------`-------- crypto_test!invoke_main+0x22 [d:\a01\_work\43\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 78] 3f 0000008c`6afffc90 00007ffc`319254e0 crypto_test!__scrt_common_main_seh+0x10c [d:\a01\_work\43\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl @ 288] 40 0000008c`6afffcd0 00007ffc`3232485b KERNEL32!BaseThreadInitThunk+0x10 41 0000008c`6afffd00 00000000`00000000 ntdll!RtlUserThreadStart+0x2b ```

It seems between frame 17 and 18 a bunch of state data (500Kb) is allocated on stack instead of heap or something. Don't have much time to investigate, sorry.

soulmachine commented 2 years ago

Thanks for reporting this, I'll find a Windows machine and test it.