最近在项目中使用了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. BZOJ4896 [Thu Summer Camp2016]补退选

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...

  2. AtCoder square869120 Contest #3 F sushi

    本文版权归ljh2000和博客园共有,欢迎转载,但须保留此声明,并给出原文链接,谢谢合作. 本文作者:ljh2000 作者博客:http://www.cnblogs.com/ljh2000-jump/ ...

  3. pandas 处理数据中NaN数据

    使用dropna()函数去掉NaN的行或列 import pandas as pd import pickle import numpy as np dates = pd.date_range() d ...

  4. TeamViewer 说明截图

  5. Lua面向对象 --- 封装

    工程结构: Player.lua: Player = {} function Player:new() local self = {} setmetatable(self, {__index = Pl ...

  6. url 中需要转义的字符

    1. +  URL 中+号表示空格 %2B 2. 空格 URL中的空格可以用+号或者编码 %20 3. /  分隔目录和子目录 %2F  4. ?  分隔实际的 URL 和参数 %3F  5. % 指 ...

  7. 如何将新项目添加到github仓库中?只需简单几步~即可实现

    问题描述:新建了一个项目,如何将其设置为git项目?如何关联到github上的仓库? 只需简单几步,但前提是需要已经安装好了git,并且有github账户 本文使用IntelliJ IDEA 其他编辑 ...

  8. android--------微信 Tinker 热修复 (三)

    前面简单介绍了一下Tinker热修复的使用,包含debug和release,今天就来分享一下微信针对Tinker热修复提供的一个平台,TinkerPatch补丁管理后台. 1:什么是TinkerPat ...

  9. php fpm深度解析

    摘自:https://www.cnblogs.com/wanghetao/p/3934350.html 当我们在谈到cgi的时候,我们在讨论什么 最早的Web服务器简单地响应浏览器发来的HTTP请求, ...

  10. service几种访问类型(集群外负载均衡访问LoadBalancer , 集群内访问ClusterIP,VPC内网负载均衡LoadBalancer ,集群外访问NodePort)

    一.集群外访问(负载均衡) kind: ServiceapiVersion: v1spec: ports: - protocol: TCP port: 4341 targetPort: 8080 no ...