w*s 发帖数: 7227 | 1 【 以下文字转载自 Linux 讨论区 】
发信人: wds (净洗前尘,从头再来), 信区: Linux
标 题: How to debug "broken pipe" in linux programming ?
发信站: BBS 未名空间站 (Wed Dec 21 20:34:08 2011, 美东)
hi we have complicated multithread code, as most companies do.
Now under stress test we have broken pipe.
How to debug this pls ?
Q1:
if in the popen, pclose case,
http://www.crasseux.com/books/ctutorial/Programming-with-pipes.
if 1 thread is exiting, it can check all opening pipes associating with it,
can it ?
if pipes still open, then wait till the other side finishes,
then exit this thread gracefully
Can this work ?
Q2:
if someone uses pipe();
http://linuxprograms.wordpress.com/2008/02/15/using-pipes-in-li
seems it never need to close pipe, then what to do ? | X****r 发帖数: 3557 | 2 Google SIGPIPE
,
【在 w*s 的大作中提到】 : 【 以下文字转载自 Linux 讨论区 】 : 发信人: wds (净洗前尘,从头再来), 信区: Linux : 标 题: How to debug "broken pipe" in linux programming ? : 发信站: BBS 未名空间站 (Wed Dec 21 20:34:08 2011, 美东) : hi we have complicated multithread code, as most companies do. : Now under stress test we have broken pipe. : How to debug this pls ? : Q1: : if in the popen, pclose case, : http://www.crasseux.com/books/ctutorial/Programming-with-pipes.
| w*s 发帖数: 7227 | 3 big cow,
if i use the reference count, do u think it can work ?
【在 X****r 的大作中提到】 : Google SIGPIPE : : ,
| X****r 发帖数: 3557 | 4 First, popen creates a new process, not just a new thread.
Second, delay exiting of the child process that reads from
the pipe just masks the underlying problem. What do you do
with these extra data you read in after you're supposed to
exit? If you're going to ignore them, then the parent process
that writes to the pipe should just ignore SIGPIPE and handle
the error in fwrite/fprintf/etc. properly.
【在 w*s 的大作中提到】 : big cow, : if i use the reference count, do u think it can work ?
|
|