Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](memory) Fix free page not tracking correctly #36768

Merged
merged 1 commit into from
Jun 24, 2024

Conversation

xinyiZzz
Copy link
Contributor

Proposed changes

#36235 introduced, index page is not freed in query thread, so saved tracker ptr when alloc page, so that page only needs to be freed before query ends.

F20240624 18:44:51.880192 162249 mem_tracker_limiter.cpp:125] mem tracker label: Query#Id=f0511107829e465e-a87a985234018b77, consumption: 94, peak consumption: 636540, mem tracker not equal to 0 when mem tracker destruct, this usually means that memory tracking is inaccurate and SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. 1. For query and load, memory leaks may have occurred, it is expected that the query mem tracker will be bound to the thread context using SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER before all memory alloc and free. 2. If a memory alloc is recorded by this tracker, it is expected that be recorded in this tracker when memory is freed. 3. Merge the remaining memory tracking value by this tracker into Orphan, if you observe that Orphan is not equal to 0 in the mem tracker web or log, this indicates that there may be a memory leak. 4. If you need to transfer memory tracking value between two trackers, can use transfer_to..[Address Sanitizer]:
    0x605000160b30, size 46, strack trace:
        0#  Allocator<false, false, false>::alloc_impl(unsigned long, unsigned long)
        1#  doris::PageBase<Allocator<false, false, false> >::PageBase(unsigned long, bool, doris::segment_v2::PageTypePB)
        2#  doris::segment_v2::PageIO::read_and_decompress_page(doris::segment_v2::PageReadOptions const&, doris::segment_v2::PageHandle*, doris::Slice*, doris::segment_v2::PageFooterPB*)
        3#  doris::segment_v2::IndexedColumnReader::read_page(doris::segment_v2::PagePointer const&, doris::segment_v2::PageHandle*, doris::Slice*, doris::segment_v2::PageFooterPB*, doris::segment_v2::PageTypePB, doris::BlockCompressionCodec*, bool) const
        4#  doris::segment_v2::IndexedColumnReader::load_index_page(doris::segment_v2::PagePointerPB const&, doris::segment_v2::PageHandle*, doris::segment_v2::IndexPageReader*)
        5#  doris::segment_v2::IndexedColumnReader::load(bool, bool)
        6#  doris::segment_v2::BitmapIndexReader::_load(bool, bool, std::unique_ptr<doris::segment_v2::BitmapIndexPB, std::default_delete<doris::segment_v2::BitmapIndexPB> >)
        7#  doris::segment_v2::BitmapIndexReader::load(bool, bool)
        8#  doris::segment_v2::ColumnReader::_load_bitmap_index(bool, bool)
        9#  doris::segment_v2::ColumnReader::new_bitmap_index_iterator(doris::segment_v2::BitmapIndexIterator**)
        10# doris::segment_v2::Segment::new_bitmap_index_iterator(doris::TabletColumn const&, std::unique_ptr<doris::segment_v2::BitmapIndexIterator, std::default_delete<doris::segment_v2::BitmapIndexIterator> >*)
        11# doris::segment_v2::SegmentIterator::_init_bitmap_index_iterators()
        12# doris::segment_v2::SegmentIterator::init_iterators()
        13# doris::segment_v2::SegmentIterator::_init_impl(doris::StorageReadOptions const&)
        14# doris::segment_v2::SegmentIterator::init(doris::StorageReadOptions const&)
        15# doris::segment_v2::Segment::new_iterator(std::shared_ptr<doris::Schema const>, doris::StorageReadOptions const&, std::unique_ptr<doris::RowwiseIterator, std::default_delete<doris::RowwiseIterator> >*)
        16# doris::segment_v2::LazyInitSegmentIterator::init(doris::StorageReadOptions const&)
        17# doris::BetaRowsetReader::_init_iterator()
        18# doris::BetaRowsetReader::_init_iterator_once()
        19# doris::BetaRowsetReader::next_block(doris::vectorized::Block*)
        20# doris::vectorized::VCollectIterator::_topn_next(doris::vectorized::Block*)
        21# doris::vectorized::VCollectIterator::next(doris::vectorized::Block*)
        22# doris::vectorized::BlockReader::_direct_next_block(doris::vectorized::Block*, bool*)
        23# doris::vectorized::BlockReader::next_block_with_aggregation(doris::vectorized::Block*, bool*)
        24# doris::vectorized::NewOlapScanner::_get_block_impl(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        25# doris::vectorized::VScanner::get_block(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        26# doris::vectorized::VScanner::get_block_after_projects(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        27# doris::vectorized::ScannerScheduler::_scanner_scan(std::shared_ptr<doris::vectorized::ScannerContext>, std::shared_ptr<doris::vectorized::ScanTask>)
        28# std::_Function_handler<void (), doris::vectorized::ScannerScheduler::submit(std::shared_ptr<doris::vectorized::ScannerContext>, std::shared_ptr<doris::vectorized::ScanTask>)::$_1::operator()() const::{lambda()#1}>::_M_invoke(std::_Any_data const&)
        29# doris::ThreadPool::dispatch_thread()
        30# doris::Thread::supervise_thread(void*)

