Project

General

Profile

Bug #25154

librados application's symbol could conflict with the libceph-common

Added by Kefu Chai 5 months ago. Updated about 1 month ago.

Status:
Resolved
Priority:
Normal
Assignee:
Category:
-
Target version:
-
Start date:
07/30/2018
Due date:
% Done:

0%

Source:
Tags:
Backport:
luminous,mimic
Regression:
No
Severity:
3 - minor
Reviewed:
Affected Versions:
ceph-qa-suite:
Component(RADOS):
Pull request ID:

Description

quoting from Zongyou Yao's mail from ceph-devel ML

Internally, we have a program using librados C++ api to periodiclly check ceph's cluster status and send alerts to our internal system.
The little program is written using c++, and linked with librados and our base c++ library. The program works well with K version, but it core dumped with L version. Here is the minmum code to reproduce:

#include <iostream>
#include <rados/librados.hpp>

// Thread class from our base library
class Thread {
public:
    Thread() {
    }

};

int main() {
    Thread t;
    librados::Rados cluster;

    int error_code = cluster.init2("client.admin", "ceph", /* flags = */0);

    // ... code omitted

    return 0;
}

# g++ -I/path/to/ceph/src/include ./test.cpp  -L/path/to/ceph/build/lib -lrados
# export LD_LIBRARY_PATH=/path/to/ceph/build/lib
# ./a.out

Here is backtrace for the coredump:

ceph/src/log/Log.cc: In function 'void ceph::logging::Log::start()' thread 7f839ed72180 time 2018-07-30 14:55:58.340036
ceph/src/log/Log.cc: 509: FAILED assert(!is_started())
 ceph version 14.0.0-1698-gcecbf3e (cecbf3e5dda2dc132367d6d5d74b1b384846c31a) nautilus (dev)
 1: (ceph::__ceph_assert_fail(char const*, char const*, int, char const*)+0x14e) [0x7f83951305ce]
 2: (()+0x2e8787) [0x7f8395130787]
 3: (ceph::logging::Log::stop()+0) [0x7f839534b130]
 4: (CephContext::CephContext(unsigned int, code_environment_t, int)+0x1bd7) [0x7f839513f677]
 5: (common_preinit(CephInitParameters const&, code_environment_t, int)+0x4e) [0x7f83951677be]
 6: (()+0x884aa) [0x7f839e9c54aa]
 7: (rados_create2()+0xa8) [0x7f839e9c5888]
 8: ./a.out() [0x400be4]
 9: (__libc_start_main()+0xf5) [0x7f839dd02b35]
 10: ./a.out() [0x400af9]
Aborted

The reason for the core dump is the Thread::Thread in our base c++ library conflicts with librados from ceph's common Thread https://github.com/ceph/ceph/blob/master/src/common/Thread.h#L41
Both of them are in global namespace.

Maybe we'd better put https://github.com/ceph/ceph/blob/master/src/common in ceph or rados namespace. Or build librados using -Wl,-Bsymbolic -Wl,-Bsymbolic-functions flag.


Related issues

Copied to RADOS - Backport #26839: mimic: librados application's symbol could conflict with the libceph-common Resolved
Copied to RADOS - Backport #26840: luminous: librados application's symbol could conflict with the libceph-common Resolved

History

#2 Updated by Kefu Chai 4 months ago

  • Status changed from Need Review to Pending Backport

#3 Updated by Patrick Donnelly 4 months ago

  • Copied to Backport #26839: mimic: librados application's symbol could conflict with the libceph-common added

#4 Updated by Patrick Donnelly 4 months ago

  • Copied to Backport #26840: luminous: librados application's symbol could conflict with the libceph-common added

#5 Updated by Nathan Cutler about 1 month ago

  • Status changed from Pending Backport to Resolved

Also available in: Atom PDF