Open hango-hango opened 4 years ago
memory leak is not possible, because no malloc
is used. I have run for hours and no memory leak found.
memory leak is not possible, because no
malloc
is used. I have run for hours and no memory leak found.
I checked my code again and found some problem. When I submit invalid nonce to the chain, it causes this memory problem. I think that may be something wrong with my own enviroment as well. Please note the error output in my terminal as below if it is nessary:
http.worker6 ERROR ckb-rpc [393] submit_block error: Error { kind: HeaderError { kind: InvalidNonce
stack backtrace:
0: failure::backtrace::internal::InternalBacktrace::new
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/backtrace/internal.rs:44
1: failure::backtrace::Backtrace::new
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/backtrace/mod.rs:111
<failure::backtrace::Backtrace as core::default::Default>::default
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/backtrace/mod.rs:125
2: <failure::error::error_impl::ErrorImpl as core::convert::From<F>>::from
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/error/error_impl.rs:19
3: <failure::error::Error as core::convert::From<F>>::from
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/error/mod.rs:36
<T as core::convert::Into<U>>::into
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/convert.rs:544
failure::context::Context<D>::with_err
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/context.rs:105
failure::Fail::context
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/failure-0.1.5/src/lib.rs:160
ckb_verification::convert::<impl core::convert::From<ckb_verification::error::PowError> for ckb_verification::error::HeaderError>::from
at /ckb/<::ckb_error::util::impl_error_conversion_with_kind macros>:6
<T as core::convert::Into<U>>::into
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/convert.rs:544
ckb_verification::convert::<impl core::convert::From<ckb_verification::error::PowError> for ckb_error::Error>::from
at /ckb/<::ckb_error::util::impl_error_conversion_with_adaptor macros>:7
<T as core::convert::Into<U>>::into
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/convert.rs:544
ckb_verification::header_verifier::PowVerifier::verify
at verification/src/header_verifier.rs:151
4: <ckb_verification::header_verifier::HeaderVerifier<T,M> as ckb_verification::Verifier>::verify
at /ckb/verification/src/header_verifier.rs:42
5: <ckb_rpc::module::miner::MinerRpcImpl as ckb_rpc::module::miner::rpc_impl_MinerRpc::MinerRpc>::submit_block
at rpc/src/module/miner.rs:86
6: ckb_rpc::module::miner::rpc_impl_MinerRpc::MinerRpc::to_delegate::{{closure}}
at rpc/src/module/miner.rs:17
<jsonrpc_core::delegates::DelegateAsyncMethod<T,F> as jsonrpc_core::calls::RpcMethod<M>>::call
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-core-10.1.0/src/delegates.rs:26
7: jsonrpc_core::io::MetaIoHandler<T,S>::handle_call::{{closure}}::{{closure}}::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/jsonrpc-core-10.1.0/src/io.rs:254
futures::future::lazy::Lazy<F,R>::get
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/lazy.rs:64
<futures::future::lazy::Lazy<F,R> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/lazy.rs:82
8: futures::future::chain::Chain<A,B,C>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/chain.rs:26
9: <futures::future::then::Then<A,B,F> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/then.rs:32
10: <futures::future::either::Either<A,B> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/mod.rs:0
<futures::future::map::Map<A,F> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/map.rs:30
11: <futures::future::either::Either<A,B> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/either.rs:35
<futures::future::either::Either<A,B> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/either.rs:36
<futures::future::either::Either<A,B> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/either.rs:36
12: <futures::future::map::Map<A,F> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/map.rs:30
13: <jsonrpc_http_server::handler::RpcHandler<M,S> as futures::future::Future>::poll
at /usr/local/cargo/git/checkouts/jsonrpc-7d864fd3b556128f/7c101f8/http/src/handler.rs:314
14: <jsonrpc_http_server::handler::RpcHandler<M,S> as futures::future::Future>::poll
at /usr/local/cargo/git/checkouts/jsonrpc-7d864fd3b556128f/7c101f8/http/src/handler.rs:359
15: <jsonrpc_http_server::handler::RpcHandler<M,S> as futures::future::Future>::poll
at /usr/local/cargo/git/checkouts/jsonrpc-7d864fd3b556128f/7c101f8/http/src/handler.rs:359
16: <jsonrpc_http_server::handler::Handler<M,S> as futures::future::Future>::poll
at /usr/local/cargo/git/checkouts/jsonrpc-7d864fd3b556128f/7c101f8/http/src/handler.rs:153
17: <hyper::proto::h1::dispatch::Server<S> as hyper::proto::h1::dispatch::Dispatch>::poll_msg
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.35/src/proto/h1/dispatch.rs:405
hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_write
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.35/src/proto/h1/dispatch.rs:263
hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_loop
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.35/src/proto/h1/dispatch.rs:130
hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_inner
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.35/src/proto/h1/dispatch.rs:106
hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T>::poll_catch
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.35/src/proto/h1/dispatch.rs:93
18: <hyper::proto::h1::dispatch::Dispatcher<D,Bs,I,T> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.35/src/proto/h1/dispatch.rs:374
<futures::future::either::Either<A,B> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/either.rs:35
futures::future::option::<impl futures::future::Future for core::option::Option<F>>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/option.rs:12
<hyper::server::conn::upgrades::UpgradeableConnection<I,S,E> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.35/src/server/conn.rs:948
19: <hyper::common::drain::Watching<F,FN> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.35/src/common/drain.rs:105
20: <hyper::server::conn::spawn_all::NewSvcTask<I,N,S,E,W> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/hyper-0.12.35/src/server/conn.rs:888
21: <alloc::boxed::Box<F> as futures::future::Future>::poll
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/future/mod.rs:113
futures::task_impl::Spawn<T>::poll_future_notify::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/task_impl/mod.rs:329
futures::task_impl::Spawn<T>::enter::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/task_impl/mod.rs:399
futures::task_impl::std::set
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/task_impl/std/mod.rs:83
22: futures::task_impl::Spawn<T>::enter
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/task_impl/mod.rs:399
futures::task_impl::Spawn<T>::poll_fn_notify
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/task_impl/mod.rs:291
futures::task_impl::Spawn<T>::poll_future_notify
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/futures-0.1.29/src/task_impl/mod.rs:329
23: tokio_current_thread::scheduler::Scheduled<U>::tick
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-current-thread-0.1.6/src/scheduler.rs:351
tokio_current_thread::scheduler::Scheduler<U>::tick::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-current-thread-0.1.6/src/scheduler.rs:330
tokio_current_thread::Borrow<U>::enter::{{closure}}::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-current-thread-0.1.6/src/lib.rs:788
tokio_current_thread::CurrentRunner::set_spawn
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-current-thread-0.1.6/src/lib.rs:825
24: tokio_current_thread::Borrow<U>::enter::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-current-thread-0.1.6/src/lib.rs:788
std::thread::local::LocalKey<T>::try_with
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/local.rs:262
std::thread::local::LocalKey<T>::with
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/local.rs:239
tokio_current_thread::Borrow<U>::enter
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-current-thread-0.1.6/src/lib.rs:786
tokio_current_thread::scheduler::Scheduler<U>::tick
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-current-thread-0.1.6/src/scheduler.rs:330
25: tokio_current_thread::Entered<P>::tick
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-current-thread-0.1.6/src/lib.rs:612
tokio_current_thread::Entered<P>::block_on
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-current-thread-0.1.6/src/lib.rs:502
26: tokio::runtime::current_thread::runtime::Runtime::block_on::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.22/src/runtime/current_thread/runtime.rs:200
tokio::runtime::current_thread::runtime::Runtime::enter::{{closure}}::{{closure}}::{{closure}}::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.22/src/runtime/current_thread/runtime.rs:241
tokio_executor::global::with_default::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-executor-0.1.8/src/global.rs:209
std::thread::local::LocalKey<T>::try_with
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/local.rs:262
std::thread::local::LocalKey<T>::with
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/local.rs:239
27: tokio_executor::global::with_default
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-executor-0.1.8/src/global.rs:178
tokio::runtime::current_thread::runtime::Runtime::enter::{{closure}}::{{closure}}::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.22/src/runtime/current_thread/runtime.rs:239
tokio_timer::timer::handle::with_default::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-timer-0.2.10/src/timer/handle.rs:94
std::thread::local::LocalKey<T>::try_with
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/local.rs:262
std::thread::local::LocalKey<T>::with
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/local.rs:239
28: tokio_timer::timer::handle::with_default
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-timer-0.2.10/src/timer/handle.rs:81
tokio::runtime::current_thread::runtime::Runtime::enter::{{closure}}::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.22/src/runtime/current_thread/runtime.rs:232
tokio_timer::clock::clock::with_default::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-timer-0.2.10/src/clock/clock.rs:141
std::thread::local::LocalKey<T>::try_with
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/local.rs:262
std::thread::local::LocalKey<T>::with
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/local.rs:239
29: tokio_timer::clock::clock::with_default
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-timer-0.2.10/src/clock/clock.rs:124
tokio::runtime::current_thread::runtime::Runtime::enter::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.22/src/runtime/current_thread/runtime.rs:231
tokio_reactor::with_default::{{closure}}
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-reactor-0.1.9/src/lib.rs:237
std::thread::local::LocalKey<T>::try_with
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/local.rs:262
std::thread::local::LocalKey<T>::with
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/local.rs:239
30: tokio_reactor::with_default
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-reactor-0.1.9/src/lib.rs:217
tokio::runtime::current_thread::runtime::Runtime::enter
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.22/src/runtime/current_thread/runtime.rs:230
tokio::runtime::current_thread::runtime::Runtime::block_on
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.22/src/runtime/current_thread/runtime.rs:198
31: tokio::runtime::current_thread::block_on_all
at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-0.1.22/src/runtime/current_thread/mod.rs:92
32: jsonrpc_http_server::serve::{{closure}}
at /usr/local/cargo/git/checkouts/jsonrpc-7d864fd3b556128f/7c101f8/http/src/lib.rs:518
std::sys_common::backtrace::__rust_begin_short_backtrace
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/sys_common/backtrace.rs:77
33: std::thread::Builder::spawn_unchecked::{{closure}}::{{closure}}
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/mod.rs:470
<std::panic::AssertUnwindSafe<F> as core::ops::function::FnOnce<()>>::call_once
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/panic.rs:315
std::panicking::try::do_call
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/panicking.rs:296
34: __rust_maybe_catch_panic
at src/libpanic_unwind/lib.rs:80
35: std::panicking::try
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/panicking.rs:275
std::panic::catch_unwind
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/panic.rs:394
std::thread::Builder::spawn_unchecked::{{closure}}
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libstd/thread/mod.rs:469
core::ops::function::FnOnce::call_once{{vtable.shim}}
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/libcore/ops/function.rs:235
36: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/liballoc/boxed.rs:787
37: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once
at /rustc/625451e376bb2e5283fc4741caa0a3e8a2ca4d54/src/liballoc/boxed.rs:787
std::sys_common::thread::start_thread
at src/libstd/sys_common/thread.rs:13
std::sys::unix::thread::Thread::new::thread_start
at src/libstd/sys/unix/thread.rs:79
38: start_thread
39: __clone
Pow }
Header }
I repeat your experiment, memory leak still not found.
Environment ubuntu 18.04 LTS x64
Describe the bug I get a serious memory leak with the version 0.22.0
step 1: I start a ckb node with the newest ckb version (0.22.0) in my ubuntu system. step 2: Edit "ckb-miner.toml" file in the ckb-miner folder. I modified the line: "cpus=2" in [miner] option to configure 2 cpu cores for miner. And no gpu used with the default option in [miner.gpus] "gpu_ids=[0]" step 3: Then start ckb-miner. In 14:58, I have almost 14GB memory left. But after 7 minutes later the free menory only has 6GB left. The usage of memory by "ckb-miner" progress is 6GB but 7 minutes ago, this value is just 600MB . So I think it is a serious memory leak with the ckb-miner program.