使用tcmalloc编译启动时宕机
链接时增加了-ltcmalloc,编好之后服务器第一次启动就宕机了,code文件堆栈如下:
Program terminated with signal SIGABRT, Aborted.
# 0x0000000000bdfda8 in raise (sig=sig@entry=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:
../nptl/sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) bt
# 0x0000000000bdfda8 in raise (sig=sig@entry=) at ../nptl/sysdeps/unix/sysv/linux/raise.c:
# 0x0000000000b63538 in abort () at abort.c:
# 0x0000000000b58487 in uw_init_context_1 (context=context@entry=0x7ffeeca2b170, outer_cfa=outer_cfa@entry=0x7ffeeca2b420, outer_ra=0xaa23da <GetStackTrace_libgcc(void**, int, int)+>)
at ../../../gcc-5.1./libgcc/unwind-dw2.c:
# 0x0000000000b59048 in _Unwind_Backtrace (trace=0xaa25c0 <libgcc_backtrace_helper(_Unwind_Context*, void*)>, trace_argument=0x7ffeeca2b420) at ../../../gcc-5.1./libgcc/unwind.inc:
# 0x0000000000aa23da in GetStackTrace_libgcc (result=<optimized out>, max_depth=<optimized out>, skip_count=<optimized out>) at src/stacktrace_libgcc-inl.h:
# 0x0000000000aa2ab4 in GetStackTrace (result=result@entry=0x2f3d250, max_depth=max_depth@entry=, skip_count=skip_count@entry=) at src/stacktrace.cc:
# 0x0000000000a9f256 in tcmalloc::RecordGrowth (growth=) at src/page_heap.cc:
# tcmalloc::PageHeap::GrowHeap (this=0x1757a80 <tcmalloc::Static::pageheap_>, n=<optimized out>) at src/page_heap.cc:
# 0x0000000000a9f553 in tcmalloc::PageHeap::New (this=0x1757a80 <tcmalloc::Static::pageheap_>, n=n@entry=) at src/page_heap.cc:
# 0x0000000000a99075 in tcmalloc::CentralFreeList::Populate (this=this@entry=0x18dbf00 <tcmalloc::Static::central_cache_+>) at src/central_freelist.cc:
# 0x0000000000a99278 in tcmalloc::CentralFreeList::FetchFromOneSpansSafe (this=0x18dbf00 <tcmalloc::Static::central_cache_+>, N=, start=0x7ffeeca2b5c0, end=0x7ffeeca2b5c8)
at src/central_freelist.cc:
# 0x0000000000a99304 in tcmalloc::CentralFreeList::RemoveRange (this=0x18dbf00 <tcmalloc::Static::central_cache_+>, start=start@entry=0x7ffeeca2b5c0, end=end@entry=0x7ffeeca2b5c8,
N=) at src/central_freelist.cc:
# 0x0000000000aa1110 in tcmalloc::ThreadCache::FetchFromCentralCache (this=this@entry=0x2f7d240, cl=cl@entry=, byte_size=byte_size@entry=,
oom_handler=oom_handler@entry=0xa953d0 <(anonymous namespace)::nop_oom_handler(size_t)>) at src/thread_cache.cc:
# 0x0000000000c2870b in tcmalloc::ThreadCache::Allocate (oom_handler=0xa953d0 <(anonymous namespace)::nop_oom_handler(size_t)>, cl=, size=, this=<optimized out>)
at src/thread_cache.h:
# (anonymous namespace)::do_malloc (size=) at src/tcmalloc.cc:
# tcmalloc::do_allocate_full<tcmalloc::malloc_oom> (size=) at src/tcmalloc.cc:
# tcmalloc::allocate_full_malloc_oom (size=size@entry=) at src/tcmalloc.cc:
# 0x0000000000c28876 in tcmalloc::dispatch_allocate_full<tcmalloc::malloc_oom> (size=) at src/tcmalloc.cc:
# malloc_fast_path<tcmalloc::malloc_oom> (size=size@entry=) at src/tcmalloc.cc:
# tc_malloc (size=size@entry=) at src/tcmalloc.cc:
# 0x0000000000c1cccb in _dl_get_origin () at ../sysdeps/unix/sysv/linux/dl-origin.c:
# 0x0000000000bd58ff in _dl_non_dynamic_init () at dl-support.c:
# 0x0000000000bd6a08 in __libc_init_first (argc=argc@entry=, argv=argv@entry=0x7ffeeca2c7b8, envp=0x7ffeeca2c7e0) at ../csu/init-first.c:
# 0x0000000000b5b23d in __libc_start_main (main=0x41d6dc <main(int, char**)>, argc=, argv=0x7ffeeca2c7b8, init=0xb5b6c0 <__libc_csu_init>, fini=0xb5b750 <__libc_csu_fini>,
rtld_fini=0x0, stack_end=0x7ffeeca2c7a8) at libc-start.c:
# 0x0000000000400c1d in _start ()
(gdb)
因为tcmalloc的静态库文件是自己编译的,有源码,于是乎就开始纠结地看起了源码。看了很久源码并且尝试调试,都没有什么进展。看堆栈提到了_Unwind_Backtrace,并且想起来在编译的时候,看到过关于unwind的相关警告:
$ ./configure
... ...
configure: WARNING: No frame pointers and no libunwind. Using experimental backtrace capturing via libgcc. Expect crashy cpu profiler.
查看源码目录下的INSTALL文件(我的 gperftools 版本是2.7),查看到如下说明:

重新编译:
$ ./configure --enable-frame-pointers
... ...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating src/gperftools/tcmalloc.h
config.status: creating src/windows/gperftools/tcmalloc.h
config.status: creating src/config.h
config.status: src/config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
$ make
果然没有警告了,然后拷贝.libs目录下的 libtcmalloc.a 到静态编译目录,重新编译服务器,再次开启,果然没有报错了。
使用tcmalloc编译启动时宕机的更多相关文章
- ESXi6.5上的Ubuntu虚机在远程SSH时宕机
情况是这样的, 有一个ESXi6.5上跑的Ubuntu虚机, 版本是18.04.1, 今天升级成18.04.2后, 就发现远程连接SSH不对劲, 在本地登录和操作都好好的, 只要远程SSH一连接, 服 ...
- Vertica节点宕机处理一例
Vertica节点宕机处理一例: 查询数据库版本和各节点状态 常规方式启动宕机节点失败 进一步查看宕机节点的详细日志 定位问题并解决 1. 查询数据库版本和各节点状态 dbadmin=> sel ...
- 编译安装或者mysql启动时遇到的错误小记
编译安装遇到的错误:进入mysql目录 [root@localhost software]# cd mysql-5.6.19 [root@localhost mysql-5.5.11]# cmake ...
- ActiveMQ producer 提交事务时突然宕机,会发生什么
producer 在提交事务时,发生宕机,commit 的命令没有发送到 broker,这时会发生什么? ActiveMQ 开启事务发送消息的步骤: session.getTransactionCon ...
- 服务器宕机,mysql无法启动,job for mysql.service failed because the process exited with error code,数据库备份与恢复
[问题现象] 服务器在运行过程中,因人为意外导致电源被拔,服务器宕机,mysql重启不成功,报错如下 根据提示,输入systemctl status mysql.service和journalctl ...
- 机器突然宕机导致hdfs启动一直超时的行为
今天手里其中一个集群几个机器突然宕机,启动hdfs一直超时. clouder-scm-agent主要报了这个错RROR: Unexpected error 'getpwuid(): uid not f ...
- Oracle备库宕机启动解决方案
简介 ORA-10458: standby database requires recovery ORA-01196: 文件 1 由于介质恢复会话失败而不一致 ORA-01110: 数据文件 1: ' ...
- 万答#4,延迟从库加上MASTER_DELAY,主库宕机后如何快速恢复服务
欢迎来到 GreatSQL社区分享的MySQL技术文章,如有疑问或想学习的内容,可以在下方评论区留言,看到后会进行解答 当主库宕机后,延迟从库如何才能"取消"主动延迟,以便恢复服务 ...
- elasticsearch介绍集群,模拟横向扩展节点、节点宕机、改变分片
出处:[http://www.cnblogs.com/dennisit/p/4133131.html] ,防楼主删博,故保留一份! elasticsearch用于构建高可用和可扩展的系统.扩展 ...
随机推荐
- 【DUBBO】dubbo架构详解(转载)
转载地址:http://shiyanjun.cn/archives/325.html Dubbo是Alibaba开源的分布式服务框架,它最大的特点是按照分层的方式来架构,使用这种方式可以使各个层之间解 ...
- conduit 安装试用
备注: 测试安装环境使用docker mac 版本(目前版本已经支持kubernetes了) 1. 基本安装 curl https://run.conduit.io/install | bash 配置 ...
- cockroachdb 安装试用(单机伪分布式)
1. 下载 以下地址,选择对应的操作系统版本即可 https://www.cockroachlabs.com/docs/stable/install-cockroachdb.html 2. 启动 // ...
- springboot: 集成jdbc
1.pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www ...
- python编程规范系列--建议08~18
本系列来自<编写高质量代码 改善python程序的91个建议>的读书笔记整理. 本章主要内容 建议8:利用assert语句来发现问题 建议9:数据交换值时不推荐使用中间交换变量 建议10 ...
- qing-automation简单入门介绍
1.相关文档:http://www.51testing.com/html/50/category-catid-250.html 2.进行Qing automation相关操作之前,必须安装好jdk跟a ...
- ubuntu15.10下code::blocks设置运行窗口为gnome命令行
code::blocks编译运行C++程序(F9)默认出现的运行串口在有鼠标的情况下进行粘贴还是很方便的,只要按下鼠标滑轮,位与剪切板中的数据就能粘贴到运行串口中. 但是对于用笔记本而且没有鼠标地童鞋 ...
- JEECG获取当前登录人的值
TSUser user = ResourceUtil.getSessionUserName(); mv.addObject("fbillerid", user.getUserNam ...
- 301重定向方法大全及SEO中网址规范化,看着不错先收下
301重定向方法大全及SEO中网址规范化 现在大多数网站都存在一些内容相同但网址(URL)不一样的重复内容,这些重复的内容对于搜索引擎来说却可能被认为是复制网页,复制网页虽然不会被惩罚但因多个网址存在 ...
- nginx 作为反向代理实现负载均衡的例子
以下我们就来举例说明如何使用 nginx 实现负载均衡.因为nginx在处理并发方面的优势,现在这个应用非常常见.nginx 这个轻量级.高性能的 web server 主要可以干两件事情: 〉直接作 ...