@doris-robot
Copy link

Thank you for your contribution to Apache Doris.
Don't know what should be done next? See How to process your PR

Since 2024-03-18, the Document has been moved to doris-website.
See Doris Document.

@xinyiZzz
Copy link
Contributor Author

run buildall

Copy link
Contributor

clang-tidy review says "All clean, LGTM! 👍"

Copy link
Contributor

@dataroaring dataroaring left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

PR approved by at least one committer and no changes requested.

@github-actions github-actions bot added approved Indicates a PR has been approved by one committer. reviewed labels Jun 24, 2024
Copy link
Contributor

PR approved by anyone and no changes requested.

@doris-robot
Copy link

TPC-H: Total hot run time: 39912 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpch-tools
Tpch sf100 test result on commit afbdca856f2a412aa6538ac3672a5b2bb995ac03, data reload: false

------ Round 1 ----------------------------------
q1	17606	4664	4312	4312
q2	2005	184	182	182
q3	10478	1082	1092	1082
q4	10183	875	835	835
q5	7455	2677	2612	2612
q6	217	133	131	131
q7	944	601	601	601
q8	9237	2074	2066	2066
q9	8825	6533	6463	6463
q10	9023	3723	3736	3723
q11	451	240	233	233
q12	409	214	228	214
q13	19108	2996	2989	2989
q14	272	225	219	219
q15	522	486	472	472
q16	501	391	371	371
q17	977	695	713	695
q18	8157	7552	7428	7428
q19	6601	1501	1453	1453
q20	660	312	337	312
q21	4873	3177	3933	3177
q22	412	342	342	342
Total cold run time: 118916 ms
Total hot run time: 39912 ms

----- Round 2, with runtime_filter_mode=off -----
q1	4445	4310	4280	4280
q2	388	255	266	255
q3	2984	2762	2723	2723
q4	1901	1646	1575	1575
q5	5273	5316	5302	5302
q6	220	127	128	127
q7	2137	1721	1774	1721
q8	3209	3313	3343	3313
q9	8352	8261	8404	8261
q10	3863	3661	3606	3606
q11	597	490	488	488
q12	784	612	574	574
q13	16931	2988	3000	2988
q14	284	249	269	249
q15	518	477	476	476
q16	476	416	424	416
q17	1771	1483	1479	1479
q18	7796	7568	7424	7424
q19	1741	1632	1491	1491
q20	2003	1789	1823	1789
q21	4996	4790	4736	4736
q22	623	524	522	522
Total cold run time: 71292 ms
Total hot run time: 53795 ms

@doris-robot
Copy link

TPC-DS: Total hot run time: 170390 ms
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/tpcds-tools
TPC-DS sf100 test result on commit afbdca856f2a412aa6538ac3672a5b2bb995ac03, data reload: false

