Skip to content

Commit 3c7479b

Browse files
authored
[ICRDMA] Fix link manager crash in case of missed library. (#26671)
ibdrv wrapper performs dlopen during first call of ib* "C" function. But in case of missed library will throw exception. To prevent cross language exception we will try to open the library before first ibv* call to check is ibverbs present.
1 parent 2f4d3b2 commit 3c7479b

File tree

5 files changed

+20
-16
lines changed

5 files changed

+20
-16
lines changed

.github/config/muted_ya.txt

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,22 +64,6 @@ ydb/core/viewer/tests test.py.test_topic_data_cdc
6464
ydb/core/viewer/ut Viewer.TabletMerging
6565
ydb/library/actors/core/ut_fat HeavyActorBenchmark.SendActivateReceiveCSV_10Pairs_LONG
6666
ydb/library/actors/core/ut_fat unittest.[*/*] chunk
67-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite.AllocMemoryManually
68-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.AllocMemoryWithMemPool/DummyMemPool
69-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.AllocMemoryWithMemPool/SlotMemPool
70-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.AllocMemoryWithMemPoolAsync/DummyMemPool
71-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.AllocMemoryWithMemPoolAsync/SlotMemPool
72-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.AllocMemoryWithMemPoolAsyncRandomOrderDealloc/SlotMemPool
73-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.FullChunkAllocationMultiThread/SlotMemPool
74-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.MemRegRcBuf/DummyMemPool
75-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.MemRegRcBuf/SlotMemPool
76-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.MemRegRcBufSubstr/DummyMemPool
77-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.MemRegRcBufSubstr/SlotMemPool
78-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.MemRegRope/DummyMemPool
79-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.MemRegRope/SlotMemPool
80-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.PageAlligned/SlotMemPool
81-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.SmallAllocationMultiThread/SlotMemPool
82-
ydb/library/actors/interconnect/rdma/ut TAllocatorSuite/WithAllPools.ThreadsDestroy/SlotMemPool
8367
ydb/library/actors/interconnect/ut_fat InterconnectUnstableConnection.InterconnectTestWithProxyTlsReestablishWithXdc
8468
ydb/library/actors/interconnect/ut_fat InterconnectZcLocalOp.ZcDisabledAfterHiddenCopy
8569
ydb/library/actors/interconnect/ut_fat InterconnectZcLocalOp.ZcIsDisabledByDefault

ydb/library/actors/interconnect/rdma/ctx.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ namespace NLinkMgr {
2020
class TRdmaLinkManager;
2121
}
2222

23+
// Open ibdrvlib. Throw exception in case of absent library, or other dlopen errors.
24+
// Is used to check the library is present.
25+
void IbvDlOpen();
26+
2327
struct TDeviceCtx : public NNonCopyable::TNonCopyable {
2428
TDeviceCtx(ibv_context* ctx, ibv_pd* pd);
2529

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#include <contrib/libs/ibdrv/symbols.h>
2+
3+
// symbols.h and verbs.h can't be used in one cpp file
4+
namespace NInterconnect::NRdma {
5+
void IbvDlOpen() {
6+
IBSym();
7+
}
8+
}

ydb/library/actors/interconnect/rdma/link_manager.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,13 @@ static class TRdmaLinkManager {
5454
}
5555

5656
TRdmaLinkManager() {
57+
// Make sure libibverbs.so is present
58+
try {
59+
IbvDlOpen();
60+
} catch (std::exception& ex) {
61+
Cerr << "Unalbe to load ibverbs library: " << ex.what() << Endl;
62+
return;
63+
}
5764
ScanDevices();
5865
}
5966
private:

ydb/library/actors/interconnect/rdma/ya.make

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ LIBRARY()
22

33
SRCS(
44
ctx.cpp
5+
ctx_open.cpp
56
link_manager.cpp
67
mem_pool.cpp
78
)

0 commit comments

Comments
 (0)