Skip to content

[fix](be) Fix duplicate symbol __lsan_ignore_object when build be ut in LSAN+UBSAN#64164

Open
heguanhui wants to merge 1 commit into
apache:masterfrom
heguanhui:fix/lsan-duplicate-symbol
Open

[fix](be) Fix duplicate symbol __lsan_ignore_object when build be ut in LSAN+UBSAN#64164
heguanhui wants to merge 1 commit into
apache:masterfrom
heguanhui:fix/lsan-duplicate-symbol

Conversation

@heguanhui
Copy link
Copy Markdown
Contributor

What problem does this PR solve?

Issue Number: close #64163

Related PR: #

Problem Summary: When building BE unit tests in LSAN+UBSAN mode, the linker reports a duplicate symbol error for __lsan_ignore_object. The root cause is that phdr_cache.cpp manually declares and defines __lsan_ignore_object, which conflicts with the LSAN runtime library that already provides this symbol. Additionally, leak_annotations.h only enables ANNOTATE_LEAKING_OBJECT_PTR under address_sanitizer but not under leak_sanitizer independently.

The fix:

  1. Replace the manual __lsan_ignore_object declaration/definition in phdr_cache.cpp with the existing ANNOTATE_LEAKING_OBJECT_PTR macro from leak_annotations.h
  2. Extend leak_annotations.h to also enable ANNOTATE_LEAKING_OBJECT_PTR when leak_sanitizer is detected (not just address_sanitizer)

Release note

None

Check List (For Author)

  • Test

    • Unit Test: BE UT runs successfully in LSAN+UBSAN mode after the fix (8194 tests from 912 test suites)
    • Regression test
    • Manual test
    • No need to test or manual test. Explain why:
      • This is a refactor/code format and no logic has been changed.
      • Previous test can cover this change.
      • No code files have been changed.
      • Other reason
  • Behavior changed:

    • No.
    • Yes.
  • Does this need documentation?

    • No.
    • Yes.

Check List (For Reviewer who merge this PR)

  • Confirm the release note
  • Confirm test cases
  • Confirm document
  • Add branch pick label

@hello-stephen
Copy link
Copy Markdown
Contributor

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

