What's the biggest message hotdog can handle?
rtyler opened this issue · 2 comments
rtyler commented
rsyslog has the maxMessageSize
global variable, which defaults to 8K, after which a message will be truncated from the input socket.
I wonder how long of a message I could send to hotdog
, which doesn't use the same primitive C-style buffer allocation.. 🤔
rtyler commented
Testing with the following script
#!/usr/bin/env ruby
require 'json'
require 'socket'
require 'openssl'
host = 'localhost'
tcp_client = TCPSocket.new(host, 6514)
ssl_client = OpenSSL::SSL::SSLSocket.new(tcp_client)
ssl_client.hostname = host
ssl_client.connect
def format_syslog(buffer)
'<13>1 2020-04-18T15:16:09.956153-07:00 coconut tyler - - [timeQuality tzKnown="1" isSynced="1" syncAccuracy="505061"] ' + buffer + "\n"
end
ssl_client.write format_syslog("#{'0' * 1024} 1024")
ssl_client.write format_syslog("#{'0' * 8192} 8192")
ssl_client.write format_syslog("#{'0' * (2 ** 15)} 32k")
ssl_client.write format_syslog("#{'0' * (2 ** 16)} 64k")
ssl_client.write format_syslog("#{'0' * (2 ** 17)} 128k")
ssl_client.sysclose
tcp_client.close
32K works fine, but the 64K line crashes 🌭 with:
thread 'async-std/executor' panicked at 'assertion failed: `(left == right)`
left: `49152`,
right: `0`', <::std::macros::panic macros>:5:6
stack backtrace:
0: backtrace::backtrace::libunwind::trace
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/libunwind.rs:86
1: backtrace::backtrace::trace_unsynchronized
at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.44/src/backtrace/mod.rs:66
2: std::sys_common::backtrace::_print_fmt
at src/libstd/sys_common/backtrace.rs:78
3: <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt
at src/libstd/sys_common/backtrace.rs:59
4: core::fmt::write
at src/libcore/fmt/mod.rs:1063
5: std::io::Write::write_fmt
at src/libstd/io/mod.rs:1426
6: std::sys_common::backtrace::_print
at src/libstd/sys_common/backtrace.rs:62
7: std::sys_common::backtrace::print
at src/libstd/sys_common/backtrace.rs:49
8: std::panicking::default_hook::{{closure}}
at src/libstd/panicking.rs:204
9: std::panicking::default_hook
at src/libstd/panicking.rs:224
10: std::panicking::rust_panic_with_hook
at src/libstd/panicking.rs:470
11: rust_begin_unwind
at src/libstd/panicking.rs:378
12: std::panicking::begin_panic_fmt
at src/libstd/panicking.rs:332
13: async_std::io::buf_read::lines::read_line_internal
at ./<::std::macros::panic macros>:5
14: <async_std::io::buf_read::lines::Lines<R> as futures_core::stream::Stream>::poll_next
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/io/buf_read/lines.rs:37
15: <async_std::stream::stream::next::NextFuture<T> as core::future::future::Future>::poll
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/stream/stream/next.rs:17
16: std::future::poll_with_tls_context
at /rustc/8d69840ab92ea7f4d323420088dd8c9775f180cd/src/libstd/future.rs:102
17: hotdog::connection::Connection::read_logs::{{closure}}
at src/connection.rs:76
18: <std::future::GenFuture<T> as core::future::future::Future>::poll
at /rustc/8d69840ab92ea7f4d323420088dd8c9775f180cd/src/libstd/future.rs:44
19: std::future::poll_with_tls_context
at /rustc/8d69840ab92ea7f4d323420088dd8c9775f180cd/src/libstd/future.rs:102
20: <hotdog::serve_tls::TlsServer as hotdog::serve::Server>::handle_connection::{{closure}}
at src/serve_tls.rs:61
21: <std::future::GenFuture<T> as core::future::future::Future>::poll
at /rustc/8d69840ab92ea7f4d323420088dd8c9775f180cd/src/libstd/future.rs:44
22: std::future::poll_with_tls_context
at /rustc/8d69840ab92ea7f4d323420088dd8c9775f180cd/src/libstd/future.rs:102
23: async_std::task::builder::Builder::spawn::{{closure}}
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/builder.rs:64
24: <std::future::GenFuture<T> as core::future::future::Future>::poll
at /rustc/8d69840ab92ea7f4d323420088dd8c9775f180cd/src/libstd/future.rs:44
25: async_task::raw::RawTask<F,R,S,T>::run
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-1.3.1/src/raw.rs:505
26: async_task::task::Task<T>::run
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-task-1.3.1/src/task.rs:239
27: async_std::task::builder::Runnable::run::{{closure}}::{{closure}}
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/builder.rs:81
28: async_std::utils::abort_on_panic
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/utils.rs:16
29: async_std::task::builder::Runnable::run::{{closure}}
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/builder.rs:81
30: async_std::task::task::Task::set_current::{{closure}}
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/task.rs:129
31: std::thread::local::LocalKey<T>::try_with
at /rustc/8d69840ab92ea7f4d323420088dd8c9775f180cd/src/libstd/thread/local.rs:262
32: std::thread::local::LocalKey<T>::with
at /rustc/8d69840ab92ea7f4d323420088dd8c9775f180cd/src/libstd/thread/local.rs:239
33: async_std::task::task::Task::set_current
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/task.rs:124
34: async_std::task::builder::Runnable::run
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/builder.rs:81
35: async_std::task::executor::pool::main_loop
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/executor/pool.rs:114
36: core::ops::function::FnOnce::call_once
at /rustc/8d69840ab92ea7f4d323420088dd8c9775f180cd/src/libcore/ops/function.rs:232
37: async_std::utils::abort_on_panic
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/utils.rs:16
38: async_std::task::executor::pool::POOL::{{closure}}::{{closure}}
at /home/tyler/.cargo/registry/src/github.com-1ecc6299db9ec823/async-std-1.5.0/src/task/executor/pool.rs:46
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
rtyler commented
Looks like this crash is only on debug builds