@@ -21,7 +21,6 @@ use parking_lot::{Condvar, Mutex};
2121use rand_08:: { prelude:: StdRng , rngs:: OsRng , SeedableRng } ;
2222use threadpool:: ThreadPool ;
2323
24- use crate :: keylib:: KeyPair ;
2524use blockgen:: BlockGenerator ;
2625use cfx_executor:: machine:: { Machine , VmFactory } ;
2726use cfx_parameters:: genesis:: {
@@ -65,6 +64,7 @@ use cfx_config::{parse_config_address_string, Configuration};
6564
6665use crate :: {
6766 accounts:: { account_provider, keys_path} ,
67+ keylib:: KeyPair ,
6868 rpc:: {
6969 extractor:: RpcExtractor ,
7070 impls:: {
@@ -74,6 +74,7 @@ use crate::{
7474 launch_async_rpc_servers, setup_debug_rpc_apis, setup_public_rpc_apis,
7575 } ,
7676} ;
77+ use cfx_mallocator_utils:: start_pprf_server;
7778use cfxcore:: consensus:: pos_handler:: read_initial_nodes_from_file;
7879
7980pub mod delegate_convert;
@@ -656,9 +657,6 @@ pub fn initialize_not_light_node_modules(
656657 accounts,
657658 ) ) ;
658659
659- let task_manager = TaskManager :: new ( tokio_runtime. handle ( ) . clone ( ) ) ;
660- let task_executor = task_manager. executor ( ) ;
661-
662660 let debug_rpc_http_server = super :: rpc:: start_http (
663661 conf. local_http_config ( ) ,
664662 setup_debug_rpc_apis (
@@ -718,7 +716,8 @@ pub fn initialize_not_light_node_modules(
718716 setup_public_rpc_apis ( common_impl, rpc_impl, pubsub, & conf) ,
719717 ) ?;
720718
721- network. start ( ) ;
719+ let task_manager = TaskManager :: new ( tokio_runtime. handle ( ) . clone ( ) ) ;
720+ let task_executor = task_manager. executor ( ) ;
722721
723722 let eth_rpc_server_handle =
724723 tokio_runtime. block_on ( launch_async_rpc_servers (
@@ -730,8 +729,21 @@ pub fn initialize_not_light_node_modules(
730729 conf,
731730 ) ) ?;
732731
732+ // start pprf server, which is used to serve the pprof data for heap
733+ // profiling
734+ if let Some ( pprf_addr) = conf. raw_conf . profiling_listen_addr . as_ref ( ) {
735+ let pprf_addr = pprf_addr. clone ( ) ;
736+ let _pprf_server_handle = tokio_runtime. spawn ( async move {
737+ if let Err ( e) = start_pprf_server ( & pprf_addr) . await {
738+ eprintln ! ( "Error starting pprof server: {}" , e) ;
739+ }
740+ } ) ;
741+ }
742+
733743 metrics:: initialize ( conf. metrics_config ( ) , task_executor. clone ( ) ) ;
734744
745+ network. start ( ) ;
746+
735747 Ok ( (
736748 data_man,
737749 pow,
0 commit comments