Skip to content

Starlark alloc alignment assertions fail following rustc 1.72 TypeId changes #408

@cormacrelf

Description

@cormacrelf

Latest builds are red, bisecting reveals 21381685c as the source. Weirdly only macos seems to be affected.

See rust-lang/rust#109953, which I am pretty sure this is related to. The alloc is now aligned to 16 bytes with no code changes. Compare the changelog https://releases.rs/docs/1.72.0/

I should mention this seems to happen when you run any command that evaluates starlark.

Backtrace showing the assertion failure
nightly-2023-06-27 thread 'buck2-rt' panicked at 'Unexpected alignment in Starlark arena. Type starlark::values::layout::avalue::AValueImpl<starlark::values::layout::avalue::Simple, starlark::values::typing::type_compiled::compiled::TypeCompiledImplAsStarlarkValue<starlark::values::typing::type_compiled::matchers::StarlarkTypeIdMatcher>> has alignment 16, expected <= 8', starlark-rust/starlark/src/values/layout/heap/arena.rs:174:9
stack backtrace:
thread 'buck2-rt' panicked at 'Unexpected alignment in Starlark arena. Type starlark::values::layout::avalue::AValueImpl<starlark::values::layout::avalue::Simple, starlark::values::typing::type_compiled::compiled::TypeCompiledImplAsStarlarkValue<starlark::values::typing::type_compiled::matchers::StarlarkTypeIdMatcher>> has alignment 16, expected <= 8', starlark-rust/starlark/src/values/layout/heap/arena.rs:174:9
thread 'buck2-rt' panicked at 'Unexpected alignment in Starlark arena. Type starlark::values::layout::avalue::AValueImpl<starlark::values::layout::avalue::Simple, starlark::values::typing::type_compiled::compiled::TypeCompiledImplAsStarlarkValue<starlark::values::typing::type_compiled::matchers::StarlarkTypeIdMatcher>> has alignment 16, expected <= 8', starlark-rust/starlark/src/values/layout/heap/arena.rs:174:9
thread 'buck2-rt' panicked at 'Unexpected alignment in Starlark arena. Type starlark::values::layout::avalue::AValueImpl<starlark::values::layout::avalue::Simple, starlark::values::typing::type_compiled::compiled::TypeCompiledImplAsStarlarkValue<starlark::values::typing::type_compiled::matchers::StarlarkTypeIdMatcher>> has alignment 16, expected <= 8', starlark-rust/starlark/src/values/layout/heap/arena.rs:174:9
thread 'buck2-rt' panicked at 'Unexpected alignment in Starlark arena. Type starlark::values::layout::avalue::AValueImpl<starlark::values::layout::avalue::Simple, starlark::values::typing::type_compiled::compiled::TypeCompiledImplAsStarlarkValue<starlark::values::typing::type_compiled::matchers::StarlarkTypeIdMatcher>> has alignment 16, expected <= 8', thread 'buck2-rt' panicked at 'Unexpected alignment in Starlark arena. Type starlark::values::layout::avalue::AValueImpl<starlark::values::layout::avalue::Simple, starlark::values::typing::type_compiled::compiled::TypeCompiledImplAsStarlarkValue<starlark::values::typing::type_compiled::matchers::IsAnyOfTwo<starlark::values::typing::type_compiled::matchers::IsNone, starlark::values::typing::type_compiled::matchers::StarlarkTypeIdMatcher>>> has alignment 16, expected <= 8', starlark-rust/starlark/src/values/layout/heap/arena.rs:174:9
starlark-rust/starlark/src/values/layout/heap/arena.rs:174:9
thread 'buck2-rt' panicked at 'Unexpected alignment in Starlark arena. Type starlark::values::layout::avalue::AValueImpl<starlark::values::layout::avalue::Simple, starlark::values::typing::type_compiled::compiled::TypeCompiledImplAsStarlarkValue<starlark::values::typing::type_compiled::matchers::StarlarkTypeIdMatcher>> has alignment 16, expected <= 8', starlark-rust/starlark/src/values/layout/heap/arena.rs:174:9
thread 'buck2-rt' panicked at 'Unexpected alignment in Starlark arena. Type starlark::values::layout::avalue::AValueImpl<starlark::values::layout::avalue::Simple, starlark::values::typing::type_compiled::compiled::TypeCompiledImplAsStarlarkValue<starlark::values::typing::type_compiled::matchers::StarlarkTypeIdMatcher>> has alignment 16, expected <= 8', starlark-rust/starlark/src/values/layout/heap/arena.rs:174:9
   0: rust_begin_unwind
             at /rustc/36fb58e433c782e27dd41034284e157cf86d587f/library/std/src/panicking.rs:593:5
   1: core::panicking::panic_fmt
             at /rustc/36fb58e433c782e27dd41034284e157cf86d587f/library/core/src/panicking.rs:67:14
   2: starlark::values::layout::heap::arena::Arena<A>::alloc_uninit
             at /Users/me/src/buck2/starlark-rust/starlark/src/values/layout/heap/arena.rs:174:9
   3: starlark::values::layout::heap::arena::Arena<A>::alloc
             at /Users/me/src/buck2/starlark-rust/starlark/src/values/layout/heap/arena.rs:249:26
   4: starlark::values::layout::heap::heap_type::Heap::alloc_raw
             at /Users/me/src/buck2/starlark-rust/starlark/src/values/layout/heap/heap_type.rs:592:33
   5: starlark::values::layout::heap::heap_type::Heap::alloc_simple
             at /Users/me/src/buck2/starlark-rust/starlark/src/values/layout/heap/heap_type.rs:761:9
   6: starlark::values::typing::type_compiled::compiled::TypeCompiled<starlark::values::layout::value::Value>::alloc
             at /Users/me/src/buck2/starlark-rust/starlark/src/values/typing/type_compiled/compiled.rs:378:22
   7: <starlark::values::typing::type_compiled::factory::TypeCompiledFactory as starlark::values::typing::type_compiled::alloc::TypeMatcherAlloc>::alloc
             at /Users/me/src/buck2/starlark-rust/starlark/src/values/typing/type_compiled/factory.rs:47:9
   8: starlark::values::typing::type_compiled::compiled::TypeCompiled<starlark::values::layout::value::Value>::from_ty
             at /Users/me/src/buck2/starlark-rust/starlark/src/values/typing/type_compiled/compiled.rs:435:9
   9: starlark::values::typing::type_compiled::compiled::TypeCompiled<starlark::values::layout::value::Value>::new
             at /Users/me/src/buck2/starlark-rust/starlark/src/values/typing/type_compiled/compiled.rs:455:16
  10: starlark::eval::compiler::types::<impl starlark::eval::compiler::Compiler>::alloc_value_for_type
             at /Users/me/src/buck2/starlark-rust/starlark/src/eval/compiler/types.rs:102:18
  11: starlark::eval::compiler::types::<impl starlark::eval::compiler::Compiler>::eval_path_as_type
             at /Users/me/src/buck2/starlark-rust/starlark/src/eval/compiler/types.rs:151:9
  12: starlark::eval::compiler::types::<impl starlark::eval::compiler::Compiler>::eval_expr_as_type
             at /Users/me/src/buck2/starlark-rust/starlark/src/eval/compiler/types.rs:159:50
  13: starlark::eval::compiler::types::<impl starlark::eval::compiler::Compiler>::populate_types_in_type_expr
             at /Users/me/src/buck2/starlark-rust/starlark/src/eval/compiler/types.rs:245:26
  14: starlark::eval::compiler::types::<impl starlark::eval::compiler::Compiler>::populate_types_in_stmt::{{closure}}
             at /Users/me/src/buck2/starlark-rust/starlark/src/eval/compiler/types.rs:254:55
  15: starlark_syntax::syntax::uniplate::<impl starlark_syntax::syntax::ast::StmtP<P>>::visit_type_expr_err_mut
             at /Users/me/src/buck2/starlark-rust/starlark_syntax/src/syntax/uniplate.rs:287:25
  16: starlark::eval::compiler::types::<impl starlark::eval::compiler::Compiler>::populate_types_in_stmt
             at /Users/me/src/buck2/starlark-rust/starlark/src/eval/compiler/types.rs:254:9
  17: starlark::eval::compiler::module::<impl starlark::eval::compiler::Compiler>::eval_top_level_stmt
             at /Users/me/src/buck2/starlark-rust/starlark/src/eval/compiler/module.rs:150:13
  18: starlark::eval::compiler::module::<impl starlark::eval::compiler::Compiler>::eval_module
             at /Users/me/src/buck2/starlark-rust/starlark/src/eval/compiler/module.rs:219:21
  19: starlark::eval::<impl starlark::eval::runtime::evaluator::Evaluator>::eval_module
             at /Users/me/src/buck2/starlark-rust/starlark/src/eval/mod.rs:136:19
  20: buck2_interpreter_for_build::interpreter::interpreter_for_cell::InterpreterForCell::eval
             at /Users/me/src/buck2/app/buck2_interpreter_for_build/src/interpreter/interpreter_for_cell.rs:469:19
  21: buck2_interpreter_for_build::interpreter::interpreter_for_cell::InterpreterForCell::eval_module
             at /Users/me/src/buck2/app/buck2_interpreter_for_build/src/interpreter/interpreter_for_cell.rs:510:9
  22: buck2_interpreter_for_build::interpreter::dice_calculation_delegate::DiceCalculationDelegate::eval_module_uncached::{{closure}}::{{closure}}
             at /Users/me/src/buck2/app/buck2_interpreter_for_build/src/interpreter/dice_calculation_delegate.rs:271:34
  23: buck2_interpreter::dice::starlark_provider::with_starlark_eval_provider::{{closure}}
             at /Users/me/src/buck2/app/buck2_interpreter/src/dice/starlark_provider.rs:96:13
  24: buck2_interpreter_for_build::interpreter::dice_calculation_delegate::DiceCalculationDelegate::eval_module_uncached::{{closure}}
             at /Users/me/src/buck2/app/buck2_interpreter_for_build/src/interpreter/dice_calculation_delegate.rs:292:10
  25: buck2_interpreter_for_build::interpreter::dice_calculation_delegate::DiceCalculationDelegate::eval_module::{{closure}}::<impl dice::api::key::Key for buck2_interpreter_for_build::interpreter::dice_calculation_delegate::keys::EvalImportKey>::compute::{{closure}}
             at /Users/me/src/buck2/app/buck2_interpreter_for_build/src/interpreter/dice_calculation_delegate.rs:175:22
  26: dice::legacy::<impl dice::legacy::incremental::evaluator::Evaluator for dice::legacy::key::StoragePropertiesForKey<K>>::eval::{{closure}}
             at /Users/me/src/buck2/dice/dice/src/legacy/mod.rs:280:14
  27: dice::legacy::incremental::IncrementalEngine<K>::compute::{{closure}}::{{closure}}
             at /Users/me/src/buck2/dice/dice/src/legacy/incremental/mod.rs:579:14
  28: dice::legacy::incremental::IncrementalEngine<K>::compute::{{closure}}
             at /Users/me/src/buck2/dice/dice/src/legacy/incremental/mod.rs:542:5
  29: dice::legacy::incremental::IncrementalEngine<K>::new_dice_task::{{closure}}
             at /Users/me/src/buck2/dice/dice/src/legacy/incremental/mod.rs:488:26
  30: more_futures::cancellable_future::CancellableFutureProj<F>::poll_inner
             at /Users/me/src/buck2/shed/more_futures/src/cancellable_future.rs:257:13
  31: <more_futures::cancellable_future::CancellableFuture<F> as core::future::future::Future>::poll
             at /Users/me/src/buck2/shed/more_futures/src/cancellable_future.rs:300:20
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
stack backtrace:
Build ID: 8ee76dad-1ad3-440b-8327-fbd8d471fc36
Jobs completed: 143. Time elapsed: 0.3s.
Command failed: Buck daemon event bus encountered an error, the root cause (if available) is displayed above this message.

Caused by:
    0: status: Unknown, message: "h2 protocol error: error reading a body from connection: stream closed because of a broken pipe", details: [], metadata: MetadataMap { headers: {} }
    1: error reading a body from connection: stream closed because of a broken pipe
    2: stream closed because of a broken pipe

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions