今天遇到了这个问题,之前找了半天原来是IO事件的socket描述符在epoll_ctl()处理之前关闭了。

if(epoll_ctl(epollFd, EPOLL_CTL_DEL, ev->fd, &epv) < 0)
  fprintf(stderr, "Event Del failed[fd=%d], epoll failed: %s\n",ev->fd, strerror(errno));

在删除事件   epoll_ctl(kdpfd, EPOLL_CTL_DEL, events[n].data.fd,&ev);

之前 调用close()关闭socket描述符,
就会导致删除事件时epoll_ctl()返回值小于0,并且提示epoll failed: Bad file descriptor

事件删除后,再调用close()关闭对应的socket描述符就不会报错了。

出现epoll failed: Bad file descriptor的原因的更多相关文章

  1. 近期编程问题——epoll failed:bad file descriptor

    出现问题:epoll_wait:Bad file descriptor 原因:IO时间的socket描述符在epoll_ctl处理前就关闭了. 解决方法:不要在epoll_ctl之前关闭socket描 ...

  2. fastDFS errcode:9 path:Bad file descriptor errcode:22 path:Invalid argument

    fastDFS errcode:9 path:Bad file descriptor errcode:22 path:Invalid argument <error>status:4 er ...

  3. java.net.SocketException: recvfrom failed: EBADF (Bad file descriptor)

    1. 问题说明: 与服务器之间进行socket通信的时候,客户端关闭socket之后,会抛出一个IOException,异常信息如下: java.net.SocketException: recvfr ...

  4. Ceph osd启动报错osd init failed (36) File name too long

    在Ceph的osd节点上,启动osd进程失败,查看其日志/var/log/ceph/ceph-osd.{osd-index}.log日志,报错如下: 2017-02-14 16:26:13.55853 ...

  5. dpdk EAL: Error reading from file descriptor 23: Input/output error

    执行test程序时输出: EAL: Error reading from file descriptor 23: Input/output error 原因: 在虚拟机添加的网卡,dpdk不支持导致的 ...

  6. Vue.js报错Failed to resolve filter问题原因

    Vue.js报错Failed to resolve filter问题原因 金刚 vue Vue.js js javascript 之前使用vue.js写分页功能时,写了一个过滤器,发现一个比较奇怪的错 ...

  7. ORA-19563: header validation failed for file

    在测试服务器还原数据库时遇到了ORA-19563错误.如下所示 RMAN-00571: ======================================================== ...

  8. 出现Bad command or the file name的原因

    出现Bad command or file name的原因 中文释义:错误的命令或文件名 . 错误原因:不能识别输入的命令 . 方法:检查所输入的指令是否正确,包括拼写和大小写等情况.

  9. mongodb在ubuntu下的couldn‘t remove fs lock errno:9 Bad file descriptor的错误

    按照官网上的安装方法: 在ubuntu系统下有可能出现如下错误: couldn't remove fs lock errno:9 Bad file descriptor 此时需要修改文件所有者 $ s ...

随机推荐

  1. mysql 异常宕机 ..InnoDB: Database page corruption on disk or a failed,,InnoDB: file read of page 8.

    mysql 测试环境异常宕机 系统:\nKylin 3.3 mysql版本:5.6.15--yum安装,麒麟提供的yum源数据库版本 error日志 181218 09:38:52 mysqld_sa ...

  2. mycat 分片

    1  配置下面两种ER分片,并结合日志分析子表插入过程中的不同 (1).父表按照主键ID分片,子表的分片字段与主表ID关联,配置为ER分片 (2).父表的分片字段为其他字段,子表的分片字段与主表ID关 ...

  3. SQL修改日期时间型数据中的年月日

    以下语句为更改 tevent表中的eventtime字段为2011-7-16当eventtime为2012-02-29时 update tevent set  eventtime='2011-7-16 ...

  4. 2015.12.12 DataGridveiw中添加checkbox列

    最简单的办法是通过DataTable来添加 DataTable中添加bool类型的列 dtpdf.Columns.Add("入库", typeof(bool)); DataRow ...

  5. 10-19C#基础--第四部分类型(2)重点

    类型: 一.数字:Math类型 1)Math.Ceiling() ( 表示进位.));//只要小数点后有值,就向前进一位,取上限. string s = Console.ReadLine(); dou ...

  6. myeclipse debug 工具栏不见了

    1.打开myeclipse,点击右上角的debug图标.如图: 点击debug页面右上角的三角形,把下拉菜单的Show Debug Toobar给勾上.如图: 3 这样debug工具的已经显示出来了

  7. UIBezierPath和CAShapeLayer配合肆意画图

    一.CAShapeLayer CAShapeLayer 是 CALayer 的子类,但是比 CALayer 更灵活,可以画出各种图形   使用CAShapeLayer 绘制一个矩形 let layer ...

  8. jQuery选择器整理

    最使用近工作中常用到jQuery,在过滤器的使用方面生疏,所以本文整理了些有关知识点,以便于自己查找方便,或为朋友们提供方便! 一.基本选择器 $("#test") 选取id为te ...

  9. nodejs读文件

    1.异步读取文件:var fs= require('fs'); // 从文件系统中读取请求的文件内容 fs.readFile(pathname.substr(1), function (err, da ...

  10. Win 7系统优化/设置小工具 (脚本)

    Win7系统优化脚本 用了多年win7,用的过程中,发现了一些问题,关于系统基本的优化,和个人的使用习惯设置等等,做成了一个脚本,可以一键设置win7的系统设置,比如更新提醒,关闭防火墙提示,烦人的系 ...