query1	919	389	370	370
query2	6441	2434	2250	2250
query3	6637	211	201	201
query4	18723	17127	17286	17127
query5	4188	479	471	471
query6	256	166	189	166
query7	4589	302	308	302
query8	321	279	278	278
query9	8609	2453	2439	2439
query10	627	291	295	291
query11	10653	10066	10079	10066
query12	125	85	83	83
query13	1652	393	385	385
query14	9648	7529	6884	6884
query15	269	196	180	180
query16	8029	274	266	266
query17	1915	532	541	532
query18	2067	271	278	271
query19	210	159	163	159
query20	92	78	80	78
query21	203	130	134	130
query22	4303	3978	3960	3960
query23	33765	33058	33130	33058
query24	10915	2820	2830	2820
query25	640	356	360	356
query26	1588	157	152	152
query27	2973	322	317	317
query28	7400	2091	2089	2089
query29	969	620	633	620
query30	262	154	151	151
query31	950	764	763	763
query32	99	56	55	55
query33	781	291	281	281
query34	982	476	483	476
query35	763	632	611	611
query36	1107	943	951	943
query37	156	69	72	69
query38	2881	2754	2733	2733
query39	858	789	824	789
query40	272	133	129	129
query41	55	51	54	51
query42	124	98	100	98
query43	589	552	549	549
query44	1196	740	720	720
query45	200	165	163	163
query46	1066	739	726	726
query47	1871	1781	1795	1781
query48	369	293	299	293
query49	1187	413	429	413
query50	776	398	409	398
query51	6876	6832	6790	6790
query52	111	93	97	93
query53	363	299	296	296
query54	872	468	449	449
query55	76	75	74	74
query56	280	257	265	257
query57	1160	1032	1070	1032
query58	276	245	240	240
query59	3432	3125	3000	3000
query60	303	314	280	280
query61	95	92	104	92
query62	658	440	448	440
query63	324	296	300	296
query64	9875	2235	1741	1741
query65	3159	3101	3079	3079
query66	1081	333	374	333
query67	15496	14970	15031	14970
query68	4592	546	545	545
query69	453	310	315	310
query70	1203	1140	1161	1140
query71	406	281	282	281
query72	7108	5503	2759	2759
query73	741	335	336	335
query74	6015	5447	5495	5447
query75	3497	2713	2684	2684
query76	2965	975	926	926
query77	450	298	319	298
query78	10676	9868	9931	9868
query79	2400	514	526	514
query80	1063	485	480	480
query81	528	222	223	222
query82	852	107	100	100
query83	268	172	168	168
query84	231	86	89	86
query85	1377	287	333	287
query86	433	328	322	322
query87	3280	3117	3076	3076
query88	4425	2449	2431	2431
query89	484	385	391	385
query90	1810	196	192	192
query91	129	101	102	101
query92	66	50	56	50
query93	1828	507	505	505
query94	1238	195	191	191
query95	416	328	319	319
query96	588	274	272	272
query97	3231	3099	3143	3099
query98	221	202	198	198
query99	1119	844	850	844
Total cold run time: 273800 ms
Total hot run time: 170390 ms

@doris-robot
Copy link

ClickBench: Total hot run time: 30.58 s
machine: 'aliyun_ecs.c7a.8xlarge_32C64G'
scripts: https://github.com/apache/doris/tree/master/tools/clickbench-tools
ClickBench test result on commit afbdca856f2a412aa6538ac3672a5b2bb995ac03, data reload: false

query1	0.04	0.04	0.03
query2	0.08	0.04	0.04
query3	0.22	0.05	0.04
query4	1.68	0.06	0.06
query5	0.50	0.49	0.47
query6	1.13	0.72	0.71
query7	0.02	0.02	0.01
query8	0.06	0.04	0.05
query9	0.55	0.49	0.49
query10	0.56	0.55	0.55
query11	0.16	0.11	0.11
query12	0.14	0.12	0.12
query13	0.59	0.59	0.58
query14	0.75	0.79	0.79
query15	0.83	0.82	0.81
query16	0.37	0.36	0.35
query17	1.01	0.95	1.00
query18	0.21	0.28	0.22
query19	1.78	1.79	1.71
query20	0.02	0.01	0.01
query21	15.43	0.67	0.66
query22	4.26	6.67	2.06
query23	18.33	1.34	1.22
query24	2.07	0.24	0.23
query25	0.14	0.08	0.07
query26	0.27	0.18	0.17
query27	0.07	0.08	0.08
query28	13.18	1.03	0.99
query29	12.63	3.29	3.28
query30	0.25	0.05	0.06
query31	2.87	0.39	0.38
query32	3.28	0.46	0.47
query33	2.89	2.93	2.88
query34	16.99	4.40	4.43
query35	4.53	4.50	4.57
query36	0.67	0.47	0.46
query37	0.18	0.16	0.15
query38	0.15	0.15	0.15
query39	0.05	0.03	0.04
query40	0.18	0.14	0.14
query41	0.10	0.05	0.04
query42	0.06	0.05	0.05
query43	0.04	0.04	0.04
Total cold run time: 109.32 s
Total hot run time: 30.58 s

