Broken Pipe Error

下面这段话用一个例子解释了什么时候会出现Broken Pipe. 简单的说就是,当peer socket 关闭时,可是你还是再往这个socket上发送数据的时候,Broken Pipe就会产生。

When you run type rvm | head -1, bash executes type rvm in one process, head -1 in another.1 The stdout of type is connected to the "write" end of a pipe, the stdin of head to the "read" end. Both processes run at the same time.

The head -1 process reads data from stdin (usually in chunks of 8 kB), prints out a single line (according to the -1 option), and exits, causing the "read" end of the pipe to be closed. Since the rvmfunction is quite long (around 11 kB after being parsed and reconstructed by bash), this means thathead exits while type still has a few kB of data to write out.

At this point, since type is trying to write to a pipe whose other end has been closed – a broken pipe – the write() function it caled will return an EPIPE error, translated as "Broken pipe". In addition to this error, the kernel also sends the SIGPIPE signal to type, which by default kills the process immediately.

(The signal is very useful in interactive shells, since most users do not want the first process to keep running and trying to write to nowhere. Meanwhile, non-interactive services ignore SIGPIPE – it would not be good for a long-running daemon to die on such a simple error – so they find the error code very useful.)

However, signal delivery is not 100% immediate, and there may be cases where write() returns EPIPE and the process continues to run for a short while before receiving the signal. In this case, type gets enough time to notice the failed write, translate the error code and even print an error message to stderr before being killed by SIGPIPE. (The error message says "-bash: type:" since type is a built-in command of bash itself.)

This seems to be more common on multi-CPU systems, since the type process and the kernel's signal delivery code can run on different cores, literally at the same time.

In other words, it's nothing you can fix, it's also nothing to be concerned about, and it is not related to your rvm installation in any way.



转自:http://superuser.com/questions/554855/how-can-i-fix-a-broken-pipe-error

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
水利改革发展 中国政府高度重视水利建设,将水利作为国家基础设施建设的优先领域。政策文件强调了防洪抗旱、水资源管理、水环境保护和水生态修复等方面的全面要求,推动了水利信息化的发展。 智慧水利建设目标 智慧水利的建设目标是通过数据共享、应用惠民、应急预警等手段,打破信息孤岛,提升应急抢险协作能力,加强水利数据在惠民信息化方面的应用。同时,提出了共享联动化、解决信息安全问题、提高水利信息科技创新能力等目标。 智慧水利建设模式 智慧水利的建设模式包括构建统一平台、数据中心、信息整合平台、决策支持系统等,以实现水利、海洋、环保等政府部门和公众的信息共享和服务。此外,还包括了云计算虚拟化、网络传输、采集工程等多个方面的技术应用。 智慧水利应用实例 智慧水利的应用实例包括视频水文工程监控、多要素一体化检测设备、汛情预警智能联动、三防决策指挥、河长综合信息展示等。这些应用通过集成GIS、互联网地图服务、物联网设备等技术,实现了对水利设施的实时监控、数据分析和应急响应。 成功案例与展望 智慧水利的成功案例展示了通过视频监控、预警信息发布、移动办公信息APP等技术,有效提升了灾害应对能力、水资源管理和河长制的实施效果。这些案例表明,智慧水利的建设不仅提高了水利管理的效率和水平,也为未来的水利信息化发展提供了方向。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值