首页 > 解决方案 > 带有 AddressSanitizer 的 std::system_error 说:“也许你正在使用 ulimit -v”

问题描述

我有一个多线程程序,它抛出一个std::system_error并且我不知道这个错误的来源,所以我尝试在启用地址清理器的调试模式下运行它。Asan 首先告诉它未能在特定地址上分配一定数量的字节,然后它报告:failed to write xxxx bytes: Perhaps you are using ulimit -v

我不明白使用 ulimit -v 是什么意思。我检查了 ulimit -a 的输出,我的虚拟内存设置为无限制。

我不知道如何跟踪这个问题以及我应该从 Asan 的报告中理解什么。下面是我的堆栈跟踪,我正在使用 bazel 进行编译和调试。

terminate called after throwing an instance of 'std::system_error'
  what():  Resource temporarily unavailable
*** Aborted at 1620157055 (unix time) try "date -d @1620157055" if you are using GNU date ***
external/com_google_glog/src/signalhandler.cc:229:16: runtime error: applying non-zero offset 18446744073709551615 to null pointer
PC: @                0x0 (unknown)
*** SIGABRT (@0x3f4001b07bd) received by PID 1771453 (TID 0x7fb788c2a700) from PID 1771453; stack trace: ***
    @     0x7fb7a24243c0 (unknown)
==1771453==ERROR: AddressSanitizer failed to allocate 0xfe000 (1040384) bytes at address fef8bbb0000 (errno: 12)
==1771453==ReserveShadowMemoryRange failed while trying to map 0xfe000 bytes. Perhaps you're using ulimit -v
==1771453==ERROR: AddressSanitizer failed to allocate 0x11000 (69632) bytes at address ff76912c000 (errno: 12)
==1771453==ReserveShadowMemoryRange failed while trying to map 0x11000 bytes. Perhaps you're using ulimit -v
    @     0x7fb7a189118b gsignal
    @     0x7fb7a1870859 abort
    @     0x7fb7a261f951 (unknown)
==1771453==ERROR: AddressSanitizer failed to deallocate 0x8000 (32768) bytes at address 0x7fb78cb5b000
==1771453==AddressSanitizer CHECK failed: ../../../../src/libsanitizer/sanitizer_common/sanitizer_posix.cc:60 "(("unable to unmap" && 0)) != (0)" (0x0, 0x0)
==1771453==ERROR: AddressSanitizer failed to allocate 0x1000 (4096) bytes of ReadFileToBuffer (error code: 12)
ERROR: Failed to mmap

标签: c++linuxdebuggingbazeladdress-sanitizer

解决方案


推荐阅读