@dataroaring dataroaring merged commit 6808e11 into apache:master Jun 24, 2024
26 of 30 checks passed
dataroaring pushed a commit that referenced this pull request Jun 26, 2024
## Proposed changes

#36235 introduced, index page is not freed in query thread, so saved
tracker ptr when alloc page, so that page only needs to be freed before
query ends.

```
F20240624 18:44:51.880192 162249 mem_tracker_limiter.cpp:125] mem tracker label: Query#Id=f0511107829e465e-a87a985234018b77, consumption: 94, peak consumption: 636540, mem tracker not equal to 0 when mem tracker destruct, this usually means that memory tracking is inaccurate and SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. 1. For query and load, memory leaks may have occurred, it is expected that the query mem tracker will be bound to the thread context using SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER before all memory alloc and free. 2. If a memory alloc is recorded by this tracker, it is expected that be recorded in this tracker when memory is freed. 3. Merge the remaining memory tracking value by this tracker into Orphan, if you observe that Orphan is not equal to 0 in the mem tracker web or log, this indicates that there may be a memory leak. 4. If you need to transfer memory tracking value between two trackers, can use transfer_to..[Address Sanitizer]:
    0x605000160b30, size 46, strack trace:
        0#  Allocator<false, false, false>::alloc_impl(unsigned long, unsigned long)
        1#  doris::PageBase<Allocator<false, false, false> >::PageBase(unsigned long, bool, doris::segment_v2::PageTypePB)
        2#  doris::segment_v2::PageIO::read_and_decompress_page(doris::segment_v2::PageReadOptions const&, doris::segment_v2::PageHandle*, doris::Slice*, doris::segment_v2::PageFooterPB*)
        3#  doris::segment_v2::IndexedColumnReader::read_page(doris::segment_v2::PagePointer const&, doris::segment_v2::PageHandle*, doris::Slice*, doris::segment_v2::PageFooterPB*, doris::segment_v2::PageTypePB, doris::BlockCompressionCodec*, bool) const
        4#  doris::segment_v2::IndexedColumnReader::load_index_page(doris::segment_v2::PagePointerPB const&, doris::segment_v2::PageHandle*, doris::segment_v2::IndexPageReader*)
        5#  doris::segment_v2::IndexedColumnReader::load(bool, bool)
        6#  doris::segment_v2::BitmapIndexReader::_load(bool, bool, std::unique_ptr<doris::segment_v2::BitmapIndexPB, std::default_delete<doris::segment_v2::BitmapIndexPB> >)
        7#  doris::segment_v2::BitmapIndexReader::load(bool, bool)
        8#  doris::segment_v2::ColumnReader::_load_bitmap_index(bool, bool)
        9#  doris::segment_v2::ColumnReader::new_bitmap_index_iterator(doris::segment_v2::BitmapIndexIterator**)
        10# doris::segment_v2::Segment::new_bitmap_index_iterator(doris::TabletColumn const&, std::unique_ptr<doris::segment_v2::BitmapIndexIterator, std::default_delete<doris::segment_v2::BitmapIndexIterator> >*)
        11# doris::segment_v2::SegmentIterator::_init_bitmap_index_iterators()
        12# doris::segment_v2::SegmentIterator::init_iterators()
        13# doris::segment_v2::SegmentIterator::_init_impl(doris::StorageReadOptions const&)
        14# doris::segment_v2::SegmentIterator::init(doris::StorageReadOptions const&)
        15# doris::segment_v2::Segment::new_iterator(std::shared_ptr<doris::Schema const>, doris::StorageReadOptions const&, std::unique_ptr<doris::RowwiseIterator, std::default_delete<doris::RowwiseIterator> >*)
        16# doris::segment_v2::LazyInitSegmentIterator::init(doris::StorageReadOptions const&)
        17# doris::BetaRowsetReader::_init_iterator()
        18# doris::BetaRowsetReader::_init_iterator_once()
        19# doris::BetaRowsetReader::next_block(doris::vectorized::Block*)
        20# doris::vectorized::VCollectIterator::_topn_next(doris::vectorized::Block*)
        21# doris::vectorized::VCollectIterator::next(doris::vectorized::Block*)
        22# doris::vectorized::BlockReader::_direct_next_block(doris::vectorized::Block*, bool*)
        23# doris::vectorized::BlockReader::next_block_with_aggregation(doris::vectorized::Block*, bool*)
        24# doris::vectorized::NewOlapScanner::_get_block_impl(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        25# doris::vectorized::VScanner::get_block(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        26# doris::vectorized::VScanner::get_block_after_projects(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        27# doris::vectorized::ScannerScheduler::_scanner_scan(std::shared_ptr<doris::vectorized::ScannerContext>, std::shared_ptr<doris::vectorized::ScanTask>)
        28# std::_Function_handler<void (), doris::vectorized::ScannerScheduler::submit(std::shared_ptr<doris::vectorized::ScannerContext>, std::shared_ptr<doris::vectorized::ScanTask>)::$_1::operator()() const::{lambda()#1}>::_M_invoke(std::_Any_data const&)
        29# doris::ThreadPool::dispatch_thread()
        30# doris::Thread::supervise_thread(void*)
```
xinyiZzz added a commit to xinyiZzz/incubator-doris that referenced this pull request Jul 11, 2024
## Proposed changes