Please clearly describe your PR:

  1. What problem was fixed (it's best to include specific error reporting information). How it was fixed.
  2. Which behaviors were modified. What was the previous behavior, what is it now, why was it modified, and what possible impacts might there be.
  3. What features were added. Why was this function added?
  4. Which code was refactored and why was this part of the code refactored?
  5. Which functions were optimized and what is the difference before and after the optimization?

…in LSAN+UBSAN

### What problem does this PR solve?

Issue Number: close apache#64163

Problem Summary: When building BE unit tests in LSAN+UBSAN mode, the linker reports a duplicate symbol error for __lsan_ignore_object. The root cause is that phdr_cache.cpp manually declares and defines __lsan_ignore_object, which conflicts with the LSAN runtime library that already provides this symbol. Additionally, leak_annotations.h only enables ANNOTATE_LEAKING_OBJECT_PTR under address_sanitizer but not under leak_sanitizer independently.

### Release note

None

### Check List (For Author)

- Test: Unit Test
    - BE UT runs successfully in LSAN+UBSAN mode after the fix
- Behavior changed: No
- Does this need documentation: No
@heguanhui heguanhui force-pushed the fix/lsan-duplicate-symbol branch from 9da4a21 to 92697d6 Compare June 6, 2026 18:23
@heguanhui
Copy link
Copy Markdown
Contributor Author

run buildall

@hello-stephen
Copy link
Copy Markdown
Contributor

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

------ Round 1 ----------------------------------
orders	Doris	NULL	NULL	0	0	0	NULL	0	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	17735	4441	4122	4122
q2	q3	10774	1344	821	821
q4	4688	509	343	343
q5	7555	860	615	615
q6	181	172	140	140
q7	759	822	652	652
q8	9354	1636	1605	1605
q9	5933	4433	4500	4433
q10	6802	1813	1525	1525
q11	429	270	246	246
q12	627	426	290	290
q13	18137	3408	2773	2773
q14	284	257	243	243
q15	q16	815	772	707	707
q17	949	948	939	939
q18	6724	5722	5671	5671
q19	1302	1316	971	971
q20	507	405	262	262
q21	6174	2782	2552	2552
q22	445	366	313	313
Total cold run time: 100174 ms
Total hot run time: 29223 ms

----- Round 2, with runtime_filter_mode=off -----
orders	Doris	NULL	NULL	150000000	42	6422171781	NULL	22778155	NULL	NULL	2023-12-26 18:27:23	2023-12-26 18:42:55	NULL	utf-8	NULL	NULL	
============================================
q1	4924	4798	4740	4740
q2	q3	5076	5225	4663	4663
q4	2094	2207	1382	1382
q5	4778	4823	4712	4712
q6	233	186	132	132
q7	1858	1779	1543	1543
q8	2429	2031	1946	1946
q9	7413	7384	7365	7365
q10	4731	4652	4191	4191
q11	538	387	358	358
q12	730	758	522	522
q13	2967	3381	2773	2773
q14	279	276	252	252
q15	q16	670	688	607	607
q17	1267	1247	1245	1245
q18	7173	6842	6708	6708
q19	1136	1105	1102	1102
q20	2210	2197	1950	1950
q21	5239	4604	4447	4447
q22	518	454	411	411
Total cold run time: 56263 ms
Total hot run time: 51049 ms

@hello-stephen
Copy link
Copy Markdown
Contributor

TPC-DS: Total hot run time: 168973 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 92697d612107a90e302795090e4c8d0e93e4aa9d, data reload: false

query5	4337	635	485	485
query6	443	200	185	185
query7	4919	555	306	306
query8	366	218	205	205
query9	8770	4020	3962	3962
query10	459	307	263	263
query11	5919	2321	2132	2132
query12	168	103	103	103
query13	1256	620	456	456
query14	6380	5414	5096	5096
query14_1	4407	4405	4395	4395
query15	210	197	188	188
query16	1005	464	438	438
query17	1131	713	599	599
query18	2536	496	346	346
query19	206	195	152	152
query20	111	108	107	107
query21	210	141	120	120
query22	13646	13543	13335	13335
query23	17356	16435	16132	16132
query23_1	16362	16401	16227	16227
query24	7580	1810	1313	1313
query24_1	1297	1288	1315	1288
query25	561	445	375	375
query26	1295	327	155	155
query27	2698	562	344	344
query28	4412	2035	2038	2035
query29	1054	597	480	480
query30	303	231	198	198
query31	1147	1059	979	979
query32	98	67	59	59
query33	550	320	252	252
query34	1191	1235	660	660
query35	782	797	688	688
query36	1466	1476	1315	1315
query37	158	98	89	89
query38	3268	3171	2991	2991
query39	924	929	907	907
query39_1	878	878	879	878
query40	218	120	97	97
query41	66	62	61	61
query42	93	97	92	92
query43	315	320	272	272
query44	
query45	195	188	178	178
query46	1123	1234	762	762
query47	2407	2361	2332	2332
query48	394	415	295	295
query49	623	487	355	355
query50	1037	349	240	240
query51	4388	4306	4239	4239
query52	95	89	77	77
query53	234	269	190	190
query54	261	242	196	196
query55	78	74	68	68
query56	239	232	240	232
query57	1462	1401	1335	1335
query58	243	206	204	204
query59	1535	1646	1447	1447
query60	272	245	233	233
query61	157	158	155	155
query62	691	653	586	586
query63	227	182	183	182
query64	2590	776	625	625
query65	
query66	1775	464	367	367
query67	29750	29716	29528	29528
query68	
query69	417	313	266	266
query70	947	894	908	894
query71	297	220	210	210
query72	2914	2360	2379	2360
query73	828	742	419	419
query74	5140	4930	4803	4803
query75	2657	2551	2245	2245
query76	2331	1137	780	780
query77	352	372	281	281
query78	12459	12537	11984	11984
query79	1493	1026	771	771
query80	761	468	375	375
query81	471	277	241	241
query82	581	159	128	128
query83	348	273	250	250
query84	254	140	111	111
query85	893	528	446	446
query86	399	309	259	259
query87	3381	3429	3202	3202
query88	3599	2711	2716	2711
query89	436	372	329	329
query90	1830	170	187	170
query91	171	161	134	134
query92	61	60	59	59
query93	1532	1450	880	880
query94	592	360	321	321
query95	688	369	350	350
query96	1004	804	346	346
query97	2709	2708	2569	2569
query98	214	203	209	203
query99	1143	1185	1023	1023
Total cold run time: 251654 ms
Total hot run time: 168973 ms

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Build BE UT failed with duplicate symbol __lsan_ignore_object in LSAN+UBSAN mode

2 participants