Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
[env]
# Set the number of arenas to 16 when using jemalloc.
JEMALLOC_SYS_WITH_MALLOC_CONF = "abort_conf:true,narenas:16"

66 changes: 33 additions & 33 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 8 additions & 5 deletions common/malloc_utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,19 @@ edition = { workspace = true }
lighthouse_metrics = { workspace = true }
libc = "0.2.79"
parking_lot = { workspace = true }
jemalloc-ctl = { version = "0.5.0", optional = true }
tikv-jemalloc-ctl = { version = "0.5.0", optional = true }

# Jemalloc's background_threads feature requires Linux (pthreads).
[target.'cfg(target_os = "linux")'.dependencies]
jemallocator = { version = "0.5.0", optional = true, features = ["stats", "background_threads"] }
tikv-jemallocator = { version = "0.5.0", optional = true, features = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's bump to 0.6 while we're at it.

It seems jemallocator and tikv-jemallocator were identical until 0.5.4 anyway, and then the 0.6 version was published only to the tikv-jemallocator crate:

The project is also published as jemallocator for historical reasons. The two crates are the same except names. For new projects, it's recommended to use tikv-xxx versions instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped to 0.6.0. Let me know if you wanted to not pin patch version.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now I'm getting stack overflow when testing locally. Increasing the stack to 8MB it doesn't happen.

❯ cargo test
   Compiling beacon_node v5.3.0 (/Users/anda/Developer/lighthouse/beacon_node)
   Compiling network v0.2.0 (/Users/anda/Developer/lighthouse/beacon_node/network)
   Compiling types v0.2.1 (/Users/anda/Developer/lighthouse/consensus/types)
   Compiling beacon_chain v0.2.0 (/Users/anda/Developer/lighthouse/beacon_node/beacon_chain)
   Compiling state_processing v0.2.0 (/Users/anda/Developer/lighthouse/consensus/state_processing)
   Compiling lcli v5.3.0 (/Users/anda/Developer/lighthouse/lcli)
   Compiling validator_client v0.3.5 (/Users/anda/Developer/lighthouse/validator_client)
   Compiling state_transition_vectors v0.1.0 (/Users/anda/Developer/lighthouse/testing/state_transition_vectors)
   Compiling node_test_rig v0.2.0 (/Users/anda/Developer/lighthouse/testing/node_test_rig)
   Compiling watch v0.1.0 (/Users/anda/Developer/lighthouse/watch)
   Compiling database_manager v0.1.0 (/Users/anda/Developer/lighthouse/database_manager)
   Compiling boot_node v5.3.0 (/Users/anda/Developer/lighthouse/boot_node)
   Compiling lighthouse v5.3.0 (/Users/anda/Developer/lighthouse/lighthouse)
   Compiling simulator v0.2.0 (/Users/anda/Developer/lighthouse/testing/simulator)
   Compiling store v0.2.0 (/Users/anda/Developer/lighthouse/beacon_node/store)
   Compiling timer v0.2.0 (/Users/anda/Developer/lighthouse/beacon_node/timer)
    Finished `test` profile [unoptimized + debuginfo] target(s) in 6m 19s
     Running unittests src/lib.rs (target/debug/deps/account_manager-dba67dee002bdd47)

running 0 tests

test result: ok. 0 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

     Running unittests src/lib.rs (target/debug/deps/account_utils-d8946cbf523eb6cc)

running 13 tests
test test::test_password_exactly_min_length ... ok
test test::test_password_over_min_length ... ok
test test::unicode_characters ... ok
test test::test_zeroize_strip_off ... ok
test test::test_strip_off ... ok
test test::test_password_too_short - should panic ... ok
test validator_definitions::tests::voting_keystore_filename_lighthouse ... ok
test validator_definitions::tests::graffiti_checks ... ok
test validator_definitions::tests::gas_limit_checks ... ok
test validator_definitions::tests::builder_proposals_checks ... ok
test validator_definitions::tests::suggested_fee_recipient_checks ... ok
test validator_definitions::tests::voting_keystore_filename_launchpad ... ok
test validator_definitions::tests::voting_keystore_filename_prysm ... ok

test result: ok. 13 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.02s

     Running unittests src/lib.rs (target/debug/deps/beacon_chain-9ba3fc78ed49044f)

running 79 tests
test block_times_cache::test::observed_time_uses_minimum ... ok
test data_availability_checker::overflow_lru_cache::pending_components_tests::invalid_blobs_block_valid_blobs ... ok
test data_availability_checker::overflow_lru_cache::pending_components_tests::invalid_blobs_valid_blobs_block ... ok
test data_availability_checker::overflow_lru_cache::pending_components_tests::valid_blobs_invalid_blobs_block ... ok
test data_availability_checker::overflow_lru_cache::pending_components_tests::block_valid_blobs_invalid_blobs ... ok
test data_availability_checker::overflow_lru_cache::pending_components_tests::valid_blobs_block_invalid_blobs ... ok
test data_availability_checker::overflow_lru_cache::pending_components_tests::valid_block_invalid_blobs_valid_blobs ... ok
test eth1_chain::test::collect_valid_votes::distinct_votes_in_state ... ok
test eth1_chain::test::collect_valid_votes::no_votes_in_state ... ok
test eth1_chain::test::collect_valid_votes::duplicate_votes_in_state ... ok
test eth1_chain::test::eth1_chain_json_backend::deposits_empty_cache ... ok
test eth1_chain::test::eth1_chain_json_backend::eth1_data_empty_cache ... ok
test eth1_chain::test::eth1_chain_json_backend::default_vote ... ok
test eth1_chain::test::slot_start_time ... ok
test eth1_chain::test::winning_vote::all_tying_votes ... ok
test eth1_chain::test::winning_vote::equal_votes ... ok
test eth1_chain::test::winning_vote::no_votes ... ok
test eth1_chain::test::winning_vote::some_votes ... ok
test eth1_chain::test::winning_vote::tying_votes ... ok
test eth1_finalization_cache::tests::fork_at_epoch_boundary ... ok
test eth1_finalization_cache::tests::fully_imported_deposits ... ok
test eth1_chain::test::eth1_data_sets::empty_cache ... ok
test eth1_finalization_cache::tests::partially_imported_deposits ... ok
test eth1_finalization_cache::tests::massive_deposit_queue ... ok
test eth1_chain::test::eth1_data_sets::ideal_scenario ... ok
test eth1_chain::test::eth1_chain_json_backend::deposits_with_cache ... ok
test head_tracker::test::bad_length ... ok
test head_tracker::test::block_add ... ok
test head_tracker::test::empty_round_trip ... ok
test head_tracker::test::non_empty_round_trip ... ok
test graffiti_calculator::tests::check_graffiti_with_validator_specified_value ... ok
test naive_aggregation_pool::tests::attestation_key_tree_hash_tests ... ok
test graffiti_calculator::tests::check_graffiti_with_el_version_support ... ok
test graffiti_calculator::tests::check_graffiti_without_el_version_support ... ok
test naive_aggregation_pool::tests::attestation_tests_base::auto_pruning_item ... ok
test naive_aggregation_pool::tests::attestation_tests_base::single_item ... ok
test naive_aggregation_pool::tests::attestation_tests_base::multiple_items ... ok
test naive_aggregation_pool::tests::attestation_tests_electra::auto_pruning_item ... ok
test naive_aggregation_pool::tests::attestation_tests_electra::multiple_items ... ok
test naive_aggregation_pool::tests::attestation_tests_electra::single_item ... ok
test naive_aggregation_pool::tests::sync_contribution_tests::auto_pruning_item ... ok
test naive_aggregation_pool::tests::sync_contribution_tests::max_items ... ok
test naive_aggregation_pool::tests::sync_contribution_tests::multiple_items ... ok
test naive_aggregation_pool::tests::sync_contribution_tests::single_item ... ok
test observed_attesters::tests::observed_aggregators::mulitple_contiguous_periods ... ok
test observed_attesters::tests::observed_aggregators::mulitple_non_contiguous_periods ... ok
test observed_attesters::tests::observed_aggregators::single_period ... ok
test observed_attesters::tests::observed_attesters::mulitple_contiguous_periods ... ok
test observed_attesters::tests::observed_attesters::mulitple_non_contiguous_periods ... ok
test observed_attesters::tests::observed_attesters::single_period ... ok
test observed_attesters::tests::observed_sync_aggregators::mulitple_contiguous_periods_different_subcommittee ... ok
test observed_attesters::tests::observed_sync_aggregators::mulitple_contiguous_periods_same_subcommittee ... ok
test observed_attesters::tests::observed_sync_aggregators::mulitple_non_contiguous_periods_different_subcommitte ... ok
test observed_attesters::tests::observed_sync_aggregators::mulitple_non_contiguous_periods_same_subcommitte ... ok
test observed_attesters::tests::observed_sync_aggregators::single_period ... ok
test observed_attesters::tests::observed_sync_aggregators::single_period_multiple_subcommittees ... ok
test observed_attesters::tests::observed_sync_contributors::mulitple_contiguous_periods_different_subcommittee ... ok
test observed_attesters::tests::observed_sync_contributors::mulitple_contiguous_periods_same_subcommittee ... ok
test observed_attesters::tests::observed_sync_contributors::mulitple_non_contiguous_periods_different_subcommitte ... ok
test observed_attesters::tests::observed_sync_contributors::mulitple_non_contiguous_periods_same_subcommitte ... ok
test observed_attesters::tests::observed_sync_contributors::single_period ... ok
test observed_attesters::tests::observed_sync_contributors::single_period_multiple_subcommittees ... ok
test observed_attesters::tests::value_storage ... ok
test observed_block_producers::tests::pruning ... ok
test observed_block_producers::tests::simple_observations ... ok
test observed_data_sidecars::tests::pruning ... ok
test observed_data_sidecars::tests::simple_observations ... ok
test observed_slashable::tests::pruning ... ok
test observed_slashable::tests::simple_observations ... ok
test state_advance_timer::tests::lock ... ok
test validator_pubkey_cache::test::basic_operation ... ok
test validator_pubkey_cache::test::persistence ... ok
test naive_aggregation_pool::tests::attestation_tests_base::max_items ... ok
test naive_aggregation_pool::tests::attestation_tests_electra::max_items ... ok
test data_availability_checker::overflow_lru_cache::test::overflow_cache_test_insert_components ... ok

thread 'tokio-runtime-worker' has overflowed its stack
fatal runtime error: stack overflow
error: test failed, to rerun pass `-p beacon_chain --lib`

Caused by:
  process didn't exit successfully: `/Users/anda/Developer/lighthouse/target/debug/deps/beacon_chain-9ba3fc78ed49044f` (signal: 6, SIGABRT: process abort signal)
~/Developer/lighthouse tikv-jemallocator *2 !2 ❯                                                                        6m 25s 04:39:03 pm

Copy link
Member

@michaelsproul michaelsproul Sep 5, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that's a separate issue:

Generally we avoid running the tests in debug mode, because the Rust compiler is very conservative and ends up wasting a lot of stack space. Still, it's something we'll work on.

If you want to run the tests locally, use make nextest-release.

"stats",
"background_threads",
] }

