ton-blockchain / ton

Main TON monorepo
Other
2.61k stars 722 forks source link

get_thread_id returns an id that exceeds max_thread_count #955

Closed thedemons closed 3 months ago

thedemons commented 3 months ago

I'm trying to get a full node working using mytonctrl and I'm having problems getting the validator up and running. I got the following stacktrace in /var/ton-work/log:

/lib/x86_64-linux-gnu/libc.so.6(+0x126850)[0x7f394492f850]
/lib/x86_64-linux-gnu/libc.so.6(+0x94ac3)[0x7f394489dac3]
td::detail::ThreadPthread::run_thread
td::LambdaDestructor<td::detail::ThreadPthread::ThreadPthread<td::actor::core::Scheduler::start
td::LambdaDestructor<td::detail::ThreadPthread::ThreadPthread<td::actor::core::Scheduler::start
td::actor::core::CpuWorker::run
td::actor::core::ActorExecutor::start
td::actor::core::ActorExecutor::flush_one_signal
ton::validator::CellDb::start_up
vm::DynamicBagOfCellsDb::create
td::detail::process_check_error
td::Logger::~Logger
td::detail::TsFileLog::append
/lib/x86_64-linux-gnu/libc.so.6(+0x42520)[0x7f394484b520]
td::default_failure_signal_handler
td::Stacktrace::print_to_stderr

The faulty part was in vm::DynamicBagOfCellsDb::create. Somehow this assertion failed:

  static constexpr int32 max_thread_count() {
    return 256;
  }

  static int32 get_thread_id() {
    auto thread_id = ::td::get_thread_id();
-    CHECK(thread_id < max_thread_count());
    return thread_id;
  }

Mytonctrl seems to clone and build the WIP version of the repo so it was dd5540d69e25f08a1c63760d3afb033208d9c99b but I'm not sure.

More information: OS: Ubuntu 22.04.4 LTS x86_64 Kernel: 5.15.0-101-generic CPU: AMD EPYC 9654 (192) @ 2.400GHz Memory: 1031737MiB