pipe.stdin.write("stop\n") 中的管道损坏

Posted

技术标签:

【中文标题】pipe.stdin.write("stop\\n") 中的管道损坏【英文标题】:Broken pipe in pipe.stdin.write("stop\n")pipe.stdin.write("stop\n") 中的管道损坏 【发布时间】:2014-08-06 13:33:09 【问题描述】:

我对 yandex-tank-jmeter 有疑问。

我的 load.ini:

[tank]
plugin_web=/usr/lib/yandex-tank/Tank/Plugins/WebOnline.py
[jmeter]
jmx=tw2testplan_0_33.jmx
jmeter_path=/home/apache-jmeter-2.11/bin/jmeter
args=-r
[graphite]
address=localhost
port=2003
prefix=jmeter
[web]
port=8089
[monitoring]
config=monitoring.xml

monitoring.xml:

<Monitoring>
<Host address="someip">
<CPU measure="user,system,iowait"/>
<System measure="csw,int"/>
<Memory measure="free,used"/>
<Disk measure="read,write"/>
<Net measure="recv,send"/>
</Host>
</Monitoring>

所以当测试试图停止时,我会在控制台中看到下一个输出:

13:18:13 INFO: Finishing monitoring
13:18:15 WARNING: Killing 15630 with 9
13:18:17 WARNING: Killing 15630 with 9
13:18:21 WARNING: Killing 15630 with 9

进程 15630:

root@loadtest:~#  ps -ef | grep 15630
root     15630 15593  0 13:15 ?        00:00:00 [ssh] <defunct>

然后我尝试按 CTRL+C:

13:19:11 INFO: Trying to shutdown gracefully...
13:19:11 INFO: Finishing test...
13:19:11 ERROR: Failed finishing plugin <Aggregator.AggregatorPlugin instance at         0x7f0b7434afc8>: I/O operation on closed file
13:19:11 INFO: Finishing monitoring

3:19:11 WARNING: Problems stopping agent: Traceback (most recent call last):
File "/usr/lib/yandex-tank/Tank/MonCollector/collector.py", line 352, in stop
pipe.stdin.write("stop\n")
IOError: [Errno 32] Broken pipe

13:19:13 WARNING: Killing 15630 with 9

请帮我解决这个问题。

【问题讨论】:

【参考方案1】:

好的,作为临时解决方案(我不知道从 python 端是否可以)已修复collector.py:

第 358 行:

while tankcore.pid_exists(pipe.pid):
if first_try:
logging.debug("Killing %s with %s", pipe.pid, signal.SIGTERM)
os.killpg(pipe.pid, signal.SIGTERM)
pipe.wait() ----- was added
first_try = False
time.sleep(0.1)

【讨论】:

以上是关于pipe.stdin.write("stop\n") 中的管道损坏的主要内容,如果未能解决你的问题,请参考以下文章

从SVN工作文件夹更改压缩(SVN st)

EXCEL VBA 里面如何动态获取字符串转换为变量名?

mybatis中参数是list,parametertype怎么写

psycopg2.ProgrammingError:“st”或附近的语法错误\r,

vue中iview框架下select选择器渲染的时候报警告Invalid prop: type check failed for prop "value". Expected St

Postgis 和 Postgresql:类型错误“st_point”不存在