gpt4 book ai didi

linux - Ubuntu 18中的服务崩溃问题

转载 作者:行者123 更新时间:2023-12-02 07:30:11 25 4
gpt4 key购买 nike

我有一个静态库,当我尝试从servicemain中的静态库创建类的对象时,服务启动时崩溃。
当我禁用静态库调用类时,Service可以正常工作。

我正在使用Poco库作为服务处理程序,在崩溃转储中,我们仅获得Poco库的调用堆栈,而不是静态库的单个跟踪,因此无法找出根本原因。代码在Ubuntu 16和14上运行良好。

下面是堆栈跟踪。

#0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51
#1 0x00007f799927f801 in __GI_abort () at abort.c:79
#2 0x00007f799e7cc755 in Poco::SignalHandler::handleSignal(int) ()
from /lib/libPocoFoundation.so.60
#3 <signal handler called>
#4 0x00007f799bb09b40 in std::string::clear() () from /lib/libstdc++.so.6
#5 0x0000563554610794 in Poco::Path::clear (this=0x7fffabfdd3e0) at src/Path.cpp:597
#6 0x00007f799e7bc5e1 in Poco::Path::parseUnix(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib/libPocoFoundation.so.60
#7 0x00007f799e7bc889 in Poco::Path::assign(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib/libPocoFoundation.so.60
#8 0x00007f799e7bc916 in Poco::Path::Path(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) () from /lib/libPocoFoundation.so.60
#9 0x00007f799e483e56 in Poco::Util::Application::getApplicationPath(Poco::Path&) const ()
from /lib/libPocoUtil.so.60
#10 0x00007f799e48565c in Poco::Util::Application::init() () from /lib/libPocoUtil.so.60
#11 0x00007f799e49708c in Poco::Util::ServerApplication::run(int, char**) ()
from /lib/libPocoUtil.so.60
#12 0x0000563554107544 in main (argc=2, argv=0x7fffabfdd958) at ../../../src/servicemain/main.cpp:22
(gdb)

请提出建议。

最佳答案

not a single trace of our static library



您的堆栈跟踪是可疑的:为什么(几乎)除第5帧外的每个帧都来自 /lib/libPocoUtil.so.60,而第5帧来自 src/Path.cpp:597编译成主要可执行文件?

我怀疑您的静态库出于某种原因提供了 Poco::Path::clear()的定义,以及该定义:
  • libPocoUtil.so.60
  • 不兼容
  • 赢得libPocoUtil.so.60中提供的定义。

  • 您需要弄清楚 src/Path.cpp是如何以二进制形式结束的,并删除该错误将解决您的崩溃问题。

    更新:

    There are references of Path.hpp of boost in my static library. Could that be reason ?



    可能有很多原因。您需要研究 src/Path.cpp为什么链接到主可执行文件(它是您的代码,还是 Poco的一部分?),以及为什么它定义了 Poco::Path::clear()方法。

    首先,请编辑您的问题,并在 src/Path.cpp的597行附近显示代码。

    关于linux - Ubuntu 18中的服务崩溃问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62303605/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com