[SERVER-79669] link fail under UBSAN: missing typeinfo for mongo::ClientCursor Created: 03/Aug/23  Updated: 29/Oct/23  Resolved: 10/Aug/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Billy Donahue Assignee: Benety Goh
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
Problem/Incident
is caused by SERVER-78655 Integrate TransactionResources with g... Closed
Assigned Teams:
Storage Execution EMEA
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Execution NAMR Team 2023-08-21
Participants:
Linked BF Score: 163

 Description   

This is a UBSAN build. I think what's going on here is that UBSAN needs more typeinfo than a normal build, in order to check the validity of downcasts, etc.

Possible solution: the library that includes shard_role.o need to depend on the library that provides mongo::ClientCursor and its typeinfo structure.

https://parsley.mongodb.com/evergreen/mongodb_mongo_master_rhel80_debug_ubsan_all_feature_flags_compile_dist_test_patch_eba65446f5d9279b65041e15ce7dd8c1138f5537_64cbc13f850e61d843791776_23_08_03_15_01_38/0/task?bookmarks=14323

[2023/08/03 15:42:49.080] /opt/mongodbtoolchain/v4/bin/clang++ @/data/mci/4fb2b158d6ffdbb635b2e5145fedb59a/tmp/tmpjljafga4.lnk
[2023/08/03 15:42:50.166] Command execution time: build/cached/mongo/tools/mongobridge_tool/mongobridge: 1.099147 seconds
[2023/08/03 15:42:51.702] oom_auto_retry.py captured error:
[2023/08/03 15:42:51.702] ld.lld: error: undefined symbol: typeinfo for mongo::ClientCursor
[2023/08/03 15:42:51.702] >>> referenced by shard_role.cpp
[2023/08/03 15:42:51.702] >>>               shard_role.o:(.data+0x2048) in archive build/cached/mongo/db/libshard_role.a
[2023/08/03 15:42:51.702] >>> referenced by shard_role.cpp
[2023/08/03 15:42:51.702] >>>               shard_role.o:(.data+0x21A8) in archive build/cached/mongo/db/libshard_role.a
[2023/08/03 15:42:51.702] >>> referenced by shard_role.cpp
[2023/08/03 15:42:51.702] >>>               shard_role.o:(.data+0xBFF8) in archive build/cached/mongo/db/libshard_role.a
[2023/08/03 15:42:51.702] >>> referenced 2 more times
[2023/08/03 15:42:51.702] clang-12: error: linker command failed with exit code 1 (use -v to see invocation)



 Comments   
Comment by Githook User [ 09/Aug/23 ]

Author:

{'name': 'Benety Goh', 'email': 'benety@mongodb.com', 'username': 'benety'}

Message: SERVER-79669 remove ClientCursor references from shard_role.h

This fixes build compile_dist_test on UBSAN variants.

Co-authored-by: Yujin Kang Park <36410031+ykangpark@users.noreply.github.com>
Branch: master
https://github.com/mongodb/mongo/commit/7bf574456b39b00e0d00e3e3a153d15cd695fbd6

Comment by Benety Goh [ 08/Aug/23 ]

client_cursor.cpp is in the query_exec library. Adding query_exec as a LIBDEPS_PRIVATE dependency to shard_role produces the following cycle:

scons: *** [build/install/bin/mongos] Library dependency cycle detected: build/cached/mongo/db/auth/libauth_checks.dylib => build/cached/mongo/db/update/libupdate_driver.dylib => build/cached/mongo/db/query/libcanonical_query.dylib => build/cached/mongo/db/cst/libcst.dylib => build/cached/mongo/db/pipeline/libpipeline.dylib => build/cached/mongo/db/libdbdirectclient.dylib => build/cached/mongo/db/libshard_role.dylib => build/cached/mongo/db/libquery_exec.dylib => build/cached/mongo/db/auth/libauth_checks.dylib
scons: building terminated because of errors.

Comment by Billy Donahue [ 03/Aug/23 ]

It looks like the ClientCursor usage in shard_role.cpp started last week with SERVER-78655. We probably just need a LIBDEP of some sort to accompany that change.

jordi.olivares-provencio@mongodb.com does that sound right?

Generated at Thu Feb 08 06:41:36 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.