pingcap / pingcap/tiflash

MetricsPrometheus::run() may panic

Open
#8,269 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

affects-7.1 affects-7.5 affects-8.1 component/storage may-affects-6.1 may-affects-6.5 severity/moderate type/bug
Dominant language
C++
Stars
1k
Forks
423
Avg merge
1d 15h
Merged PRs (30d)
24

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

The std::__1::__function::__func ... stuff is actually FunctionTimerTask::create([this] { run(); })

2023-10-29 15:54:56
[2023/10/29 07:54:56.876 +00:00] [ERROR] [BaseDaemon.cpp:422] ["Address not mapped to object."] [source=BaseDaemon] [thread_id=4761]
2023-10-29 15:54:56
[2023/10/29 07:54:56.876 +00:00] [ERROR] [BaseDaemon.cpp:407] ["Address: 0x90"] [source=BaseDaemon] [thread_id=4761]
2023-10-29 15:54:56
[2023/10/29 07:54:56.876 +00:00] [ERROR] [BaseDaemon.cpp:377] ["(from thread 4760) Received signal Segmentation fault(11)."] [source=BaseDaemon] [thread_id=4761]
2023-10-29 15:54:56
[2023/10/29 07:54:56.876 +00:00] [ERROR] [BaseDaemon.cpp:376] [########################################] [source=BaseDaemon] [thread_id=4761]
[2023/10/29 07:54:56.882 +00:00] [ERROR] [BaseDaemon.cpp:569] ["
       0x684f2e0    faultSignalHandler(int, siginfo_t*, void*) [tiflash+109376224]
                    libs/libdaemon/src/BaseDaemon.cpp:220
  0xffffb51bc81c    <unknown symbol> [linux-vdso.so.1+2076]
       0x19ad038    std::__1::__function::__func<DB::MetricsPrometheus::MetricsPrometheus(DB::Context&, DB::AsynchronousMetrics const&)::$_10, std::__1::allocator<DB::MetricsPrometheus::MetricsPrometheus(DB::Context&, DB::AsynchronousMetrics const&)::$_10>, void ()>::operator()() [tiflash+26923064]
                    /usr/local/bin/../include/c++/v1/__functional/function.h:345
       0x79d26f0    Poco::Util::TaskNotification::execute() [tiflash+127739632]
                    contrib/poco/Util/src/Timer.cpp:126
       0x79d2bb4    Poco::Util::FixedRateTaskNotification::execute() [tiflash+127740852]
                    contrib/poco/Util/src/Timer.cpp:199
       0x19ab040    DB::Timer::run() [tiflash+26914880]
                    dbms/src/Common/Timer.h:32
       0x7a5af04    Poco::ThreadImpl::runnableEntry(void*) [tiflash+128298756]
                    contrib/poco/Foundation/src/Thread_STD.cpp:139
       0x7a5bfd8    void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, void* (*)(void*), Poco::ThreadImpl*> >(void*) [tiflash+128303064]
                    /usr/local/bin/../include/c++/v1/thread:291
  0xffffb112aa28    start_thread [libc.so.6+535080]"] [source=BaseDaemon] [thread_id=4761]
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. What is your TiFlash version? (Required)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at MetricsPrometheus::run() and the FunctionTimerTask::create([this] { run(); }) callback shown in the report. Read dbms/src/Common/Timer.h and the referenced timer and daemon stack frames, then determine the object-lifetime path that leads to the segmentation fault. Done means the failure is reproducible or explained and the scheduled metrics task no longer accesses invalid state.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
observability
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.