最近在项目中使用了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. PHP框架CI(codeigniter)的使用笔记

    流程图: 控制: 1.当想在控制类中直接跳转到其它控制类时,可以使用redirect()函数. 2.session的应用,在分页查询的时候可以用session(普通的get方式对CI来说太麻烦了):在 ...

  2. python 判断一个数字是否为3的幂

    def is_Power_of_three(n): == ): n /= ; ; print(is_Power_of_three()) print(is_Power_of_three()) print ...

  3. Mutex, semaphore, spinlock

    Mutex是一把钥匙,一个人拿了就可进入一个房间,出来的时候把钥匙交给队列的第一个.一般的用法是用于串行化对critical section代码的访问,保证这段代码不会被并行的运行. Semaphor ...

  4. MVC扩展Url.Action方法解决复杂对象参数问题

    1:问题描述 @Url.Action("Index", "Home", new { Key = "Key", Val = new { Nam ...

  5. [框架模式]经典的模型视图控制器模式MVC

    参考:<设计模式> http://blog.csdn.net/u010168160/article/details/43150049 百度百科 引言: Model(模型)是应用程序中用于处 ...

  6. 算法笔记--st表

    概述:用倍增法求区间最值的离线算法,O(nlogn)预处理,O(1)访问. 预处理: 状态:st[i][j]:[i,i+2^j)之间的最值 状态转移:如果j等于0,st[i][j]=a[i] 如果j大 ...

  7. Codeforces 839B - Game of the Rows

    839B - Game of the Rows 思路:先放4个的,然后再放2个的,最后再放1个的. 代码: #include<bits/stdc++.h> using namespace ...

  8. js 去重

        function unique(array) { let obj = {}; return array.filter((item, index, array) => { let newI ...

  9. python-GUI,生成ssn

    第一次做这个, 样子有点丑,主要是实现功能,做测试的时候,经常要用到身份证号.手机号.姓名等,这里先生成ssn,后续研究怎么做成客户端 代码: from tkinter import * from u ...

  10. English trip -- VC(情景课) 6 C Is your class at 11:00? 你的课11点开始吗?

    Grammar focus 语法点 Is your class  at 11:00 ?  # 带be动词的一般疑问句 Yes, it is No, it isn't   相当于 is not  Pra ...