最近在项目中使用了libev,遇到一个很奇怪的crash,服务器运行随机时间后有一定的概率奔溃,输出的最后一行log是:

(libev) cannot allocate xxx bytes, aborting。

因为捕捉了SIGINT信号,所以可以确定崩溃就是由于libev的这个abort。开始是以为内存越界之类,排查了strncpy, memset,memcpy等使用的地方,并且使用valgrind工具检查,并没有发现内存操作异常的地方。在网上搜索了很久也没找到相关的内容。后来通过客户端的行为找到了规律,最终定位到问题的原因是:

  • ev_timer_start调用之后再次调用ev_timer_init,就会百分百出现此错误。

虽然正常的调用流程是先Init再start,但是如果该ev_timer被复用,并且通过再次Init设置了不同的callback时,就可能发生start之后再init的情况。当然这种情况,只要在init之前执行一次ev_timer_stop调用就可以避免这个问题了。

(libev) cannot allocate xxx bytes, aborting 问题的一种触发条件的更多相关文章

  1. Fatal error: Allowed memory size of 524288000 bytes exhausted (tried to allocate 64 bytes) in D

    Fatal error: Allowed memory size of 524288000 bytes exhausted (tried to allocate 64 bytes) in D 从数据库 ...

  2. PHP运行错最有效解决办法Fatal error: Out of memory (allocated 786432) (tried to allocate 98304 bytes) in H:\freehost\zhengbao2\web\includes\lib_common.php on line 744

    原文 PHP运行错最有效解决办法Fatal error: Out of memory (allocated 6029312) Fatal error: Out of memory (allocated ...

  3. (转载)PHP的内存限制 Allowed memory size of 134217728 bytes exhausted (tried to allocate 1099 bytes) in

    (转载)http://blog.csdn.net/beyondlpf/article/details/7794028 Fatal error: Allowed memory size of 13421 ...

  4. ORA-04030: out of process memory when trying to allocate 152 bytes (Logminer LCR c,krvtadc)

    今天使用LogMiner找回误更新的数据时,查询v$logmnr_contents时,遇到了"ORA-04030: out of process memory when trying to ...

  5. PHP的内存限制 Allowed memory size of 134217728 bytes exhausted (tried to allocate 1099 bytes) in

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 1099 bytes) in   Fa ...

  6. [未解决:快速滑动collectionveiw请求数据崩溃]:unable to allocate 6553600 bytes for bitmap data

    崩溃:unable to allocate 6553600 bytes for bitmap data

  7. Could not allocate 40960 bytes percpu data

    2017-10-01 21:40:56[  176.700091] vif: Could not allocate 40960 bytes percpu data[  263.762812] perc ...

  8. Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 2611816 bytes)

    一段PHP程序执行报错: Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 261181 ...

  9. Permanent data region free space insufficient to allocate 64792 bytes of memory

    TT0802: Database permanent space exhaustedTT6220: Permanent data region free space insufficient to a ...

随机推荐

  1. Java I/O学习 标准的I/O重定向

    public class Test{ /* * 标准的I/O重定向 * System.setIn(InputStream) * System.setOut(PrintStream) * System. ...

  2. bugfree 数据库配置 显示No such file or directory

    把数据库服务器  localhost   改成127.0.0.1 sudo vi /etc/hosts 增加: 127.0.0.1   localhost 127.0.0.1   你的hostname ...

  3. STL__size_t, ptrdiff_t, size_type, difference_type

    http://blog.csdn.net/zhaowei123191/article/details/5617559 ize_t 是unsigned类型, 用于指明数组长度或下标,它必须是一个正数,s ...

  4. [原][OSG]整理osg渲染一帧的流程

    参考:最长的一帧 先看下frame void ViewerBase::frame(double simulationTime) { advance(simulationTime);//记录仿真时间,帧 ...

  5. eclipse 里,打开的文件的各个标签,标题乱码。

    Eclipse Mars 版本有这个问题. 提交到社区了,也还是没有人回答.Eclipse看来是没落了. https://www.eclipse.org/forums/index.php/t/1072 ...

  6. Silverlight自定义控件系列 – TreeView (2) 基本布局和States

    TreeView的树形结构都以缩进方式显示,现在来完成这部分. 首先,要定义出每个节点上都包含什么东西.先看看Win7资源管理器的TreeView: 图2.1 资源管理器 一个通用的TreeView至 ...

  7. codeforces 555a//Case of Matryoshkas// Codeforces Round #310(Div. 1)

    题意:1-n的数字,大的在小的后面,以这种规则已经形成的几个串,现在要转为一个串,可用的操作是在末尾拆或添加,问要操作几次? 模拟了很久还是失败,看题解才知道是数学.看来这种只要结果的题,模拟很不合算 ...

  8. python-day68--模型层基础(model)

    一.ORM : object relationship mapping   对象映射关系 映射关系: 表名 <-------> 类名 字段 <-------> 属性 表记录 & ...

  9. HDU 2157 矩阵幂orDP

    How many ways?? Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)T ...

  10. Oracle11g温习-第一章:Oracle 体系架构

    2013年4月27日 星期六 10:20 1.oracle 网络架构及应用环境 1. ORACLE 实例——包括内存结构与后台进程 2. ORACLE 数据库——物理操作系统文件的集合 3. 了解内存 ...