apache#36235 introduced, index page is not freed in query thread, so saved
tracker ptr when alloc page, so that page only needs to be freed before
query ends.

```
F20240624 18:44:51.880192 162249 mem_tracker_limiter.cpp:125] mem tracker label: Query#Id=f0511107829e465e-a87a985234018b77, consumption: 94, peak consumption: 636540, mem tracker not equal to 0 when mem tracker destruct, this usually means that memory tracking is inaccurate and SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. 1. For query and load, memory leaks may have occurred, it is expected that the query mem tracker will be bound to the thread context using SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER before all memory alloc and free. 2. If a memory alloc is recorded by this tracker, it is expected that be recorded in this tracker when memory is freed. 3. Merge the remaining memory tracking value by this tracker into Orphan, if you observe that Orphan is not equal to 0 in the mem tracker web or log, this indicates that there may be a memory leak. 4. If you need to transfer memory tracking value between two trackers, can use transfer_to..[Address Sanitizer]:
    0x605000160b30, size 46, strack trace:
        0#  Allocator<false, false, false>::alloc_impl(unsigned long, unsigned long)
        1#  doris::PageBase<Allocator<false, false, false> >::PageBase(unsigned long, bool, doris::segment_v2::PageTypePB)
        2#  doris::segment_v2::PageIO::read_and_decompress_page(doris::segment_v2::PageReadOptions const&, doris::segment_v2::PageHandle*, doris::Slice*, doris::segment_v2::PageFooterPB*)
        3#  doris::segment_v2::IndexedColumnReader::read_page(doris::segment_v2::PagePointer const&, doris::segment_v2::PageHandle*, doris::Slice*, doris::segment_v2::PageFooterPB*, doris::segment_v2::PageTypePB, doris::BlockCompressionCodec*, bool) const
        4#  doris::segment_v2::IndexedColumnReader::load_index_page(doris::segment_v2::PagePointerPB const&, doris::segment_v2::PageHandle*, doris::segment_v2::IndexPageReader*)
        5#  doris::segment_v2::IndexedColumnReader::load(bool, bool)
        6#  doris::segment_v2::BitmapIndexReader::_load(bool, bool, std::unique_ptr<doris::segment_v2::BitmapIndexPB, std::default_delete<doris::segment_v2::BitmapIndexPB> >)
        7#  doris::segment_v2::BitmapIndexReader::load(bool, bool)
        8#  doris::segment_v2::ColumnReader::_load_bitmap_index(bool, bool)
        9#  doris::segment_v2::ColumnReader::new_bitmap_index_iterator(doris::segment_v2::BitmapIndexIterator**)
        10# doris::segment_v2::Segment::new_bitmap_index_iterator(doris::TabletColumn const&, std::unique_ptr<doris::segment_v2::BitmapIndexIterator, std::default_delete<doris::segment_v2::BitmapIndexIterator> >*)
        11# doris::segment_v2::SegmentIterator::_init_bitmap_index_iterators()
        12# doris::segment_v2::SegmentIterator::init_iterators()
        13# doris::segment_v2::SegmentIterator::_init_impl(doris::StorageReadOptions const&)
        14# doris::segment_v2::SegmentIterator::init(doris::StorageReadOptions const&)
        15# doris::segment_v2::Segment::new_iterator(std::shared_ptr<doris::Schema const>, doris::StorageReadOptions const&, std::unique_ptr<doris::RowwiseIterator, std::default_delete<doris::RowwiseIterator> >*)
        16# doris::segment_v2::LazyInitSegmentIterator::init(doris::StorageReadOptions const&)
        17# doris::BetaRowsetReader::_init_iterator()
        18# doris::BetaRowsetReader::_init_iterator_once()
        19# doris::BetaRowsetReader::next_block(doris::vectorized::Block*)
        20# doris::vectorized::VCollectIterator::_topn_next(doris::vectorized::Block*)
        21# doris::vectorized::VCollectIterator::next(doris::vectorized::Block*)
        22# doris::vectorized::BlockReader::_direct_next_block(doris::vectorized::Block*, bool*)
        23# doris::vectorized::BlockReader::next_block_with_aggregation(doris::vectorized::Block*, bool*)
        24# doris::vectorized::NewOlapScanner::_get_block_impl(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        25# doris::vectorized::VScanner::get_block(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        26# doris::vectorized::VScanner::get_block_after_projects(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        27# doris::vectorized::ScannerScheduler::_scanner_scan(std::shared_ptr<doris::vectorized::ScannerContext>, std::shared_ptr<doris::vectorized::ScanTask>)
        28# std::_Function_handler<void (), doris::vectorized::ScannerScheduler::submit(std::shared_ptr<doris::vectorized::ScannerContext>, std::shared_ptr<doris::vectorized::ScanTask>)::$_1::operator()() const::{lambda()#1}>::_M_invoke(std::_Any_data const&)
        29# doris::ThreadPool::dispatch_thread()
        30# doris::Thread::supervise_thread(void*)
```
xinyiZzz added a commit to xinyiZzz/incubator-doris that referenced this pull request Jul 12, 2024
## Proposed changes

