最近在项目中使用了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. UVa 10603 倒水问题

    https://vjudge.net/problem/UVA-10603 题意:三个杯子,倒水问题.找出最少倒水量. 思路:路径寻找问题.不难,暴力枚举. #include<iostream&g ...

  2. Linux——文件搜索命令简单笔记

    一: 命令名称:which 命令所在路径:/usr/bin/which 执行权限:所有用户 功能描述:显示系统命令所在目录 范例:$ which ls 还有一个whereeis ls 命令 二: 命令 ...

  3. 爬虫框架pyspider的使用

    j概要:了解了爬虫的基础知识后,接下来我们来使用框架来写爬虫,用框架会使我们写爬虫更加简单,接下来我们来了解一下,pyspider框架的使用,了解了该框架,妈妈再也不用担心我们的学习了. 前期准备: ...

  4. 小行星碰撞 Asteroid Collision

    2018-08-07 11:12:01 问题描述: 问题求解: 使用一个链表模拟栈,最后的状态一定是左侧全部是负值,表示的是向左飞行,右侧的全部是正值,表示的是向右飞行. 遍历整个数组,对于每个读到的 ...

  5. Hibernate实例

    Hibernate实例 一.Hibernate简介 Hibernate是简化项目中连接数据库的一个框架工具 Hibernate是Java领域类技术成熟稳定的ORM框架 * ORM是对象关系映射 * 使 ...

  6. java服务突然被挂掉,停止服务处理方案

    一.问题背景 该问题出现在我们测试环境.测试环境部署了很多java应用. 其中一个数据服务(主要提供订单交易数据聚合查询),用着用着就服务挂掉了也就是进程没有了. 二.分析过程 1.了解服务器配置  ...

  7. 20 多继承 MRO 算法 深度优先遍历 super

    类的多继承 一个类可以继承多个无关的类. 一个类可以被多个无关的类继承 1.经典类. 在python2.2之前. 已经是历史了. MRO 采用的是树形结构的深度递归遍历(一条道跑到黑) 2.新式类 在 ...

  8. java.lang.string split 以点分割字符串无法正常拆分字符串

    //错误的做法String ip="192.168.11.23"; String[] spstr_IP=ip.split(".");//这种方式无法拆分在ip字 ...

  9. quartz---的Scheduler

    quartz---的Scheduler 从这副图中可以很直观的看出来quartz的关系: 调度:Scheduler任务调度器,是实际执行任务调度的控制器.在spring中通过SchedulerFact ...

  10. quartz---触发job时间和结束时间

    quartz:Trigger:触发job时间和结束时间 package com.imooc.demo.helloQuartz; import java.text.SimpleDateFormat; i ...