*: Fix incorrect mapped allocation per thread metric (#18126)#18564
Conversation
|
@hhwyt This PR has conflicts, I have hold it. |
|
Here is the test result: #18563 (comment). |
b11246b to
2107add
Compare
2107add to
1385073
Compare
|
Once #18563 is merged, I'll rebase the first commit from master. |
6d43d21 to
3341338
Compare
|
bugbot run |
There was a problem hiding this comment.
Bug: Metric Descriptor Missing in Collector
The arena_count metric is initialized and collected, but its descriptor is not added to the AllocStatsCollector's descs field. This prevents proper registration of the metric with Prometheus.
components/tikv_util/src/metrics/allocator_metrics.rs#L51-L60
tikv/components/tikv_util/src/metrics/allocator_metrics.rs
Lines 51 to 60 in 3341338
Bug: Thread Panic on Jemalloc Failure
The thread_allocate_exclusive_arena().unwrap() call can cause a thread panic if jemalloc operations (e.g., arena creation) fail. This unhandled panic, particularly in thread pool contexts, can prevent threads from starting or disrupt the entire pool. Graceful error handling (logging and continuing) is recommended, as thread startup failure is more disruptive than missing allocation metrics.
components/server/src/server2.rs#L307-L308
tikv/components/server/src/server2.rs
Lines 307 to 308 in 3341338
components/server/src/server.rs#L315-L316
tikv/components/server/src/server.rs
Lines 315 to 316 in 3341338
components/tikv_util/src/yatp_pool/mod.rs#L189-L190
tikv/components/tikv_util/src/yatp_pool/mod.rs
Lines 189 to 190 in 3341338
components/tikv_util/src/sys/thread.rs#L434-L435
tikv/components/tikv_util/src/sys/thread.rs
Lines 434 to 435 in 3341338
components/tikv_util/src/sys/thread.rs#L458-L459
tikv/components/tikv_util/src/sys/thread.rs
Lines 458 to 459 in 3341338
components/tikv_util/src/sys/thread.rs#L483-L484
tikv/components/tikv_util/src/sys/thread.rs
Lines 483 to 484 in 3341338
BugBot free trial expires on July 22, 2025
You have used $0.00 of your $10.00 spend limit so far. Manage your spend limit in the Cursor dashboard.
Was this report helpful? Give feedback by reacting with 👍 or 👎
This is true but this does not affect Grafana Dashboard display, so can be ignored.
This is true. While the error-handling can be more graceful as the arena allocation failure is a non-core logic should not cause TiKV panic, such failures are rare in practice, so I think it's ok to keep current implementation. |
[LGTM Timeline notifier]Timeline:
|
|
/hold |
|
/retest |
|
/hold |
close tikv#18125 Fix incorrect mapped allocation per thread metric Not all thread builders are hooked by `thread_allocate_exclusive_arena`, so some threads are using shared arena, causing incorrect per thread allocation. Signed-off-by: Connor1996 <zbk602423539@gmail.com> (cherry picked from commit 18f4419) Signed-off-by: hhwyt <hhwyt1@gmail.com>
3341338 to
34ac9d6
Compare
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: cfzjywxk, Connor1996, LykxSassinator The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/unhold |
This is an automated cherry-pick of #18126
What is changed and how it works?
Issue Number: Close #18125
What's Changed:
Related changes
pingcap/docs/pingcap/docs-cn:Check List
Tests
Side effects
Release note