[target.'cfg(not(target_os = "linux"))'.dependencies]
jemallocator = { version = "0.5.0", optional = true, features = ["stats"] }
tikv-jemallocator = { version = "0.5.0", optional = true, features = ["stats"] }

[features]
mallinfo2 = []
jemalloc = ["jemallocator", "jemalloc-ctl"]
jemalloc-profiling = ["jemallocator/profiling"]
jemalloc = ["tikv-jemallocator", "tikv-jemalloc-ctl"]
jemalloc-profiling = ["tikv-jemallocator/profiling"]
4 changes: 2 additions & 2 deletions common/malloc_utils/src/jemalloc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
//!
//! A) `JEMALLOC_SYS_WITH_MALLOC_CONF` at compile-time.
//! B) `_RJEM_MALLOC_CONF` at runtime.
use jemalloc_ctl::{arenas, epoch, stats, Error};
use lighthouse_metrics::{set_gauge, try_create_int_gauge, IntGauge};
use std::sync::LazyLock;
use tikv_jemalloc_ctl::{arenas, epoch, stats, Error};

#[global_allocator]
static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc;
static ALLOC: tikv_jemallocator::Jemalloc = tikv_jemallocator::Jemalloc;

// Metrics for jemalloc.
pub static NUM_ARENAS: LazyLock<lighthouse_metrics::Result<IntGauge>> =
Expand Down