apache#36235 introduced, index page is not freed in query thread, so saved
tracker ptr when alloc page, so that page only needs to be freed before
query ends.

```
F20240624 18:44:51.880192 162249 mem_tracker_limiter.cpp:125] mem tracker label: Query#Id=f0511107829e465e-a87a985234018b77, consumption: 94, peak consumption: 636540, mem tracker not equal to 0 when mem tracker destruct, this usually means that memory tracking is inaccurate and SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER are not used correctly. 1. For query and load, memory leaks may have occurred, it is expected that the query mem tracker will be bound to the thread context using SCOPED_ATTACH_TASK and SCOPED_SWITCH_THREAD_MEM_TRACKER_LIMITER before all memory alloc and free. 2. If a memory alloc is recorded by this tracker, it is expected that be recorded in this tracker when memory is freed. 3. Merge the remaining memory tracking value by this tracker into Orphan, if you observe that Orphan is not equal to 0 in the mem tracker web or log, this indicates that there may be a memory leak. 4. If you need to transfer memory tracking value between two trackers, can use transfer_to..[Address Sanitizer]:
    0x605000160b30, size 46, strack trace:
        0#  Allocator<false, false, false>::alloc_impl(unsigned long, unsigned long)
        1#  doris::PageBase<Allocator<false, false, false> >::PageBase(unsigned long, bool, doris::segment_v2::PageTypePB)
        2#  doris::segment_v2::PageIO::read_and_decompress_page(doris::segment_v2::PageReadOptions const&, doris::segment_v2::PageHandle*, doris::Slice*, doris::segment_v2::PageFooterPB*)
        3#  doris::segment_v2::IndexedColumnReader::read_page(doris::segment_v2::PagePointer const&, doris::segment_v2::PageHandle*, doris::Slice*, doris::segment_v2::PageFooterPB*, doris::segment_v2::PageTypePB, doris::BlockCompressionCodec*, bool) const
        4#  doris::segment_v2::IndexedColumnReader::load_index_page(doris::segment_v2::PagePointerPB const&, doris::segment_v2::PageHandle*, doris::segment_v2::IndexPageReader*)
        5#  doris::segment_v2::IndexedColumnReader::load(bool, bool)
        6#  doris::segment_v2::BitmapIndexReader::_load(bool, bool, std::unique_ptr<doris::segment_v2::BitmapIndexPB, std::default_delete<doris::segment_v2::BitmapIndexPB> >)
        7#  doris::segment_v2::BitmapIndexReader::load(bool, bool)
        8#  doris::segment_v2::ColumnReader::_load_bitmap_index(bool, bool)
        9#  doris::segment_v2::ColumnReader::new_bitmap_index_iterator(doris::segment_v2::BitmapIndexIterator**)
        10# doris::segment_v2::Segment::new_bitmap_index_iterator(doris::TabletColumn const&, std::unique_ptr<doris::segment_v2::BitmapIndexIterator, std::default_delete<doris::segment_v2::BitmapIndexIterator> >*)
        11# doris::segment_v2::SegmentIterator::_init_bitmap_index_iterators()
        12# doris::segment_v2::SegmentIterator::init_iterators()
        13# doris::segment_v2::SegmentIterator::_init_impl(doris::StorageReadOptions const&)
        14# doris::segment_v2::SegmentIterator::init(doris::StorageReadOptions const&)
        15# doris::segment_v2::Segment::new_iterator(std::shared_ptr<doris::Schema const>, doris::StorageReadOptions const&, std::unique_ptr<doris::RowwiseIterator, std::default_delete<doris::RowwiseIterator> >*)
        16# doris::segment_v2::LazyInitSegmentIterator::init(doris::StorageReadOptions const&)
        17# doris::BetaRowsetReader::_init_iterator()
        18# doris::BetaRowsetReader::_init_iterator_once()
        19# doris::BetaRowsetReader::next_block(doris::vectorized::Block*)
        20# doris::vectorized::VCollectIterator::_topn_next(doris::vectorized::Block*)
        21# doris::vectorized::VCollectIterator::next(doris::vectorized::Block*)
        22# doris::vectorized::BlockReader::_direct_next_block(doris::vectorized::Block*, bool*)
        23# doris::vectorized::BlockReader::next_block_with_aggregation(doris::vectorized::Block*, bool*)
        24# doris::vectorized::NewOlapScanner::_get_block_impl(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        25# doris::vectorized::VScanner::get_block(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        26# doris::vectorized::VScanner::get_block_after_projects(doris::RuntimeState*, doris::vectorized::Block*, bool*)
        27# doris::vectorized::ScannerScheduler::_scanner_scan(std::shared_ptr<doris::vectorized::ScannerContext>, std::shared_ptr<doris::vectorized::ScanTask>)
        28# std::_Function_handler<void (), doris::vectorized::ScannerScheduler::submit(std::shared_ptr<doris::vectorized::ScannerContext>, std::shared_ptr<doris::vectorized::ScanTask>)::$_1::operator()() const::{lambda()#1}>::_M_invoke(std::_Any_data const&)
        29# doris::ThreadPool::dispatch_thread()
        30# doris::Thread::supervise_thread(void*)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by one committer. dev/2.1.5-merged dev/3.0.0-merged reviewed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants